[llvm] [X86] Declare memory effects for the AMX intrinsics (PR #229025)
Evgenii Kudriashov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 08:05:44 PDT 2026
================
@@ -5435,120 +5435,161 @@ let TargetPrefix = "x86" in {
//===----------------------------------------------------------------------===//
// AMX - Intel AMX extensions
+// The tile registers and the tile configuration, which no other IR operation
+// can access, as a target memory location. Every intrinsic below reads or
+// writes it, which keeps tile operations ordered with each other, and otherwise
+// declares only the memory it accesses through its pointer argument. The
+// _internal intrinsics further down keep their conservative declarations.
+defvar X86TileState = TargetMem0;
+
let TargetPrefix = "x86" in {
def int_x86_ldtilecfg : ClangBuiltin<"__builtin_ia32_tile_loadconfig">,
- Intrinsic<[], [llvm_ptr_ty], []>;
+ DefaultAttrsIntrinsic<[], [llvm_ptr_ty],
+ [IntrRead<[ArgMem]>, IntrWrite<[X86TileState]>]>;
def int_x86_sttilecfg : ClangBuiltin<"__builtin_ia32_tile_storeconfig">,
- Intrinsic<[], [llvm_ptr_ty], []>;
+ DefaultAttrsIntrinsic<[], [llvm_ptr_ty],
+ [IntrRead<[X86TileState]>, IntrWrite<[ArgMem]>]>;
def int_x86_tilerelease : ClangBuiltin<"__builtin_ia32_tilerelease">,
- Intrinsic<[], [], []>;
+ DefaultAttrsIntrinsic<[], [],
+ [IntrWrite<[X86TileState]>, IntrWriteOnly]>;
def int_x86_tilezero : ClangBuiltin<"__builtin_ia32_tilezero">,
- Intrinsic<[], [llvm_i8_ty], [ImmArg<ArgIndex<0>>]>;
+ DefaultAttrsIntrinsic<[], [llvm_i8_ty],
+ [IntrRead<[X86TileState]>,
----------------
e-kud wrote:
It is not clear to me what is the logic behind here. Why does `tilerelease` only write when `tilezero` writes and reads. Is it about `tilezero` reading tile config?
https://github.com/llvm/llvm-project/pull/229025
More information about the llvm-commits
mailing list