Skip to content

fuzzer: seeds whose device code calls libdevice are scored COMPILE_FAIL #414

Closed

Description

@alejandro-soto-franco

Summary

The fuzzer scores any generated seed whose device code calls libdevice as COMPILE_FAIL, so that whole class of program never reaches the CPU/GPU comparison.

Reproducer

python3 crates/fuzzer/tools/run_seed.py --seed 162

Seed 162 generates device code calling fmaf64. On main:

seed 162: COMPILE_FAIL [backend]
Failed to load PTX module: DriverError(301, "file not found")

Cause

crates/rustc-codegen-cuda/examples/rustlantis-smoke/src/main.rs loads the kernel with

ctx.load_module_from_file("rustlantis_smoke.ptx")

Once libdevice is involved the backend does not emit a bare PTX file, so the load fails and the harness records a compiler failure. The compiler behaved correctly here; the harness could not read what it produced.

crates/cuda-host already solves this: load_embedded_module dispatches over cubin, PTX, NVVM IR and LTOIR payloads and links whichever the backend produced. examples/libdevice_math uses that path for exactly this reason.

Impact

Every libdevice-calling seed is silently excluded from differential coverage, and each one is reported as a compiler failure rather than as a harness limitation, which makes sweep results misleading.

Note on precision

Unlocking these seeds admits a second question. The trace comparison is exact u64 hash equality. That is sound for fma, which IEEE-754 specifies as a single correctly-rounded operation, and it is not sound across libdevice generally: the transcendentals are not required to match the host's libm bit for bit. This repository already compares them within 2 ULP in examples/math_atan and through ulp_distance in examples/libdevice_math.

Floats never enter the trace hash directly, since the trace API has no f32 or f64 arm and the adapter refuses a bare float dump, but a float still reaches it through an as cast to an integer, through a comparison yielding a bool, or through rustlantis' transmute_place. A mismatch on such a seed therefore needs manual precision triage before it is treated as a backend bug.

Environment: RTX 5060, driver 610.43.03, CUDA 13.1.

Activity

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