<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SB is used only after GPR check / GPR max is not dynamic"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=85596#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SB is used only after GPR check / GPR max is not dynamic"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=85596">bug 85596</a>
              from <span class="vcard"><a class="email" href="mailto:ptpzz@yandex.ru" title="Vadim Girlin <ptpzz@yandex.ru>"> <span class="fn">Vadim Girlin</span></a>
</span></b>
        <pre>(In reply to Lauri Kasanen from <a href="show_bug.cgi?id=85596#c0">comment #0</a>)
<span class="quote">> Many big shaders that currently fail with
> r600_shader_select - Failed to build shader variant (type=1) -12
> r600_shader_from_tgsi - GPR limit exceeded - shader requires foo registers

> would actually work if the GPR check was moved to after SB, as SB reduces
> the GPR usage quite nicely.

> Another thing is that 128 is the lowest common denominator, and many cards
> have 192 or 256, which could be checked with the radeon_info ioctl.</span >

As Alex said, ISA encoding doesn't allow to address more than 128 registers in
the instructions. IIRC we also by default reserve 4 GPRs as temporary (they are
not preserved between ALU clauses), so the actual limit is 124 (or even 120?).

It's also the reason why we can't simply move the GPR check, the shader is
passed from TGSI translator to SB in the ISA encoding which can't represent the
code that uses more than 128 registers.

If anyone would like to revive a direct TGSI->SB translator that solves the
problem, here is the branch:
<a href="http://cgit.freedesktop.org/~vadimg/mesa/log/?h=wip-sb-tgsi">http://cgit.freedesktop.org/~vadimg/mesa/log/?h=wip-sb-tgsi</a>
There were no piglit regressions with that branch on evergreen when it was
implemented, but now I suspect it's a bit outdated.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>