[PATCH] D153050: [mlir][ArmSME] Insert intrinsics to enable/disable ZA
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 10:00:55 PDT 2023
c-rhodes created this revision.
c-rhodes added reviewers: awarzynski, dcaballe, WanderAway.
c-rhodes added a project: MLIR.
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, kristof.beyls.
Herald added a reviewer: aartbik.
Herald added a reviewer: ftynse.
Herald added a project: All.
c-rhodes requested review of this revision.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: stephenneuendorffer, nicolasvasilache.
This patch adds two LLVM intrinsics to the ArmSME dialect:
- llvm.aarch64.sme.za.enable
- llvm.aarch64.sme.za.disable
for enabling the ZA storage array [1], as well as patterns for inserting
them during legalization to LLVM at the start and end of functions if
the function has the 'arm_za' attribute (D152695 <https://reviews.llvm.org/D152695>).
In the future ZA should probably be automatically enabled/disabled when
lowering from vector to SME, but this should be sufficient for now at
least until we have patterns lowering to SME instructions that use ZA.
N.B. The backend function attribute 'aarch64_pstate_za_new' can be used
manage ZA state (as was originally tried in D152694 <https://reviews.llvm.org/D152694>), but it emits calls
to the following SME support routines [2] for the lazy-save mechanism
[3]:
- __arm_tpidr2_restore
- __arm_tpidr2_save
These will soon be added to compiler-rt but there's currently no public
implementation, and using this attribute would introduce an MLIR
dependency on compiler-rt. Furthermore, this mechanism is for routines
with ZA enabled calling other routines with it also enabled. We can
choose not to enable ZA in the compiler when this is case.
Depends on D152695 <https://reviews.llvm.org/D152695>
[1] https://developer.arm.com/documentation/ddi0616/aa
[2] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#sme-support-routines
[3] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#the-za-lazy-saving-scheme
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153050
Files:
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
mlir/include/mlir/Dialect/ArmSME/Transforms/Transforms.h
mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
mlir/lib/Dialect/ArmSME/Transforms/CMakeLists.txt
mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
mlir/test/Dialect/ArmSME/enable-arm-za.mlir
mlir/test/Target/LLVMIR/arm-sme.mlir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153050.531810.patch
Type: text/x-patch
Size: 9207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230615/73131ca1/attachment.bin>
More information about the llvm-commits
mailing list