Skip to content

Commit 1d33c09

Browse files
committed
[IR] Add nocapture & nosync to matrix intrinsics.
As suggested in D81472, the load/store intrinsics' pointer arguments can be marked as nocapture and all matrix intrinsics as nosync. This also re-flows the intrinsic definitions, to make them a little more concise.
1 parent 6580c48 commit 1d33c09

File tree

3 files changed

+34
-46
lines changed

3 files changed

+34
-46
lines changed

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,46 +1436,34 @@ let IntrProperties = [IntrNoMem, IntrWillReturn] in {
14361436

14371437
//===----- Matrix intrinsics ---------------------------------------------===//
14381438

1439-
def int_matrix_transpose : Intrinsic<[llvm_anyvector_ty],
1440-
[LLVMMatchType<0>,
1441-
llvm_i32_ty,
1442-
llvm_i32_ty],
1443-
[IntrNoMem, IntrSpeculatable,
1444-
IntrWillReturn, ImmArg<ArgIndex<1>>,
1445-
ImmArg<ArgIndex<2>>]>;
1446-
1447-
def int_matrix_multiply : Intrinsic<[llvm_anyvector_ty],
1448-
[llvm_anyvector_ty,
1449-
llvm_anyvector_ty,
1450-
llvm_i32_ty,
1451-
llvm_i32_ty,
1452-
llvm_i32_ty],
1453-
[IntrNoMem, IntrSpeculatable,
1454-
IntrWillReturn, ImmArg<ArgIndex<2>>,
1455-
ImmArg<ArgIndex<3>>,
1456-
ImmArg<ArgIndex<4>>]>;
1457-
1458-
def int_matrix_columnwise_load : Intrinsic<[llvm_anyvector_ty],
1459-
[LLVMAnyPointerType<LLVMMatchType<0>>,
1460-
llvm_i32_ty,
1461-
llvm_i32_ty,
1462-
llvm_i32_ty],
1463-
[IntrArgMemOnly, IntrReadMem,
1464-
IntrWillReturn,
1465-
ImmArg<ArgIndex<2>>,
1466-
ImmArg<ArgIndex<3>>]>;
1467-
1468-
def int_matrix_columnwise_store : Intrinsic<[],
1469-
[llvm_anyvector_ty,
1470-
LLVMAnyPointerType<LLVMMatchType<0>>,
1471-
llvm_i32_ty,
1472-
llvm_i32_ty,
1473-
llvm_i32_ty],
1474-
[IntrArgMemOnly, IntrWillReturn,
1475-
IntrWriteMem,
1476-
WriteOnly<ArgIndex<1>>,
1477-
ImmArg<ArgIndex<3>>,
1478-
ImmArg<ArgIndex<4>>]>;
1439+
def int_matrix_transpose
1440+
: Intrinsic<[llvm_anyvector_ty],
1441+
[LLVMMatchType<0>, llvm_i32_ty, llvm_i32_ty],
1442+
[ IntrNoSync, IntrWillReturn, IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<1>>,
1443+
ImmArg<ArgIndex<2>>]>;
1444+
1445+
def int_matrix_multiply
1446+
: Intrinsic<[llvm_anyvector_ty],
1447+
[llvm_anyvector_ty, llvm_anyvector_ty, llvm_i32_ty, llvm_i32_ty,
1448+
llvm_i32_ty],
1449+
[IntrNoSync, IntrWillReturn, IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<2>>,
1450+
ImmArg<ArgIndex<3>>, ImmArg<ArgIndex<4>>]>;
1451+
1452+
def int_matrix_columnwise_load
1453+
: Intrinsic<[llvm_anyvector_ty],
1454+
[LLVMAnyPointerType<LLVMMatchType<0>>, llvm_i32_ty, llvm_i32_ty,
1455+
llvm_i32_ty],
1456+
[IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrReadMem,
1457+
NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<2>>,
1458+
ImmArg<ArgIndex<3>>]>;
1459+
1460+
def int_matrix_columnwise_store
1461+
: Intrinsic<[],
1462+
[llvm_anyvector_ty, LLVMAnyPointerType<LLVMMatchType<0>>,
1463+
llvm_i32_ty, llvm_i32_ty, llvm_i32_ty],
1464+
[IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrWriteMem,
1465+
WriteOnly<ArgIndex<1>>, NoCapture<ArgIndex<1>>,
1466+
ImmArg<ArgIndex<3>>, ImmArg<ArgIndex<4>>]>;
14791467

14801468
//===---------- Intrinsics to control hardware supported loops ----------===//
14811469

llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-double.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ entry:
6767
ret <8 x double> %load
6868
}
6969

70-
; CHECK: declare <9 x double> @llvm.matrix.columnwise.load.v9f64.p0v9f64(<9 x double>*, i32, i32 immarg, i32 immarg) [[READONLY:#[0-9]]]
70+
; CHECK: declare <9 x double> @llvm.matrix.columnwise.load.v9f64.p0v9f64(<9 x double>* nocapture, i32, i32 immarg, i32 immarg) [[READONLY:#[0-9]]]
7171

72-
; CHECK: declare <8 x double> @llvm.matrix.columnwise.load.v8f64.p0v8f64(<8 x double>*, i32, i32 immarg, i32 immarg) [[READONLY]]
72+
; CHECK: declare <8 x double> @llvm.matrix.columnwise.load.v8f64.p0v8f64(<8 x double>* nocapture, i32, i32 immarg, i32 immarg) [[READONLY]]
7373

74-
; CHECK: attributes [[READONLY]] = { argmemonly nounwind readonly willreturn }
74+
; CHECK: attributes [[READONLY]] = { argmemonly nosync nounwind readonly willreturn }

llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-double.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ define void @strided_store_2x3(<10 x double> %in, double* %out) {
6767

6868
declare void @llvm.matrix.columnwise.store.v10f64(<10 x double>, double*, i32, i32, i32)
6969

70-
; CHECK: declare void @llvm.matrix.columnwise.store.v6f64.p0f64(<6 x double>, double* writeonly, i32, i32 immarg, i32 immarg) [[WRITEONLY:#[0-9]]]
70+
; CHECK: declare void @llvm.matrix.columnwise.store.v6f64.p0f64(<6 x double>, double* nocapture writeonly, i32, i32 immarg, i32 immarg) [[WRITEONLY:#[0-9]]]
7171

72-
; CHECK: declare void @llvm.matrix.columnwise.store.v10f64.p0f64(<10 x double>, double* writeonly, i32, i32 immarg, i32 immarg) [[WRITEONLY]]
72+
; CHECK: declare void @llvm.matrix.columnwise.store.v10f64.p0f64(<10 x double>, double* nocapture writeonly, i32, i32 immarg, i32 immarg) [[WRITEONLY]]
7373

74-
; CHECK: attributes [[WRITEONLY]] = { argmemonly nounwind willreturn writeonly }
74+
; CHECK: attributes [[WRITEONLY]] = { argmemonly nosync nounwind willreturn writeonly }

0 commit comments

Comments
 (0)