Repository navigation
Unify backend selection and tuning with typed BackendConfig - #4375
Conversation
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
Devin Review🟢 Devin Review found nothing to fix · View findings |
|
Latest CI: six checks pass. AWQ CPU (unit) terminates during native The previous completed AWQ unit run reported five test failures. All five reproduce on the unchanged base revision 9b11fb3b0, using a detached baseline checkout and the same local interpreter/dependencies as this branch: python -m pytest tests/test_awq_weight_mean.py tests/test_awq_scaling_groups.py \
-k 'weight_mean_matches_legacy_impl or nan_grid_keeps_unclipped_bound or nemotron_h' \
-q -o addopts='' -o log_cli=falseBoth revisions produce one stale Focused API/storage/dispatch/looper checks plus CPU block-float checks: 370 passed, 11 hardware/dependency skips; repository Ruff passed. Native GPU execution remains unqualified on this CPU-only environment. |
Summary
backend=now accepts either an existingBACKEND/string selector or an immutableBackendConfiginstance that selects and configures its own backend:BackendConfigis abstract; concrete configurations declare fixed identities and validate backend-specific fields. Quantized modules own execution-policy snapshots so later loads do not retune them.What Changed
quantize()and allow an explicit quantization-time override.RuntimeConfigfor shared worker, quantizer and host settings on loaders andQuantizeConfig.runtime.kernel=KernelConfig(...)/mappings, and the existing rootGGUFConfigquantization export. The backend-specific GGUF type isGGUFTorchConfig.docs/backend-selection.md, update the legacy field guide and link both from README.Tests
Python 3.14.6 free-threading build, Torch 2.15.0+cpu, Triton 3.9.0. Triton's native import enables the GIL; these results do not qualify GIL=0 accelerator concurrency.
Exact commands, run from
tests/:From the repository root:
Model Support / Module Plan
Existing failures outside the focused checks
The latest AWQ CPU (unit) job terminates during native
pcreimport withIllegal instruction(exit 132), before test collection completes. The other six checks pass. A retry throughgh run rerun --failedwas denied withResource not accessible by integration; a maintainer needs to rerun that check. This native-import failure is not reproduced locally and is not claimed as a verified baseline failure.The previous AWQ CPU (unit) CI run completed with five test failures. The identical five reproduce in a detached checkout of the unchanged base 9b11fb3b0: stale test doubles reject
sym(one case) andsyms(three cases); thenemotron_hscaling-group test measures output drift0.2822258174419403on both revisions. Those implementation/test files are unchanged. Reproduction on base: 5 failed, 1 passed, 4 skipped in 6.76s; on this branch: 5 failed, 1 passed, 4 skipped in 5.58s.An expanded run also reached an existing
test_weight_only_looper_quantizes_input_and_lm_head_embeddings_onlyassertion aboutoffload_to_disk; that same assertion fails on the unchanged base (1 failed in 2.93s). The new run-boundary regression in that file passes. These failures are documented rather than changing unrelated AWQ folding or offload behavior here.Applicability
Not applicable: no model definitions, module plans, fusion qualifications or new hardware support.
AWQ onboarding safety
Not applicable: no model onboarding or grouping/search/replay/folding changes.
Logic Flow Documentation
file:lineevidence.docs/backend-selection.mdcontains the same flow and is linked from README.flowchart TD A["GPTQModel.load / from_pretrained / from_quantized<br/>BaseQModel.quantize"] --> B["resolve_backend_config(backend, kernel, runtime)"] A -- "quantization config present" --> R["resolve_quantize_backend<br/>retain typed choice and generated policy"] R --> B B --> C{"BackendConfig instance?"} C -- yes --> D{"Legacy kernel supplied?"} D -- yes --> E["ValueError: ambiguous policy"] D -- no --> F["backend.backend + backend.kernel_options()<br/>merge RuntimeConfig.kernel_options()"] C -- no --> G["normalize_backend(enum or string)<br/>legacy kernel or RuntimeConfig adapter"] B -- "runtime + legacy kernel" --> E F --> H["BACKEND + validated KernelConfig"] G --> H H --> I["Existing backend compatibility / selection"] I -- "unsupported method / device / shape" --> J["Existing selection error"] I --> K["QuantizeConfig.kernel<br/>make_quant / quant_linear_init_kwargs"] K --> L["BaseQuantLinear.__init__<br/>snapshot_kernel_config"] L --> M["module.kernel<br/>constructor settings and native op arguments"] H --> N["configure_kernel<br/>shared quantizer / host fallback"] classDef failure fill:#ffe0e0,stroke:#b00,color:#600 class E,J failureBefore locations refer to the original
gptqmodel/tree:models/auto.py:872,1005,1129: enum/string normalizationresolve_backend_configextracts a typed config's fixed backend identitymodels/auto.py:839: separate mixedkernel=policybackend=for execution options;runtime=for shared controls; legacy adapter preservednn_modules/qlinear/__init__.py:288,utils/model.py:623: selector and qcfg kwargsBaseQuantLinearowns a snapshot, also forwarded bymake_quantutils/kernel.py:404-414: owner or process policyReview Requirements
Kernel Accuracy Requirements
llama-cpp-python; native CUDA unverifiedNotes
Legacy
kernel=remains supported with enum/string selectors. Combining it with a typed backend orruntime=raisesValueError, including a caller-supplied policy onQuantizeConfig.Calling
configure_kernelnow changes the fallback for future modules/shared utilities; constructed quantized modules retain their own execution settings. Shared quantization/host controls remain process-wide, so concurrent quantization runs with different shared settings are not isolated by this API. All policies are runtime-only and must be supplied again on reload.Link to Devin session: https://app.devin.ai/sessions/c7274b2371174a98b4f2ca4761abcbcd
Open in Devin Desktop: https://app.devin.ai/desktop/session/c7274b2371174a98b4f2ca4761abcbcd?variant=devin
Requested by: @Qubitium