[clang] [llvm] [NVPTX] Add builtin support for 'globaltimer' (PR #79765)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 9 11:39:11 PST 2024


================
@@ -140,6 +140,17 @@ define void @test_exit() {
   ret void
 }
 
+; CHECK-LABEL: test_globaltimer
+define i64 @test_globaltimer() {
+; CHECK: mov.u64         %r{{.*}}, %globaltimer;
+  %a = tail call i64 @llvm.nvvm.read.ptx.sreg.globaltimer()
----------------
Artem-B wrote:

Thise need sm_30+. Right now the test runs with sm_30. LLVM does compile these intrinsics, but ptxas fails because the register is not available on sm_20.

The test needs to be updated to use a reasonably new GPU target. Probably sm_60 is the oldest one anybody still cares about.

https://github.com/llvm/llvm-project/pull/79765


More information about the cfe-commits mailing list