Repository navigation
test: realign stale CUDA suite expectations with current contracts (#4241) - #4298
Merged
Merged
Conversation
…4241) Each failing test was reproduced at HEAD and classified before editing. Test-side fixes cover the qzeros_format marker, checkpoint-snapshot state_dict semantics, kernel constraints, mock contracts, and stale or non-deterministic numeric references. One real library gap was found and fixed minimally: checkpoint-layout loads now materialize inference-tensor operands such as g_idx before an assign=False copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4241
What this does
Every test below was reproduced at HEAD on this box (2× RTX 4090, CUDA 13, torch 2.16 dev), then classified against the current library contract before editing. Numeric oracles are independent fp64/stable-torch references, never the code under test.
ruff check gptqmodel docs/eora tests setup.pypasses.The only library change is a 2-line behavioral fix plus a refactor in
nn_modules/qlinear/{__init__,_fused_train_state}.py: a checkpoint-layoutload_state_dict(assign=False)now materializes inference-tensor operands (notablyg_idx, which is not part of the snapshot) before the copy.test_runtime_load_materializes_inference_g_idxcaught a real gap; the test was right. Everything else is tests/fixtures.Verification
tests/...fixed set: 1013 passed (fixed1.log, 241.69s)tests/test_paroquant.py tests/test_vptq.py tests/test_weight_only.py: 602 passed, 9 skipped (extra1.log)tests/test_torch_weight_storage.py tests/test_qzeros_format_invariant.py tests/test_load_state_assertions.py tests/test_checkpoint_state_invariant.py: 234 passed, 3 skippedruff check gptqmodel docs/eora tests setup.py: All checks passedPer-test verdicts
T= test was wrong (test-side fix),L= library was wrong (minimal library fix). Parametrized counts are in parentheses.qzeros_format marker in state_dict/named_buffers (all
T)The library persists a 1-element int64
qzeros_formatmarker so a checkpoint round-trip keeps its zero layout (#4125/#4134) and intentionally omits it from HF exports (#4155).test_allspark_linear.py::test_linear_bias_does_not_expand_persistent_storage(2)...::test_module_export_keeps_checkpoint_layout(2)state_dict(), not inget_state_dict_for_save()...::test_runtime_state_dict_roundtrip_and_cache_invalidation(2)()test_allspark_awq_cuda.py::test_awq_module_pack_boundaries_and_dtype_moves(2)...::test_awq_module_export_keeps_checkpoint_layout(2)test_marlin_cpu_offload_post_init.py::test_marlin_cpu_offload_refreshes_packed_weights(4)kernels/test_gptq_torch_cpu_bias_epilogue.py::test_packed_gptq_cpu_bias_cancels_before_output_rounding(6)test_rco_formats.py::test_awq_cost_includes_partial_words_and_metadata(9)Checkpoint-snapshot state_dict semantics (#4166/#4167) (
T, except oneL)state_dict()now emits the checkpoint snapshot; a self round-trip is a checkpoint load that restores checkpoint shapes. A loaded/edited checkpoint exports its real values.test_kernel_audit_regressions.py::test_transformed_cpu_layer_round_trips_its_own_state_dict(12)qweightshape == snapshot (32,512), round-trip numerics bit-exact...::test_edited_checkpoint_scales_export_instead_of_stale_snapshot...::test_checkpoint_layout_gate_uses_discriminating_operands(6)state_dict()...::test_runtime_load_materializes_inference_g_idxg_idxraised; library now clones inference operands for checkpoint loads tootest_weight_only.py::test_baseqmodel_quantize_uses_weight_only_rtn_pipelineqzero_format()==2; numerics vs independent fp64 RTN passMocks missing current APIs (
T)test_stage_modules.py::test_run_layer_stage_*(6)DummyLooperlackedlayer_modules_for_prefix(contract from #1998); no-op None keeps global declarationtest_paroquant.pyprocessor tests (13)SimpleNamespaceqcfg lackedresolve_module_config; default resolved config uses qcfg defaultstest_writer_attention.py(2)_DummyModel.named_modules,_save_model_configs_without_weights(trust_remote_code=...)test_out_of_model_tensors.py(13)_DummyModel.named_modules/modules,_DummyQuantizeConfig.has_dynamic_exclusionstest_eora_merge.py::test_eora_covariance_weights_every_batch_uniformly_FakeModuleneeded realparameters()/buffers()test_gemma2_backend_guard.py(2)_FakeEngine.modulestest_kimi_k3_core_format.py::test_generic_wrapper_crops_padded_output_and_preserves_input_dtype(3)out_dtype=and a separate non-fp16 torch pathtest_specialized_eora_lifecycle.py::test_qqq_packs_uncorrected_weight_after_eora_quant_linear_kernel(dtype=...)test_xing4_0_support.py::test_xing4_0_lm_head_hook_reduces_hyperconnection_streamsactivation_modetest_qwen3_vl_dependency.py(3)nn.Module.__init__and usedSimpleNamespaceinstead of a hook-capable moduletest_fp8_nonfinite_source.py::...[smoother-*](3)qlinear.gguf; patch the definition sitetest_moe_expert_batching.py(9)restore_subset_capture_frontier=Nonethen.return_value=False; replay is now deferred to the layer stage (1 forward/chunk, not 2)test_cpp_nvcc_flags.py::test_is_nvcc_compatible_rejects_missing_nvccCUDA_HOME//usr/local/cuda; stub_nvcc_pathtest_lazy_kernel_registry_import.py::test_import_gptqmodel_skips_optional_backend_modules_numerics,_runtime_cache, ...) were counted as kernels; 10 public kernels <= 12Kernel constraints and config changes (
T)test_awq_gemv_fast_jit.py(6)SUPPORTS_IN_FEATURES_DIVISIBLE_BY=[64], out % 128, group_size 128; fixture used 32/8/32test_qqq_jit.py(3)kernels/test_awq_gemv_splitk.py::test_real_qwen25_awq_gemv_greedy_decode_stays_finiteQuantizeConfig(dtype=...)rejected (#4052); dtype belongs toGPTQModel.loadtest_hunyuan_v1_dense_support.py::test_hunyuan_v1_dense_module_tree_skips_qk_norms:in=xshared-input tags are part of the treetest_laguna_support.py::test_laguna_module_tree_expands_dense_attention_and_sparse_moe_pathsg_proj:!is intentional (#2983, kernel-incompatible width)test_awq_gptq_lifecycle.py::test_awq_capture_is_pre_forward_and_gptq_does_not_receive_the_hookpreserve_batch_keep_mask=True)test_awq_weight_mean.py::test_awq_search_best_scale_coalesces_cpu_activation_replayStale numeric fixtures (
T)test_quantized_embeddings.py(28)rand*0.02produced nonzero scales below fp16 min subnormal; clamped to 1e-3; library correctly rejects storage underflowtest_marlin_scratch_cuda.py::test_scratch_matches_independent_reference[...-awq-...-8-...](4)test_q4_exllama_v2.py::test_exllamav2randintstream; replaced with deterministic nibbles + independent fp64 dequant of the pre-shuffle checkpoint buffers (max err 0.0016)test_vptq.py::test_vptq_quantizer_matches_independent_oracle[group_size_remainder]test_paroquant.py::test_paroquant_rotation_backward_folds_frozen_theta_sweep_into_one_reverse_launchtest_paroquant.py::test_paroquant_rotation_fused_bf16_uses_fp16_workspace_contracttest_paroquant.pyautotune tests (3)GPTQMODEL_CACHE_DIRResidual risk
test_kernel_audit_regressions,test_torch_weight_storage,test_qzeros_format_invariant,test_load_state_assertions, andtest_checkpoint_state_invariantsuites pass.test_q4_exllama_v2now checks the checkpoint layout against an independent fp64 dequant before ExLlamaV2's in-place shuffle; it no longer pins a historical baked output.quantization/*,nn_modules/qlinear/*) are limited to the 2-line load materialization above.