Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(408)

Issue 833046: Review: more runtime optimizations (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 9 months ago by larrygritz
Modified:
14 years, 9 months ago
Reviewers:
ckulla
CC:
dev-osl_imageworks.com, osl-dev_googlegroups.com
Base URL:
http://openshadinglanguage.googlecode.com/svn/trunk/
Visibility:
Public.

Description

This round: * Constant assignment where the types didn't match (like R_float = A_int_const) were previously a dead end, since it couldn't directly alias R to A. But now we coerce constants at runtime, so, for example, that would turn into R_float = A_float_const, which can then lead to further optimizations. * Output params assigned constants unconditionally will alias just like regular params, and furthermore, if they are only written that one time and not previously read, the assignment is removed entirely and the default value of the output param changed to its eventual final value. * ANY ops, not just assignment, and even if not involving constants, are removed if none of their written arguments are ever used (because other optimizations have removed them). * I found that sometimes it's helpful to do a few more passes even BEYOND when a pass is completed that appears to not have changed any ops. This is because even without changing ops, it may propagate some aliasing that can lead to more optimization in later passes. * Remove 'if' statements (even if not constant) if they are empty (which can happen if their entire contents, but not the 'if' itself, has been removed by other optimizations). * Locals or temps that are assigned but never read (effectively dead) turn the assignment into a nop. Also some miscellaneous refactoring: * The status messages that say how the optimization is going now happens per group (network), rather than per instance. Same basic information, less clutter. * Split collapse into separate ops and syms collapse routines. * Split the collapsing out into a separate loop over the shader group (rather than for each instance right after optimizing it) as a precursor to a future round of "inter-group optimization". These things all together reduce the number of instructions executed at runtime by almost an additional 20% (compared to the runtime optimizations we were already doing). The turns out to reduce runtime in our renderer by another 10% for production frames.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+378 lines, -147 lines) Patch
src/include/osl_pvt.h View 1 chunk +1 line, -0 lines 0 comments Download
src/liboslcomp/oslcomp.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
src/liboslcomp/oslcomp_pvt.h View 1 chunk +2 lines, -1 line 0 comments Download
src/liboslexec/context.cpp View 1 chunk +1 line, -1 line 0 comments Download
src/liboslexec/oslexec_pvt.h View 1 chunk +33 lines, -3 lines 0 comments Download
src/liboslexec/runtimeoptimize.cpp View 30 chunks +338 lines, -139 lines 0 comments Download

Messages

Total messages: 2
larrygritz
14 years, 9 months ago (2010-03-30 21:31:42 UTC) #1
ckulla
14 years, 9 months ago (2010-03-30 22:23:55 UTC) #2
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b