[llvm] [NVPTX] Pass scalar params wider than 64 bits as byte arrays (PR #226328)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 16:47:24 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-nvptx

Author: Ilias (iliasabk)

<details>
<summary>Changes</summary>

Fixes https://github.com/llvm/llvm-project/issues/226255

Scalar kernel parameters between 65 and 127 bits (e.g. `i96`) crash with `llvm_unreachable("Integer too large")` in `getPTXFundamentalTypeStr`. `shouldPassAsArray` only routes scalars of at least 128 bits through the `.param .align A .b8 name[N]` byte-array form, but PTX fundamental types stop at `.u64`, so i65–i127 fall into a gap where they take the scalar path and die.

This widens the `shouldPassAsArray` threshold to `>64` bits so these parameters use the same byte-array form already used for i128 and wider types. All users of the predicate (formal param emission, call prototypes, return values, `LowerCall`, and `NVPTXPromoteParamAlign`) share it, so callers and callees stay consistent. It also covers other scalar types without a fundamental PTX type (e.g. `x86_fp80`), which hit the same unreachable today.

Regression test covers i65, i96 (the reduced reproducer from the issue), and i127 kernel parameters.

---
Full diff: https://github.com/llvm/llvm-project/pull/226328.diff


2 Files Affected:

- (modified) llvm/lib/Target/NVPTX/NVPTXUtilities.h (+3-1) 
- (added) llvm/test/CodeGen/NVPTX/kernel-param-wide-int.ll (+24) 


``````````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/226328


More information about the llvm-commits mailing list