Skip to content

Commit db8c38d

Browse files
authored
[NVVM] Make nanosleep op duration SSA value (#167331)
1 parent 321afc7 commit db8c38d

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,7 @@ def NVVM_ReduxOp :
512512
//===----------------------------------------------------------------------===//
513513

514514
def NVVM_NanosleepOp : NVVM_Op<"nanosleep">,
515-
Arguments<(ins
516-
ConfinedAttr<I32Attr, [IntMinValue<1>, IntMaxValue<1000000>]>:$duration)>
515+
Arguments<(ins I32:$duration)>
517516
{
518517
let summary = "Suspends the thread for a specified duration.";
519518

@@ -531,8 +530,7 @@ def NVVM_NanosleepOp : NVVM_Op<"nanosleep">,
531530

532531
string llvmBuilder = [{
533532
createIntrinsicCall(builder,
534-
llvm::Intrinsic::nvvm_nanosleep,
535-
{builder.getInt32($duration)});
533+
llvm::Intrinsic::nvvm_nanosleep, {$duration});
536534
}];
537535
let assemblyFormat = "attr-dict $duration";
538536
}

mlir/test/Target/LLVMIR/nvvmir-invalid.mlir

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,6 @@ llvm.func @ld_matrix(%arg0: !llvm.ptr<3>) {
578578

579579
// -----
580580

581-
llvm.func @nanosleep() {
582-
// expected-error@+1 {{integer constant out of range for attribute}}
583-
nvvm.nanosleep 100000000000000
584-
llvm.return
585-
}
586-
587-
// -----
588-
589581
llvm.func @clusterlaunchcontrol_query_cancel_is_canceled_invalid_return_type(%try_cancel_response: i128) {
590582
// expected-error@+1 {{'nvvm.clusterlaunchcontrol.query.cancel' op is_canceled query type returns an i1}}
591583
%res = nvvm.clusterlaunchcontrol.query.cancel query = is_canceled, %try_cancel_response : i32

mlir/test/Target/LLVMIR/nvvmir.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ llvm.func @nvvm_pmevent() {
970970
// -----
971971

972972
// CHECK-LABEL: @nanosleep
973-
llvm.func @nanosleep() {
974-
// CHECK: call void @llvm.nvvm.nanosleep(i32 4000)
975-
nvvm.nanosleep 4000
973+
llvm.func @nanosleep(%duration: i32) {
974+
// CHECK: call void @llvm.nvvm.nanosleep(i32 %{{.*}})
975+
nvvm.nanosleep %duration
976976
llvm.return
977977
}

0 commit comments

Comments
 (0)