[Mesa-dev] [PATCH] i965: Avoid dependency hints on math opcodes
Matt Turner
mattst88 at gmail.com
Wed Mar 19 14:16:26 PDT 2014
On Wed, Mar 19, 2014 at 7:27 AM, Mike Stroyan <mike at lunarg.com> wrote:
> Ken,
>
> The defect depends on details of the shader compiler reusing registers.
> Old register values are sometimes left in some channels when the
> write-after-write hints are used.
> Further reducing the GLSL test case would be tricky because the reuse of g8
> would be likely to be changed.
> I did already spend quite a long time reducing a larger shader to this
> relatively small example.
> The GLSL is not anyone's source code. It results from at least two levels
> of machine translation and my own rewrite.
>
> The difference in the resulting native code is now very simple.
> The only difference from my patch is the presence of NoDDClr and NoDDChk
> hints on the three math opcodes.
> The results are then used by an opcode without any NoDDChk hinting.
> With math data dependency hints in place the results are often incorrect.
> They clearly don't work reliably.
I was surprised and skeptical of the original report, but there's
pretty clearly something broken given your example.
I'm skeptical because there's no documentation that says the
dependency hints are broken, and also because this is the first report
we've gotten about them being broken since their support was
implemented in Dec 2012.
I spent some time trying to come up with a minimal test case, but had
a lot of trouble because the vec4 backend's register coalescing pass
doesn't handle enough things. Instead of consecutive instructions
assigning single channels of a single register, we generate four sets
of exp2+mov instructions, and the dependency hints fall on the MOVs,
rather than the exp2s.
Grepping our shader database, I cannot find a single math instruction
that we applied the dependency control hints on, so it may be that
your test somehow avoids the register coalescing problem and produces
the only math instructions with dependency hints.
Questions I have:
- Does the broken behavior depend on the hardware generation? I.e.,
broken on Ivy Bridge and Haswell but not Ironlake?
- There are ~12 math ops. Are the dependency control hints broken for
all of them, or just exp2?
More information about the mesa-dev
mailing list