[Mesa-dev] [PATCH] i965/fs: Fix Sandybridge regressions from SEL optimization.
Ian Romanick
idr at freedesktop.org
Thu Aug 15 15:46:01 PDT 2013
On 08/13/2013 05:57 PM, Kenneth Graunke wrote:
> On 08/13/2013 05:49 PM, Ian Romanick wrote:
>> On 08/13/2013 04:47 PM, Kenneth Graunke wrote:
>>> Sandybridge is the only platform that supports an IF instruction
>>> with an embedded comparison. In this case, we need to emit a CMP
>>> to go along with the SEL.
>>>
>>> Fixes regressions in Piglit's glsl-fs-atan-3, fs-unpackHalf2x16,
>>> fs-faceforward-float-float-float, isinf-and-isnan fs_basic, and
>>> isinf-and-isnan fs_fbo.
>>>
>>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>>> ---
>>> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 17 +++++++++++++----
>>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>>> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>>> index a36c248..984b08a 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>>> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
>>> @@ -1911,10 +1911,19 @@ fs_visitor::try_replace_with_sel()
>>> emit(MOV(src0, then_mov->src[0]));
>>> }
>>>
>>> - fs_inst *sel = emit(BRW_OPCODE_SEL, then_mov->dst, src0,
>>> else_mov->src[0]);
>>> - sel->predicate = if_inst->predicate;
>>> - sel->predicate_inverse = if_inst->predicate_inverse;
>>> - sel->conditional_mod = if_inst->conditional_mod;
>>> + fs_inst *sel;
>>> + if (if_inst->conditional_mod) {
>>> + /* Sandybridge-specific IF with embedded comparison */
>>
>> This doesn't appear to be SNB-specific code. Can you explain this? Is
>> if_inst->conditional_mod only set on SNB? I really need to learn more
>> about the back end...
>
> Normally, control flow looks like:
>
> cmp.l.f0(8) null g5<8,8,1>F 0F
> (+f0) if(8)
>
> For Sandybridge, the hardware designers extended IF to support built-in
> comparisons, so you can simply do:
>
> if.l(8) g5<8,8,1>F 0F
>
> They immediately dropped this with Ivybridge; it's not been present on
> any other platform.
>
> fs_inst::conditional_mod represents that conditional modifier (always =
> 0, never, less, equal, lequal, greater, notequal, gequal).
>
In other words... yes to "Is if_inst->conditional_mod only set on SNB?" :)
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
More information about the mesa-dev
mailing list