[all-commits] [llvm/llvm-project] 65305a: [mlir][ArmSME] Insert intrinsics to enable/disable ZA

Cullen Rhodes via All-commits all-commits at lists.llvm.org
Fri Jun 16 02:45:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 65305aeab99ad8ea09dd85e28a41c657152a08fb
      https://github.com/llvm/llvm-project/commit/65305aeab99ad8ea09dd85e28a41c657152a08fb
  Author: Cullen Rhodes <cullen.rhodes at arm.com>
  Date:   2023-06-16 (Fri, 16 Jun 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
    A mlir/include/mlir/Dialect/ArmSME/Transforms/Transforms.h
    M mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
    M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
    M mlir/lib/Dialect/ArmSME/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
    A mlir/test/Dialect/ArmSME/enable-arm-za.mlir
    M mlir/test/Target/LLVMIR/arm-sme.mlir

  Log Message:
  -----------
  [mlir][ArmSME] Insert intrinsics to enable/disable ZA

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).

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), 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

[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

Reviewed By: awarzynski, dcaballe

Differential Revision: https://reviews.llvm.org/D153050




More information about the All-commits mailing list