Repository navigation
Description
Severity: low (policy). Some switches change numerics, e.g. the fused vs eager GPTQ path and the Cholesky blocking.
Version: 7.11.0 @ 6c3421c
AGENTS.md says runtime behaviour must be selected by the config object or an explicit API argument, never by an environment variable, and that tests must not use monkeypatch.setenv to pick a code path. These reads remain:
Code-path / numerics switches
| Variable | Location |
|---|---|
GPTQMODEL_DISABLE_GPTQ_CUDA (fused vs eager GPTQ; tests/test_gptq_cuda.py selects it via monkeypatch.setenv) |
quantization/gptq.py:2412, quantization/qqq.py:880 |
GPTQMODEL_NPU_CHOLESKY_BLOCK_SIZE (read at import, changes rounding) |
quantization/npu_linalg.py:9 |
GPTQMODEL_FLOATX_CPU_FORCE_NATIVE_FP8 |
quantization/dtype.py:214 |
GPTQ_TORCH_STREAMING, _STREAM_TILE, _TRITON_DEQUANT, _ROCM_GEMV, _ROCM_GEMM, _CACHE_WEIGHTS, _LOOKAHEAD |
nn_modules/qlinear/torch.py:245-276 |
GPTQMODEL_MARLIN_USE_FP32 |
nn_modules/qlinear/marlin.py:158 |
GPTQMODEL_FP32_ACCUM |
qlinear/gemm_awq.py:30, qlinear/gemm_awq_triton.py:32, quantization/awq/modules/triton/gemm.py:28, quantization/paroquant/modules/triton/gemm.py:32 |
GPTQMODEL_AWQ_TRITON_SCHEDULE |
quantization/awq/modules/triton/scheduler.py:27 |
GPTQMODEL_GGUF_FUSED_* (9 vars), GPTQMODEL_GGUF_CPP_NATIVE_MATMUL |
qlinear/gguf.py:1197-1215, qlinear/gguf_cpp.py:952 |
GPTQMODEL_PAROQUANT_* (cache dtypes, triton autotune, STE triton, opt fused rotation / cudagraph / compile) |
qlinear/paroquant.py:53-58, qlinear/paroquant_triton.py:66-70, quantization/paroquant/** |
GPTQMODEL_BITSANDBYTES_CPU_PACKED, GPTQMODEL_BNB_TRITON |
qlinear/bitsandbytes.py:49, qlinear/bitsandbytes_triton.py:109 |
GPTQMODEL_GSQ_DISABLE_{CUDA,HIP}_RELAXATION |
quantization/gsq_cuda_relaxation.py:400-403 |
GPTQMODEL_EXL3_* (tile batch, memory limits, capture spool/frontier) |
exllamav3/.../quantize.py:144, looper/exllamav3_processor.py:127-130, utils/exl3_capture_*.py |
GPTQMODEL_ROCM_QUANT_BLAS |
utils/rocm.py (quant_blas_backend) |
GPTQMODEL_NO_ROCM_LLC |
rocm_llc.py:414 |
GPTQMODEL_RESUME |
models/base.py:1888 |
Thread-count switches (explicitly named as forbidden in AGENTS.md)
GPTQMODEL_FLOATX_CPU_THREADS (quantization/dtype.py:166), GPTQMODEL_GGUF_CPP_THREADS (qlinear/gguf_cpp.py:390), GPTQMODEL_MAX_PACKERS (utils/model.py:1473), GPTQMODEL_CPU_WORKERS / GPTQMODEL_CUDA_WORKERS (__init__.py:394,411).
Probably fine (logging, build paths, cache dirs)
GPTQMODEL_LOG_*, GPTQMODEL_PRINT_MODULE_TREE, GPTQMODEL_EXT_VERBOSE/DEBUG, *_BUILD_ROOT, GPTQMODEL_CACHE_DIR, GPTQMODEL_TORCH_EXTENSIONS_DIR, GPTQMODEL_CUTLASS_DIR, GPTQMODEL_NVCC_COMPILE_LEVEL. These are listed for completeness; decide case by case.
Suggested fix
- Route each switch through
BaseQuantizeConfig/ load kwargs (or a kernel option object), and delete the env reads. - Replace the
monkeypatch.setenvtests with API-argument tests.
Found during an AI-assisted review (Claude Code) of 6c3421c; repros were run on RTX 4090/5090 (CUDA 13) and Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
Qubitium commentedon Nov 16, 2026
One more, in native code: Swordfish picks its kernel path from env vars,
APHRODITE_SWORDFISH_DENSE_MandAPHRODITE_SWORDFISH_DETERMINISTIC(gptqmodel_ext/swordfish/.../swordfish_mm.cu:83-107). These should also move to an explicit kernel option.refactor(kernel): select kernels, numerics and threads through Kernel…
Qubitium commentedon Nov 16, 2026
Round-12 follow-up at
def6e61: this issue is closed, butgrepstill finds 62GPTQMODEL_*environment reads.Specifically for GGUF, dcb5425 (#4316) added
GGUFCppKernel(exact_matmul=...), but nothing plumbs it through:GPTQModel.loadkwarg;grep exact_matmulmatches onlygguf_cpp.py.So
GPTQMODEL_GGUF_CPP_NATIVE_MATMULremains the only user-level switch, and the docstring (gguf_cpp.py:1117-1192) now explicitly documents it as the process-wide control. AGENTS.md says these switches should be deleted. Was the closure meant to cover only part of the list?