Repository navigation
perf(tensilelite): recompute the CPU reference only when its inputs were rewritten - #15262
Draft
Alex-Vasile wants to merge 1 commit into
Conversation
Alex-Vasile
force-pushed
the
users/alvasile/tl-speedup-12-reference-input-epoch
branch
from
November 6, 2026 18:24
a490475 to
9a34b05
Compare
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
…ere rewritten DataInitialization publishes an input epoch that moves whenever the host inputs are rewritten, and ReferenceValidator recomputes the per-solution CPU reference only when it moved (--verify-reference-reuse / TENSILELITE_VERIFY_REFERENCE_REUSE=1 recomputes anyway and throws on a stale reference); timers report needed versus redundant MX regeneration and recomputes. Changes when gfx950 MX runs recompute the reference. The now-unused referenceNeedsPerSolutionRecompute() and its gfx1250 test stay until branch 21.
Alex-Vasile
force-pushed
the
users/alvasile/tl-speedup-12-reference-input-epoch
branch
from
November 6, 2026 18:45
9a34b05 to
d6c79a0
Compare
1 task done
This branch has not been deployed
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.
JIRA ID : AIHPBLAS-5257
Motivation
tensilelite-client, the C++ program that runs and validates generated GPU kernels, checks each solution against a CPU reference, the CPU computation of the expected result. For MX problems (microscaling formats, in which a block of values shares one scale) on gfx950, some solutions need their inputs regenerated with a different scale layout.
ReferenceValidatorrecomputed the reference for every solution that could need new inputs, using a predicate (referenceNeedsPerSolutionRecompute()).DataInitialization, which owns the inputs, usually reused them from its cache. Onsubtile_mxfp4, 685 of 9,949 solutions regenerated anything, but the reference was recomputed for all 9,949, about 17 s of CPU time.Technical Details
Production code, client only:
DataInitializationkeeps an input epoch, a counter that it increments wherever it rewrites the host inputs the reference reads. Those places areinitializeCPUInputs,initTensorFromDefault, the grouped-GEMM MX path and a real regeneration ininitOneMXSide.inputEpoch(solution)throwsstd::logic_errorunlesspreSolution()already ran for that solution, so a listener-order mistake fails instead of giving a stale reference.ReferenceValidatorstores the epoch each reference was computed with. InpreSolutionit recomputes, for any GEMM problem, only when the epoch moved. It no longer callsreferenceNeedsPerSolutionRecompute(), which stays in the header until a later change removes it.--verify-reference-reuse, orTENSILELITE_VERIFY_REFERENCE_REUSE=1, recomputes anyway when the epoch did not move. It throws "Stale CPU reference" unless the result is bitwise identical, which catches a missed epoch increment.scripts/analyze_timing.pyknows the new names.Behavior change: on gfx950 MX runs, the reference is recomputed only for solutions whose inputs were rewritten. GPU work and results do not change.
Tests:
DataInitializationInputEpoch.PerSolutionEpochRequiresPreSolutionreplaces the gfx950 predicate test. It runs only on gfx950 or gfx1250 hardware.ReferenceValidator_test.cppcallsDataInitialization::preSolutionbefore the validator, asmaindoes.Test Plan
From
projects/hipblaslt/tensilelite. C++ tests use one configured build:cmake --preset tensilelite -S .. -B <build> -DTENSILELITE_BUILD_TESTING=ONandcmake --build <build> --parallel.ctest --test-dir <build>/tensilelite/tests --output-on-failure -R 'DataInit|ReferenceValidator'on a gfx950 GPU checks the epoch rule and the validator's listener order.TENSILELITE_VERIFY_REFERENCE_REUSE=1 tox -e py3 -- tensilelite/Tests -m common -k 'subtile_mxfp8'on a gfx950 GPU checks that every reused reference equals a fresh one.pre-commit run --from-ref HEAD~1 --to-ref HEADruns the repository hooks on this PR's files.Test Result
Time saved: not measured in isolation. The closest evidence is the change's own commit on the original unsplit branch: before it,
subtile_mxfp4on gfx950 recomputed the CPU reference for all 9,949 solutions, about 17 s of CPU time, while only 685 of them had rewritten inputs. The gfx950 baseline was taken with this change already present, so the before/after full-run comparisons do not include it.Other results, from the original unsplit branch on gfx950:
subtile_mxfp4in verify mode reused 9,264 references, each bitwise identical to a fresh recompute.Not yet run on this branch. Automated GitHub checks are pending.
Related
Device / Architecture Coverage
Client host code (CPU reference scheduling); no kernel generation changes. The behavior change applies to MX problems on gfx950. gfx1250 MX runs also use the epoch. The gfx950 MX common configs need a passing CI run, ideally once with
TENSILELITE_VERIFY_REFERENCE_REUSE=1. gfx1250 is uncovered.Submission Checklist
Risk level
Moderate (3/5): validation is only as correct as the epoch increments. A host-input writer that misses one would let a solution be checked against a stale reference. Verify mode detects that, but CI does not enable it by default.