Skip to content

PTX generation failed if you use carrying_mul_add #137

Closed

Description

@mutantbob

My kernel uses carrying_mul_add and this seems to break the code generation. This small example should reproduce the problem:

use cuda_device::cuda_module;

#[cuda_module]
mod kernels {
    use cuda_device::{DisjointSlice, kernel, thread};

    #[kernel]
    pub fn asplode(mut dst: DisjointSlice<u32>) {
        let idx = thread::index_1d();

        let (low,carry2) = 4u32.carrying_mul_add(5, 0, 0);
        if let Some(sink) = dst.get_mut(idx) {
            *sink = low;
        }
    }
}

The error starts with

error: [rustc_codegen_cuda] Device codegen failed: PTX generation failed: Verification failed for 'llvm module':
         [name: "Span { id: 3, repr: "/home/thoth/.rustup/toolchains/nightly-2026-04-03-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/uint_macros.rs:3304:13: 3304:64" }", loc: (?)] Compilation error: verification failed.
       Symbol _RINvNtCsiQ4CSjCKWVc_4core10intrinsics16carrying_mul_addmmECs1EXJpIcYT5a_19codegen_explosion_4 not found
         Failed operation:
       builtin.module @codegen_explosion_4 
       {
         ^block1v1():
           llvm.func @asplode: llvm.func <llvm.void (llvm.ptr (0), builtin.integer i64) variadic = false>
             [gpu_kernel: builtin.string "true"] 

I hope I correctly attached the full text of the error here:
explosion.txt

Activity

  1. added
    bug
    codegen
    on Jun 8, 2026
  2. added a commit that references this issue on Jun 11, 2026
    89aac70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcodegen

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions