[llvm] [NVPTX] Widen sub-byte and non-power-of-two integers to a legal PTX type (PR #226113)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 03:52:28 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-nvptx
Author: Samarth Narang (snarang181)
<details>
<summary>Changes</summary>
`getPTXFundamentalTypeStr()` prints integers as `.u<N>` for their exact bit width, but PTX has no sub-byte or non-power-of-two integer types. An `i4` kernel parameter becomes `.param .u4`, which ptxas rejects (`Parsing error near '.u4': syntax error`); every non-power-of-two width up to 64 is affected, as are globals printed through the same path. The output is also self-inconsistent: ISel already loads such a parameter with `max(8, PowerOf2Ceil(N))` bits, so the same kernel declares `.param .u4` and reads it with `ld.param.b8`. Round the printed type up to that width. `i1` keeps its existing `pred`/`.u8` handling; the `i65`–`i127` `llvm_unreachable` is a separate pre-existing issue and is left alone.
Tested with `LLVM_PTXAS_EXECUTABLE` set (ptxas 13.4): NVPTX suite 614/614, and the new test's `%ptxas-verify` fails before this change.
Fixes #<!-- -->225261
---
Full diff: https://github.com/llvm/llvm-project/pull/226113.diff
2 Files Affected:
- (modified) llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (+3-2)
- (added) llvm/test/CodeGen/NVPTX/non-power-of-two-int-param.ll (+46)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226113
More information about the llvm-commits
mailing list