-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NVPTX] Add builtin support for 'nanosleep' PTX instrunction (#79888)
Summary: This patch adds a builtin for the `nanosleep` PTX function. It takes either an immediate or a register and sleeps for [0, 2t] nanoseconds given t. More information at the documentation: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#miscellaneous-instructions-nanosleep
- Loading branch information
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
; RUN: llc < %s -march=nvptx64 -O2 -mcpu=sm_70 -mattr=+ptx63 | FileCheck %s | ||
; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_70 -mattr=+ptx63 | %ptxas-verify %} | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
declare void @llvm.nvvm.nanosleep(i32) | ||
|
||
; CHECK-LABEL: test_nanosleep_r | ||
define void @test_nanosleep_r(i32 noundef %d) { | ||
entry: | ||
; CHECK: nanosleep.u32 %[[REG:.+]]; | ||
call void @llvm.nvvm.nanosleep(i32 %d) | ||
ret void | ||
} | ||
|
||
; CHECK-LABEL: test_nanosleep_i | ||
define void @test_nanosleep_i() { | ||
entry: | ||
; CHECK: nanosleep.u32 42; | ||
call void @llvm.nvvm.nanosleep(i32 42) | ||
ret void | ||
} |
This needs
-arch=sm_70
passed to ptxas. Otherwise lit runs it with sm_60 and it fails.