[Codegen][CPU] Pick inner-tiled unroll factors from a register budget.#2
Open
bjacob wants to merge 1 commit into
Open
[Codegen][CPU] Pick inner-tiled unroll factors from a register budget.#2bjacob wants to merge 1 commit into
bjacob wants to merge 1 commit into
Conversation
Replace the hard-coded `intrinsics_m = intrinsics_n = 1` from the previous commit with a cost model that, for the intrinsic/orientation already chosen by chooseIntrinsic, picks the largest power-of-two unroll factors such that the three tiles (ACC + LHS + RHS) still fit in the target's architectural vector register file, breaking ties with arithmetic intensity (effM*effN)/(effM+effN) so approximately- square tiles win. Introduces: - `getRegisterSpaceBytes(intrinsic)` returning the bit capacity of the three-tile budget; scalable ISAs (SVE/SVE2) are treated as their 128-bit VL minimum. - `po2UnrollCap` to round the static-matmul-extent cover count down to a power of two (and fall back to the budget for dynamic dims). - `chooseUnrolling` as Phase 2 of `chooseCpuInnerTiledMmaForEncoding`. Updates materialize_encoding_x86_64.mlir to reflect the new unroll choices (e.g. intrinsics_m = 16 on dynamic AVX-512 f32 matmul). Made-with: Cursor Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
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.
Replace the hard-coded
intrinsics_m = intrinsics_n = 1from the previous commit with a cost model that, for the intrinsic/orientation already chosen by chooseIntrinsic, picks the largest power-of-two unroll factors such that the three tiles (ACC + LHS + RHS) still fit in the target's architectural vector register file, breaking ties with arithmetic intensity (effM*effN)/(effM+effN) so approximately- square tiles win.Introduces:
getRegisterSpaceBytes(intrinsic)returning the bit capacity of the three-tile budget; scalable ISAs (SVE/SVE2) are treated as their 128-bit VL minimum.po2UnrollCapto round the static-matmul-extent cover count down to a power of two (and fall back to the budget for dynamic dims).chooseUnrollingas Phase 2 ofchooseCpuInnerTiledMmaForEncoding.Updates materialize_encoding_x86_64.mlir to reflect the new unroll choices (e.g. intrinsics_m = 16 on dynamic AVX-512 f32 matmul).
Made-with: Cursor