[Mesa-dev] [PATCH] glsl: Optimize certain if-statements to just casts from the condition
Ian Romanick
idr at freedesktop.org
Thu Jan 15 19:54:44 PST 2015
On 01/16/2015 04:25 PM, Matt Turner wrote:
> On Thu, Jan 15, 2015 at 6:46 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 01/16/2015 08:15 AM, Matt Turner wrote:
>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>
>>> Some shaders end up with code that looks something like:
>>>
>>> if (some_condition)
>>> result = 1.0;
>>> else
>>> result = 0.0;
>>>
>>> This pass converts those if-statements to
>>>
>>> result = float(some_condition);
>>>
>>> total instructions in shared programs: 5934568 -> 5921818 (-0.21%)
>>> instructions in affected programs: 723433 -> 710683 (-1.76%)
>>> GAINED: 26
>>> LOST: 7
>>
>> I was getting really different results here... on my more recent version
>> (that should produce the same IR), I was getting basically the reverse
>> lost / gained. The other results were about the same.
>>
>> I updated both Mesa and shader-db, and I'm not able to do a full
>> shader-db run now. At semi-arbitrary points in the run I get
>>
>> Exception: Only shader 0 found.
>> shaders/closed/unreal4/sun-temple/180.shader_test
>
> You need commit f0aec4ee1e3 to avoid an assertion failure.
>
>> If I run that shader_test by hand, I get multiple shader emitted. I'm
>> using the older run.py... is it possible that's broken?
>
> It's been working for me in occasional usage to generate *.out files.
Trivial. :p
diff --git a/run.py b/run.py
index 4fc366e..d57da21 100755
--- a/run.py
+++ b/run.py
@@ -57,7 +57,7 @@ def run_test(filename):
raise Exception('Only shader 0 found. {}'.format(filename))
re_search = re.compile(
- r'(?P<stage>[A-Za-z0-9]+) shader\: (?P<count>\d+) instructions.')
+ r'(?P<stage>[A-Za-z0-9 ]+) shader\: (?P<count>\d+) instructions.')
for line in lines:
match = re_search.match(line)
if match is not None:
More information about the mesa-dev
mailing list