[TorchToTosa] Lower MXFP8 aten._scaled_mm to TOSA#4560
Open
[TorchToTosa] Lower MXFP8 aten._scaled_mm to TOSA#4560
Conversation
7bd9fed to
4ae4df1
Compare
Add Torch op definitions, abstract interpretation support, and FX importer handling for aten._scaled_mm, including float8_e8m0fnu blocked-scale tensors. Keep this change independent of TOSA legalization. Include frontend export/import coverage for per-tensor and blocked-scale FP8 shapes, plus out_dtype=None dtype inference. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: I102732ad725f89477b7f8fb2339d4fe920fa647b
Add TorchToTosa legalization for static FP8 aten._scaled_mm with real-valued scale tensors. Lower FP8 inputs to TOSA FP8 matmul, then apply the combined scale product to the f32 accumulator before optional bias and final output cast. Support scalar/[1] per-tensor scales and simple 1-D lhs/rhs channel scales, with lit and Python coverage for e4m3, e5m2, mixed FP8 inputs, bias, and rejection cases. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: Ie14b7f1a662820951ffb174285c9b5b15a9467b0
Add TorchToTosa legalization for block-scaled FP8 aten._scaled_mm with float8_e8m0fnu scale tensors. Lower canonical rank-3 blocked tensors directly to tosa.matmul_t_block_scaled with BLOCK_SIZE_32, and recover the exported reshape/view -> aten._scaled_mm -> reshape/view pattern for flat blocked tensors. Support rectangular and ragged blocked shapes plus the exported transpose/contiguous/reshape RHS form, with lit and Python coverage. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: I31f1605b30e54e3ea32b551c8584a1b3e92bdb3e
4ae4df1 to
f94be46
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.
Adds TorchToTosa legalization for block-scaled FP8 aten._scaled_mm with float8_e8m0fnu scale tensors.
Stacked on #4558 and #4559. Until those land and this branch is rebased, the GitHub diff will include the earlier stack commits as well. The review focus for this PR is the third commit: MXFP8/block-scaled TorchToTosa lowering.