Skip to content

install: tell a too-new gcc how to build, instead of letting ninja fail - #67

Merged
cnygaard merged 2 commits into
mainfrom
feat/preflight-nvcc-host-compiler
Aug 18, 2026
Merged

install: tell a too-new gcc how to build, instead of letting ninja fail#67
cnygaard merged 2 commits into
mainfrom
feat/preflight-nvcc-host-compiler

Conversation

@cnygaard

Copy link
Copy Markdown
Owner

fedora:44 ships gcc 16; CUDA's crt/host_config.h refuses anything past 15. A source install there dies with unsupported GNU version on every .cu file — after the user has waited out a PyTorch download. Pre-flight promises the opposite: run this command and you are ready.

What pre-flight now says

  nvcc:    host gcc is 16; CUDA supports <= 15
           prebuilt wheels are unaffected — they compile nothing
           to build from source:  sudo dnf install -y gcc15 gcc15-c++
           then:  export NVCC_CCBIN=/usr/bin/g++-15

A note, not a blocker. Since 0.8.6 the prebuilt wheels cover cp310–cp314, so the common path compiles nothing and works fine on fedora:44 — blocking would refuse an install that succeeds. Only --glq-source reaches nvcc, and one test asserts the exit status is unchanged.

Measured, not inferred

claim evidence
The cap is not an artifact of the pip-shipped nvidia/cu13 headers the full CUDA 13.3.1 toolkit (4.1 GB, installed via the runfile) refuses gcc 16 identically — so "install the toolkit" is not a fix
NVCC_CCBIN removes it default gcc 16 → 6 unsupported GNU version errors; NVCC_CCBIN=/usr/bin/g++-150
The advice actually works on real fedora:44: follow the package advice, then the compat-compiler advice, then install.sh --glq-source with NVCC_CCBIN exported → install exit 0, EXT_OK:True, 0 gcc errors

That last row is the point: the extension builds on fedora:44, which was previously impossible.

Honesty about coverage

Only the Fedora mapping is verified. The apt / pacman / zypper lines follow each distro's usual naming and carry # unverified in the source rather than being presented as tested — same convention as pkg_hint's RHEL notes.

Ordering quirk, documented in the source

On a pristine image there is no gcc yet, so this says nothing on the first pre-flight run and appears on the second, once the package advice has been followed. That is the order the installer is used in (pre-flight → install packages → pre-flight), and guessing the version of a compiler that is not installed would be worse than silence.

Tests

Four new cases in tests/test_preflight_sh.py, CPU-only and CI-runnable. They fake gcc -dumpversion with a PATH shim rather than an env back door, so the real detection path is exercised: advice appears at gcc 16, stays silent at 15, names both the package and NVCC_CCBIN, and never changes the exit status. 57 pre-flight tests pass.

`--codebook` defaulted to `e8_shell`, the original 8-D lattice, while the README recommended
trellis and the checkpoint table marked a trellis build as the fastest GLQ decode. Someone
following the docs and running `glq-quantize` got a lattice checkpoint. Trellis (QTIP TCQ)
has been the recommended path since v0.7 and wins where bits are scarcest — SmolLM3-3B at
2 bpw is PPL 11.94 against 13.79.

Two defaults had to move together. `GLQ_TRELLIS_VARIANT` defaulted to `hyb`, but the fused
CUDA kernels consume a **3INST** checkpoint; a hyb one falls back to the pure-torch decode,
"correct but materially slower". Defaulting to trellis alone would have shipped checkpoints
with no fast path — worse than the lattice default it replaced. Quality is a wash: 3INST-4
matches HYB-4 on SQNR and PPL.

Consequences handled rather than discovered later:

- **`scripts/batch_quantization.py` omitted `--codebook` when it equalled `e8_shell`**,
  relying on the CLI default matching its own. It now always passes the flag: a job that
  declared e8_shell would otherwise have silently become trellis, and any fractional-bpw job
  would then fail, since trellis takes uniform integers only.
- **The resume run-key** now hashes the real variant instead of `""`. This invalidates
  existing trellis resume stores, which is correct: they hold *hyb* work that must never be
  resumed into a 3inst run.
- **The mixed-precision refusal now names `--codebook e8_shell`.** `--bpw 3.5` used to work
  with no flag at all; without that pointer the new default turns it into a dead end.
- README's "fractional like 2.5 also works" is no longer true by default, and says so.

`build_parser()` is split out of main() so CLI defaults can be asserted without running a
quantization — there was no test surface for them before.

Also documents the Blackwell/FlashInfer caveat next to the `vllm serve` examples: on sm_120
with no CUDA Toolkit, vLLM's sampler compiles at startup and takes the engine down before
the first token. glq-chat falls back on its own; `vllm serve` and `LLM(...)` do not.

Full local suite: 1085 passed, 882 skipped.
fedora:44 ships gcc 16; CUDA's crt/host_config.h refuses anything past 15. A source install
there dies with "unsupported GNU version" on every .cu file, after the user has already
waited out a PyTorch download. Pre-flight promises the opposite: run this command and you
are ready.

Pre-flight now reports the mismatch and names the fix:

    nvcc:    host gcc is 16; CUDA supports <= 15
             prebuilt wheels are unaffected — they compile nothing
             to build from source:  sudo dnf install -y gcc15 gcc15-c++
             then:  export NVCC_CCBIN=/usr/bin/g++-15

Deliberately a note, not a blocker. Since 0.8.6 the prebuilt wheels cover cp310-cp314, so
the common path compiles nothing and works fine on fedora:44 — blocking would refuse an
install that succeeds. Only --glq-source reaches nvcc.

Measured, not inferred:

- The cap is real and not an artifact of the pip-shipped headers. The full CUDA 13.3.1
  toolkit (4.1 GB) refuses gcc 16 identically, so "install the toolkit" is not a fix.
- NVCC_CCBIN is: with the default gcc 16 the build produced 6 "unsupported GNU version"
  errors; with NVCC_CCBIN=/usr/bin/g++-15, zero.
- End to end on fedora:44 — follow pre-flight's package advice, then its compat-compiler
  advice, then `install.sh --glq-source` with NVCC_CCBIN exported: install exit 0,
  EXT_OK:True, 0 gcc errors. The extension builds where it previously could not.

Only the Fedora mapping is verified. The apt/pacman/zypper lines follow each distro's usual
naming and are marked `# unverified` in the source rather than presented as tested.

Tests fake `gcc -dumpversion` with a PATH shim rather than an env back door, so the real
detection is exercised: advice appears at gcc 16, stays silent at 15, names both the package
and NVCC_CCBIN, and never changes the exit status.
@cnygaard
cnygaard enabled auto-merge (squash) August 18, 2026 22:49
@cnygaard
cnygaard merged commit a58aff8 into main Aug 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant