[Misc] Add per-kernel ISA resource delta table - #928
Open
Phil-amd wants to merge 1 commit into
Open
Conversation
A passing test suite hides VGPR and spill regressions, so a codegen change that alters address arithmetic needs its resource impact diffed per kernel. Each entry is scoped to one kernel, since an ISA file can hold several, and --diff exits non-zero when the comparison itself cannot be trusted: missing kernels or unparsed metrics must not read as "no regressions". Refs #898.
Phil-amd
force-pushed
the
phil/isa-resource-delta-table
branch
from
July 31, 2026 10:27
fcc0d7e to
aa6a2d4
Compare
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.
Summary
Adds
scripts/isa_resource_table.py, which extracts per-kernel VGPR/SGPR/spill/scratch/ds_read counts from the21_final_isa.sfiles of aFLYDSL_DUMP_IRtree and diffs two such trees.Motivation
A green test suite says nothing about register pressure. A codegen change that alters address arithmetic can leave every test passing while quietly adding VGPRs or introducing spills in one kernel, and nothing in CI surfaces that today.
This came out of the #898 work, where it caught a real regression: an early version of that fix inflated
fused_add_rmsnorm_kernel_0from 9 to 27 VGPRs on gfx950 while the whole suite still passed. The tool is useful independently of that fix, so it is sent on its own.Changes
scripts/isa_resource_table.py— summarize one dump tree (--jsonto save), or--diff before.json after.jsonto compare.tests/unit/test_isa_resource_table.py— 13 cases pinning the assembly shape the parser depends on.Two properties worth calling out, both learned the hard way:
amdhsa.kernelsentry; instruction counts from its body alone, bounded by whichever comes first of.Lfunc_endNor the next kernel's label.Nonerather than a plausible number, and--diffexits 2 when the comparison itself cannot be trusted: no kernels on either side, a kernel present on only one side, or an unparsed metric. A gate that cannot distinguish "no regressions" from "no data" manufactures false confidence.Usage:
ARCH=gfx950 COMPILE_ONLY=1makes this work for an architecture you do not have hardware for, since the dump happens before kernel launch.Performance (if applicable)
Not applicable — tooling only, no product code touched.
Testing
ruffandblack --line-length 120cleanDependencies
Breaking Changes
None. New script plus its tests; no existing file is modified.