You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AUTO_NF12 embedding cast aborts when the native row-major extension is unavailable #3860
The cast raises gptqmodel_nf12._jit._MissingBuildTools: nf12: JIT compilation requires CUDA toolkit 13.0+ (nvcc) .... The same setup can cast an aligned nn.Linear(64, 16) successfully. tests/test_auto_dtype_cast.py::test_cuda_embedding_uses_only_row_major_packed_storage also fails at this call on such a machine.
Cause
AutoNF12Embedding.__init__ treats a supported CUDA device as proof that the row-major native extension is loadable. _rowmajor_ops returns a pack callable based only on compute capability, then rowmajor_pack attempts a JIT build. The generic packed embedding/decode branch only runs when _rowmajor_ops returns None, which does not happen on supported NVIDIA CUDA devices. AUTO_NF12 is the default policy, so an eligible embedding reaching this path can abort quantization.
Expected
If the native row-major extension is unavailable, preserve the dense source or use a working generic NF12 fallback. Native extension availability should be checked before choosing the row-major path; the failure should not abort an otherwise supported quantization run.
The HIP branch has the same availability-selection pattern in source: _rowmajor_ops checks only that nf12_hip.rowmajor_pack exists as a Python attribute. That function loads the optional extension on call. A supported RDNA4 device without a working extension can therefore hit the same constructor failure; the CUDA reproduction above is the executed case.
changed the title [-]AUTO_NF12 embedding cast aborts without native NF12 build tools on supported CUDA GPUs[/-][+]AUTO_NF12 embedding cast aborts when the native row-major extension is unavailable[/+]on Nov 14, 2026
Reopening after checking main at 8ecc295: #3891 gates the NVIDIA row-major path with nf12.available(), but #3910 makes _library.load() reuse a partial preloaded legacy namespace. _loaded then makes available() true even when rowmajor_pack/rowmajor_embedding are absent. On an SM121 CUDA host without nvcc, this minimal case prints True False and cast_source_module raises AttributeError: ... has no attribute 'rowmajor_pack' instead of choosing canonical packed embedding:
The original issue's HIP path also remains: _rowmajor_ops checks only hasattr(nf12_hip, 'rowmajor_pack'), while that wrapper attempts an optional extension load when called. A supported HIP device with an unavailable/broken extension can still fail during construction. These are the same row-major availability/fallback defect; checking the specific row-major operators and handling a failed pack would cover both. The HIP case is source-backed; the CUDA partial-namespace case was executed.
Activity
[-]AUTO_NF12 embedding cast aborts without native NF12 build tools on supported CUDA GPUs[/-][+]AUTO_NF12 embedding cast aborts when the native row-major extension is unavailable[/+]Qubitium commentedon Nov 14, 2026
Reopening after checking
mainat8ecc295: #3891 gates the NVIDIA row-major path withnf12.available(), but #3910 makes_library.load()reuse a partial preloaded legacy namespace._loadedthen makesavailable()true even whenrowmajor_pack/rowmajor_embeddingare absent. On an SM121 CUDA host withoutnvcc, this minimal case printsTrue Falseandcast_source_moduleraisesAttributeError: ... has no attribute 'rowmajor_pack'instead of choosing canonical packed embedding:The original issue's HIP path also remains:
_rowmajor_opschecks onlyhasattr(nf12_hip, 'rowmajor_pack'), while that wrapper attempts an optional extension load when called. A supported HIP device with an unavailable/broken extension can still fail during construction. These are the same row-major availability/fallback defect; checking the specific row-major operators and handling a failed pack would cover both. The HIP case is source-backed; the CUDA partial-namespace case was executed.fix(nf12): probe the row-major operators and survive a failed pack
fix(nf12): fall back when native row-major kernels are unavailable (M…
fix(nf12): probe the row-major operators and survive a failed pack (M…