Issue 171709
Summary [LLVM 20.1][NVPTX] Jump tables are broken for sm < sm_70
Labels new issue
Assignees
Reporter jvesely
    brx instructions are used unconditionally, but require ptx version 6.0+ [1]
This leads to the follwoing failures:
```
$ llc -o - -mcpu sm_50 ~/repos/llvm-project/llvm/test/CodeGen/NVPTX/jump-table.ll | TMPDIR=/tmp ptxas - -c -o /dev/null
ptxas /tmp/tmpxft_000f7701_00000000-0_stdin, line 24; error   : Feature '.branchtargets directive' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f7701_00000000-0_stdin, line 29; error   : Feature 'brx.idx' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f7701_00000000-0_stdin, line 73; error   : Feature '.branchtargets directive' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f7701_00000000-0_stdin, line 80; error   : Feature 'brx.idx' requires PTX ISA .version 6.0 or later
ptxas fatal   : Ptx assembly aborted due to errors
$
$ llc -o - -mcpu sm_60 ~/repos/llvm-project/llvm/test/CodeGen/NVPTX/jump-table.ll | TMPDIR=/tmp ptxas - -c -o /dev/null 
ptxas /tmp/tmpxft_000f6b97_00000000-0_stdin, line 24; error   : Feature '.branchtargets directive' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f6b97_00000000-0_stdin, line 29; error   : Feature 'brx.idx' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f6b97_00000000-0_stdin, line 73; error   : Feature '.branchtargets directive' requires PTX ISA .version 6.0 or later
ptxas /tmp/tmpxft_000f6b97_00000000-0_stdin, line 80; error   : Feature 'brx.idx' requires PTX ISA .version 6.0 or later
ptxas fatal   : Ptx assembly aborted due to errors
```

Specifying the ptx version through attributes only works for some SMs.
```
$ llc -mattr='ptx60' -o - -mcpu sm_50 jump-table.ll | TMPDIR=/tmp ptxas - -c -o /dev/null
$
```
breaks for others:
```
$ llc -mattr='ptx60' -o - -mcpu sm_60 jump-table.ll | TMPDIR=/tmp ptxas - -c -o /dev/null
ptxas fatal   : SM version specified by .target is higher than default SM version assumed
```


[1] https://docs.nvidia.com/cuda/parallel-thread-execution/#control-flow-instructions-brx-idx
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to