Skip to content

DisjointSlice::{get_mut, get_unchecked_mut, get_thread_local} intrinsic dispatch is effectively dead and fails verification when it actually fires #219

Closed

Description

@hatoo

Description
The intrinsic dispatch arm in
https://github.com/NVlabs/cuda-oxide/blob/43a7637895510b55cfa0a40c993c934409c7e556/crates/mir-importer/src/translator/terminator/mod.rs#L3059-L3093 that maps
"get_mut" | "get_unchecked_mut" | "get_thread_local" => emit_get_thread_local(...)
never runs for get_mut in normal builds because get_mut is always inlined, and when it is forced to run it produces IR that fails verification because it returns *mut T instead of Option<&mut T>. The get_mut handling is therefore non-functional: it only "works" by being bypassed, and breaks the moment the call survives to the importer.

Minimal reproducer

https://github.com/NVlabs/cuda-oxide/blob/43a7637895510b55cfa0a40c993c934409c7e556/crates/cuda-device/src/disjoint.rs#L178-L191

Edit it #[inline(never)] to run the dispatch and fails to compile

error: [rustc_codegen_cuda] Device codegen failed: PTX generation failed: Verification failed for 'vecadd':
         Compilation error: verification failed.
       MirStoreOp value type must match pointer element type
         Failed operation:
       mir.store (v10, v29) [] []: <(mir.ptr <mir.enum <Option,builtin.integer ui8,[None, Some],[0, 1],[0, 1],[mir.ptr <builtin.fp32 ,mutable:true,addrspace:0>],[],0,0,0>,mutable:true,addrspace:0>, mir.ptr <builtin.fp32 ,mutable:true,addrspace:0>) -> ()>

Activity

  1. added
    bug
    TBD
    on Jun 14, 2026
  2. added a commit that references this issue on Jun 18, 2026
  3. added a commit that references this issue on Sep 30, 2026
    7dc0e6c
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

    TBDbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions