Repository navigation
agx: restore trivial phi elimination after spilling on every chip - #549
Merged
Merged
Conversation
agx_opt_trivial_phi() must skip a phi whose source was itself remapped in the current round (the cycle case it does not handle). e4520b1 ("agx: fix SSA repair with phis with constants") added the constant-source check in front of that test and dropped its negation, so the pass skipped every phi whose source had not been remapped -- on the first round, all of them -- and removed nothing. f6835fb and 36bdc21 restored the negation, but only for G17P and the M5 family, leaving every other chip on the broken test. The pass runs on AIR after the spiller's SSA repair. It only compares phi sources and rewrites uses; it does not depend on the ISA encoding, the register file or any per-chip hardware behaviour. The restored condition is the one every chip ran before e4520b1, and the constant-source check that commit added still comes first, so remap[] is indexed only by normal SSA values and the overread it fixed stays fixed. Make the corrected test unconditional, which brings AGX2 (G13/G14), G15, G16 and G18G to the code G17P and M5 already use. The host test now expects the trivial join phi to be removed for an AGX2, an AGX3B and an AGX3C key alike. x86: 138/138 asahi unit tests pass (baseline 138/138). Of the 599 precompiled libagx kernels, 593 are byte-identical to aurora-wip. The six that change are the spilling tessellator kernels for the G15S, G15G and G16G targets: tess_tri_1 goes from 9415 to 7005 words and tess_quad_1 from 10930 to 9647, because their trivial phis no longer become copies. The G13G, G13X, G17P, G17G and G18G kernels are unchanged. Builds on 36bdc21 and f6835fb by DjDeveloperr. Fixes: e4520b1 ("agx: fix SSA repair with phis with constants") Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream e4520b1 added a constant-source check to trivial-phi elimination in SSA repair and dropped a
!, so the pass skipped every phi on every chip. 36bdc21 / f6835fb restored it only for G17P and M5.Change
Restore the condition on every chip. The pass only compares phi sources and rewrites uses; nothing in it depends on the ISA, register file or encoding. The constant-source check still comes first, so the remap[] overread e4520b1 fixed stays fixed.
G17PRemovesTrivialJoinPhibecomesRemovesTrivialJoinPhiand checks G13G, G17P and G17S keys.libagx: 593 of 599 kernels byte-identical; the six that change all shrink and are G15/G16 targets (
libagx_tess_tri_19415 -> 7005 words,libagx_tess_quad_110930 -> 9647 on g15s/g15g/g16g). g13g, g13x, g17p, g17g and g18g kernels are unchanged.Testing
Newly reaches the M1 Pro and M2 (G17P and M5 already had the fix). Rows:
Hardware rows used one combined build of all sweep branches (
sweep/all5= aurora-wip c55152d + this and the sibling sweep branches) against aurora-wip c55152d, both gcc release builds with identical meson options, loaded as user-space overlays (VK_DRIVER_FILES / LD_LIBRARY_PATH) on the production kernels; nothing installed, no reboot.Method
--warmup-ms 300 --runs 5 --run-ms 250, arms interleaved, 70 C cool-down gate.Still to run
dEQP-VK.tessellation.* on a G15/G16 machine (the only libagx kernels that change).
Fixes: e4520b1 ("agx: fix SSA repair with phis with constants"). Builds on 36bdc21 and f6835fb (Diljit Singh).
Assisted-by: LLM (Claude:Opus 5.5)