mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-05-16 16:02:45 -04:00
*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)* Closes #5178 ## Problem NVCC embeds the CUDA fat binary blob in the host-side x86 assembly inside a `#APP`/`#NO_APP` inline-assembly block, under a label called `fatbinData`. In a realistic kernel this can be 100+ lines of `.quad` hex values — a wall of noise before any user-readable code. Example: https://godbolt.org/z/W3YMcq8oY ## Fix Per-compiler pre-processing step in `NvccCompiler.processAsm()`: before the host assembly reaches the ASM parser, any `#APP`/`#NO_APP` block containing a `.nv_fatbin` section is stripped out entirely. - Only `.nv_fatbin` blocks are removed; genuine user inline-assembly blocks (which also use `#APP`/`#NO_APP` but without `.nv_fatbin`) are left intact. - Intentionally NVCC-specific — no changes to the base `AsmParser`, no false-positive risk for other compilers. - Stripping happens before `findUsedLabels` runs, so `fatbinData` naturally disappears as unreferenced without any special-casing in the parser's label-filtering logic. - Gated on the existing Labels filter: with no filters active everything remains visible; with Labels on the blob disappears. ## Testing **New compiler unit tests** (`test/compilers/nvcc-tests.ts`): - Strips `#APP`/`#NO_APP` blocks containing `.nv_fatbin` - Preserves `#APP`/`#NO_APP` blocks without `.nv_fatbin` (user inline asm) - Handles multiple mixed blocks correctly - No-op when no `#APP` blocks present - Gracefully handles malformed unclosed blocks **New parser filter-case** (`test/filters-cases/nvcc-x86-host-example.asm`): representative NVCC 12.0 host assembly (real 15-line fat binary, boilerplate functions, `.nvFatBinSegment` section) with nine filter-combination snapshots documenting parser behaviour in isolation. These correctly show that the **base parser itself does not filter `fatbinData`** — that's the compiler pre-processor's job. All 767 tests pass. Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>