Skip to content

libNVVM backend floors for trap/breakpoint/pmevent (and tanh_approx_f32) encode PTX 9.3, making them unbuildable on the NVVM-IR route #519

Closed

Description

@haixuanTao

Any device code whose panic/abort path reaches trap cannot compile through the NVVM-IR route (the route every libdevice-using module is forced onto, since emit_nvvm_ir = needs_libdevice). The build dies at export with:

Export failed: generated intrinsic `trap` (`v1:i0295`) requires PTX 9.3, newer than cuda-oxide can request

Cause: in generated_intrinsic_targets.rs, the LibNvvm backend requirement for trap encodes minimum_ptx: from_encoded(93):

GeneratedBackendRequirement {
    backend: GeneratedIntrinsicBackend::LibNvvm,
    requirement: GeneratedTargetRequirement {
        minimum_ptx: GeneratedPtxVersion::from_encoded(93),
        hardware: GeneratedHardwareTarget::AnyOf(&[
            GeneratedHardwareAlternative::MinimumSm(75),
        ]),
    },
},

and ptx_isa_requirement_for_floor tops out at 89..=90 => Ptx90, so the floor is unconditionally rejected — trap is unbuildable under libNVVM, period.

The floors look like an evidence-pipeline artifact rather than real ISA minima: the source recipe for the same intrinsic (cuda-intrinsics-gen/src/resolve.rs, debug_control_recipe) says minimum_ptx: "1.0" (PTX ISA §9.7.20.4 — trap has existed since PTX 1.0, and the LlvmNvptx backend floor for the same target is 3.2 with sm_20). 9.3 with sm_75 reads like the doc/probe version the evidence was collected against, not a floor.

Four generated targets carry from_encoded(93) under LibNvvm: trap, breakpoint, pmevent, tanh_approx_f32. The first three are PTX 1.x-era miscellaneous instructions; tanh.approx.f32 is PTX 7.0/sm_75.

Hit in practice: a physics shader crate using libdevice math plus ordinary bounds-check panics — every kernel with a panic path fails export. Locally overriding the trap floor to from_encoded(10) unblocks the build and the resulting cubins run correctly on sm_120, for whatever that's worth as evidence the floor is not real.

Happy to PR the change if you can point at where the fix belongs — the generated file itself, or the upstream evidence data it is rendered from.

Activity

  1. haixuanTao commented on Jul 27, 2026

    @haixuanTao
    ContributorAuthor

    Correction to the report: tanh_approx_f32 was a scan artifact on my side — its generated floors are a healthy 7.0/sm_80 on both backends. The only affected targets are the three debug-control intrinsics (trap, breakpoint, pmevent), and the floor turns out to be hardcoded in expand_debug_control_admission rather than coming from the evidence pipeline. PR with the source-level fix + regeneration: #520 (kept the sm_75 hardware floor — backend-codegen evidence must sit exactly at the hardware floor and CUDA 13 cannot probe older targets; the PTX floor alone was the blocker).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions