[PATCH] D121208: [AArch64][SME] Split up SME features. (alternative approach)

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 04:26:16 PDT 2022


sdesmalen added a comment.

Hi @t.p.northover, I've added you as a reviewer since you're the AArch64 backend maintainer and the approach set out in this patch has some implications on (forward-)compatibility of the IR.

This patch tries to model the feature flags for predicating instructions for Arm's Scalable Matrix Extension (SME).

In short: this patch adds three new subtarget features and adds them (by default) to all AArch64 subtargets:

- `pstate-sm0` (enables instructions that are valid when SME streaming mode is enabled or SME is not available)
- `pstate-sm1` (enables instructions that are valid when SME streaming mode is enabled)
- `pstate-za1` (enables instructions that are valid when SME ZA accumulator array is enabled)

By disabling the above features we can limit LLVM's use of certain instructions. For example, when SME Streaming Mode is enabled, LLVM can't use most NEON instructions or certain SVE(2) instructions.
We express that with `+sme,-pstate-sm0,+pstate-sm1` which:

- Enables all streaming-compatible NEON/SVE/SVE2 instructions implied by `+sme` (which work regardless of whether PSTATE.SM=0 or PSTATE.SM=1)
- Enables all SME instructions that are valid when PSTATE.SM=1.
- Disables all instructions that rely on PSTATE.SM=0 (this is most of NEON and certain SVE(2) instructions)

By default, the `pstate-sm0/sm1/za1` features are always added to the list of subtarget-features when constructing the AArch64Subtarget. This way, when the user passes `+sme` it will enable all SME instructions (regardless of pstate.sm/za).
This has the consequence that when compiling to bitcode, LLVM will always add `+pstate-sm0/sm1/za1` as AArch64 features to the bitcode, making these features more or less a permanent requirement going forward irrespective of whether SME is targeted.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121208/new/

https://reviews.llvm.org/D121208



More information about the llvm-commits mailing list