diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td @@ -19,6 +19,8 @@ def LLVM_i8Ptr_global : LLVM_IntPtrBase<8, 1>; def LLVM_i8Ptr_shared : LLVM_IntPtrBase<8, 3>; +def LLVM_i64ptr_global : LLVM_IntPtrBase<64, 1>; +def LLVM_i64ptr_shared : LLVM_IntPtrBase<64, 3>; //===----------------------------------------------------------------------===// // NVVM dialect definitions @@ -188,13 +190,29 @@ /// mbarrier.init instruction with shared pointer type def NVVM_MBarrierInitSharedOp : NVVM_Op<"mbarrier.init.shared">, - Arguments<(ins LLVM_i8Ptr_shared:$addr, I32:$count)> { + Arguments<(ins LLVM_i64ptr_shared:$addr, I32:$count)> { string llvmBuilder = [{ createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_init_shared, {$addr, $count}); }]; let assemblyFormat = "$addr `,` $count attr-dict `:` type(operands)"; } +def NVVM_MBarrierInvalOp : NVVM_Op<"mbarrier.inval">, + Arguments<(ins LLVM_AnyPointer:$addr)> { + string llvmBuilder = [{ + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_inval, {$addr}); + }]; + let assemblyFormat = "$addr attr-dict `:` type(operands)"; +} + +def NVVM_MBarrierInvalSharedOp : NVVM_Op<"mbarrier.inval.shared">, + Arguments<(ins LLVM_i64ptr_shared:$addr)> { + string llvmBuilder = [{ + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_inval_shared, {$addr}); + }]; + let assemblyFormat = "$addr attr-dict `:` type(operands)"; +} + //===----------------------------------------------------------------------===// // NVVM synchronization op definitions //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/LLVMIR/nvvm.mlir b/mlir/test/Dialect/LLVMIR/nvvm.mlir --- a/mlir/test/Dialect/LLVMIR/nvvm.mlir +++ b/mlir/test/Dialect/LLVMIR/nvvm.mlir @@ -353,3 +353,17 @@ nvvm.mbarrier.init.shared %barrier, %count : !llvm.ptr<3>, i32 llvm.return } + + +llvm.func private @mbarrier_inval_generic(%barrier: !llvm.ptr) { + // CHECK: nvvm.mbarrier.inval %{{.*}} : !llvm.ptr + nvvm.mbarrier.inval %barrier : !llvm.ptr + llvm.return +} + + +llvm.func private @mbarrier_inval_shared(%barrier: !llvm.ptr<3>) { + // CHECK: nvvm.mbarrier.inval.shared %{{.*}} : !llvm.ptr<3> + nvvm.mbarrier.inval.shared %barrier : !llvm.ptr<3> + llvm.return +}