Repository navigation
[backend][cpu] hoist AMX stack buffers to the function entry block - #6
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
AMX buffer hoisting changes allocation lifetimes across regions, but missing upstream MLIR implementations and unavailable native/AMX validation require human review of the regression and runtime tests.
No open issues 🎉
What changed in this PR
This PR moves stack buffers created during CPU AMX lowering to the function entry block, avoiding dynamic LLVM stack allocations, and separates vector preparation from math approximation.
Changes:
- Hoist operand-free AMX stack allocations to the entry block with at least 64-byte alignment.
- Extract vector preparation into dedicated source and header files and update build integration.
- Add a regression test checking allocation placement and alignment after a leading loop.
| File | Description |
|---|---|
backends/cpu/test/test_compiler_cpu.py |
Add regression coverage for entry-block allocations and alignment. |
backends/cpu/PrepareCPUVectors.h |
Declare the extracted vector preparation pass factory. |
backends/cpu/PrepareCPUVectors.cpp |
Implement vector preparation and AMX buffer hoisting. |
backends/cpu/compiler.cmake |
Build the new source with matching RTTI settings. |
backends/cpu/compiler_cpu.cpp |
Include the dedicated vector preparation header. |
backends/cpu/ApproximateMath.h |
Remove the relocated vector preparation declaration. |
backends/cpu/ApproximateMath.cpp |
Remove the relocated vector preparation implementation. |
Review effort: Balanced
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.
Hoist allocas, restructure preparation pass.