Skip to content

asahi/compiler: keep AGX2 graphics shaders on the pressure schedule - #977

Closed
DjDeveloperr wants to merge 1 commit into
aurora-wipfrom
fix/agx2-graphics-keep-pressure-schedule
Closed

DjDeveloperr wants to merge 1 commit into
aurora-wipfrom
fix/agx2-graphics-keep-pressure-schedule

Conversation

@DjDeveloperr

Copy link
Copy Markdown

What: Run agx_ilp_schedule() on AGX2 (G13/G14) for compute shaders only. AGX2 vertex, fragment and graphics preamble code goes back to the pressure order it used before #927, which removed the AGX3-only gate. AGX3 and all compute code are unchanged.

Since #927, gpubench-gl render.postfx (1080p, msaa=1) fails its output check on M1 Pro (G13X) and M2 Air (G14G): the centre pixel reads (0,250,0,255). The system Mesa be147e3625 passes on those Macs, and M3 Air (G15G, an AGX3 encoding) passes on current aurora-wip.

Tested:

  • Built the failing tip 418ec74c2f2 and the passing be147e3625 with the no-op drm-shim, then ran gpubench-gl --verify --test render.postfx --param res=1080p --param msaa=1 against both with ASAHI_SHIM_CHIP=g13x AGX_MESA_DEBUG=shaders,internal and ASAHI_MESA_DEBUG=trace,sync.
  • Between the two builds, the only material code change on G13X is the bloom upsample fragment shader. With the ILP schedule it issues all four texture samples before the first wait, three of them on scoreboard slot a. Before, it waited after the second and after each later sample. The scene, downsample and tone-map shaders, every epilog, the background and end-of-tile programs, and the decoded command stream match apart from uniform placement and the zero-LOD-bias sampler form.
  • With this change on top of 418ec74c2f2, the G13X upsample shader is instruction-for-instruction the old schedule (uniform numbering aside), and the preamble loads are serialized again.
  • Mirror asahi and policy CI on DjDeveloperr/mesa ci/agx2-graphics-pressure-schedule.

Risk: two-way. AGX2 graphics code loses the ILP schedule. #927's own rows on G13X and G14G showed no render gain from it (render.heavy 0.00% to -0.21%), and its compute gains are kept.

Not yet:

Pull request #927 removed the AGX3-only gate on agx_ilp_schedule(), so
G13 and G14 vertex, fragment and preamble code now take the ILP schedule
too. Since then gpubench-gl render.postfx (1080p, msaa=1) fails its
output check on M1 Pro (G13X) and M2 Air (G14G): the centre pixel comes
back as (0,250,0) instead of a bright orange. The system Mesa build from
before the change passes on the same Macs, and M3 Air (G15G, an AGX3
encoding) still passes.

Compiling the test on the G13X drm-shim before and after the change
shows one material code change. The bloom upsample fragment shader now
issues all four of its texture samples before the first wait, three of
them on the same scoreboard slot. The scene, downsample and tone-map
shaders, the epilogs, the background and end-of-tile programs and the
command stream state differ only in uniform placement.

The gains #927 measured on G13 and G14 were compute kernels, and its
render rows on those chips were flat, so run the ILP schedule on AGX2
for compute shaders only. AGX2 vertex, fragment and graphics preamble
code goes back to the pressure order it used before #927. The gate is
on the instruction-set encoding because the ILP schedule's sample and
load batching was built and checked against the AGX3 scoreboard, and
AGX2 graphics code has not been proven safe with it.

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown

2bcf1633ced7 J316s (M1 Pro, G13S C0, F45 fleet88) + J413 (M2 Air, G14G B0, F44 fleet88) FAIL on render.postfx: gpubench-gl --verify --test render.postfx --param res=1080p --param msaa=1 still fails output check on both (MESA_SHADER_CACHE_DISABLE=1): J316s control cedf24806bcb ctr=(0,248,0,255) mid_l=114.4 cor_l=60.1 crc=bd594cde valid=false -> #977 2bcf1633ced7 ctr=(0,248,0,255) mid_l=114.4 cor_l=60.1 crc=adb96865 valid=false; J413 control cedf24806bcb ctr=(0,250,0,255) mid_l=114.4 cor_l=87.2 crc=f24d3348 valid=false -> #977 2bcf1633ced7 ctr=(0,250,0,255) mid_l=160.9 cor_l=87.2 crc=6528638a valid=false. (Smoke on 2bcf1633ced7: gpubench-gl render.light, gpubench-vk render.light+compute.light, dEQP-GLES3 abs 48/48, dEQP-VK api.smoke 8/8 ok; 0 GPU faults, 0 AVC, 0 failed.)

@DjDeveloperr

Copy link
Copy Markdown
Author

Superseded: the hardware rows show the regression is elsewhere in #927; reverting #927 instead.

@RyanTheTide

Copy link
Copy Markdown

Exact J316s (M1 Pro, G13S C0) first-parent bisect (be147e3625..033eee8d4bad, 9 steps, same isolated overlay harness, MESA_SHADER_CACHE_DISABLE=1) isolates the render.postfx failure to PR #822 (3fc1b773a416, asahi: coalesce multi-pass batches and emit fragment barriers and few-primitives hints): 83150137f7fe (#821) PASS (valid=true) -> 3fc1b773a416 (#822) FAIL (ctr=(0,249,0,255) mid_l=114.4 cor_l=60.1, valid=false). (033eee8d4bad pre-#927 already failed.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants