Skip to content

refactor(exl3): drop the unwired completed-checkpoint-tree restore API - #6399

Merged
Qubitium merged 1 commit into
mainfrom
refactor/exl3-drop-checkpoint-tree-restore
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
refactor/exl3-drop-checkpoint-tree-restore

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

This removes the EXL3 completed-checkpoint-tree restore API from EXL3Processor. Nothing in the tree calls it. It was carried in from the ds4rt working fork in f293733 (#3601), and the looper and model layers that were meant to call it never landed (docs/exl3-durable-execution.md: "Standalone store/policy APIs are connected by the later processor, looper and model layers"). The only callers were tests in tests/test_exl3_projection_resume.py. The maintainer approved removing it instead of wiring it through LoopExtensions.

Net diff: 3 files changed, 4 insertions(+), 1309 deletions(-). In-tree runtime behaviour, numerics, checkpoint format and every live EXL3 path are unchanged.

What Changed

  • gptqmodel/looper/exllamav3_processor.py (-746): these EXL3Processor methods are removed:

    • completed_layer_checkpoint_entries, _completed_checkpoint_tree_entries
    • restore_completed_checkpoint_tree_if_complete, a classmethod that built a processor with cls.__new__ and skipped __init__
    • restore_completed_layer_checkpoints, defer_completed_layer_checkpoints, offload_restored_layer_checkpoints
    • release_host_memory and _malloc_trim, which only it used, plus discard_capture_frontiers_through
    • seven imports that only these methods used: gc, PROJECTION_ORDER, projection_score, malloc_trim, recurse_setattr, offload_to_disk, offload_to_safetensors_reference
  • tests/test_exl3_projection_resume.py (-562 net): the seven tests that called the removed methods are deleted:

    • test_completed_layer_deferral_replaces_packed_storage_with_meta_shell
    • test_completed_layer_deferral_normalizes_disk_offloaded_meta_shell
    • test_restore_completed_layer_installs_packed_modules_without_hessian
    • test_restore_completed_layer_rejects_duplicate_existing_history
    • test_complete_inline_mixed_mtp_tree_restores_without_replay
    • test_partial_inline_mixed_mtp_tree_does_not_mutate_model
    • test_corrupt_inline_mixed_tier_plan_is_not_replayed

    The _inline_mtp_restore_fixture helper goes with them. test_capture_memory_summary_attributes_cache_model_and_heap_release loses only its release_host_memory tail and is renamed test_capture_memory_summary_attributes_cache_and_model. Its capture_memory_summary assertions are unchanged. The tier-plan validation that test_corrupt_inline_mixed_tier_plan_is_not_replayed reached is still covered directly by tests/test_exl3_inline_mixed.py::test_tier_plan_store_load_authenticates_complete_contract.

  • docs/exl3-durable-execution.md: the "completed checkpoint-tree publication" phrase is removed.

  • No public API change for in-tree callers. Out-of-tree ds4rt drivers that called these public methods would stop working; the maintainer approved this.

Zero-caller check. On origin/main, each removed name was grepped across gptqmodel/ scripts/ docs/ tools/ tests/ and the root *.md files. There is no examples/ directory. There are no hits outside exllamav3_processor.py itself and tests/test_exl3_projection_resume.py. That includes getattr string probes in stage_layer.py, stage_subset.py, module_looper.py and forward_executor.py. DeepseekV4 calls EXL3CaptureFrontierStore.discard_through directly, not discard_capture_frontiers_through.

Out of scope, intentionally:

  • The quantization_layer_boundary_checkpoint protocol in stage_layer.py and module_looper.py is not touched. A follow-up PR folds it into LoopExtensions.

  • The utils-layer APIs these methods used stay. Each has its own tests and docs page, and after this PR none has a production caller:

    • gptqmodel/utils/offload.py::offload_to_safetensors_reference, with docs/safetensors-reference-offload.md, and the EXL3 notes in docs/in-session-model-after-offload.md and docs/offload-run-directories.md
    • EXL3ProjectionCheckpointStore.committed_tensor_path
    • InlineMixedTierPlanStore.load

    These are candidates for a separate cleanup.

  • The debloat map also suggests folding the three build_projection_record(...) calls in _process_on_slot into one closure. That touches a live path, so it is left for a separate change to keep this PR a pure removal.

Tests

  • Unit tests have been executed and passed.
  • No new unit test: this PR only deletes code that has no caller and adds or replaces no mechanism. The structural A/B below shows that every remaining member is unchanged.

The same command was run on origin/main (1615acc) and on this branch, on one NVIDIA GPU. gptqmodel.__file__ was printed to prove which tree was imported:

export PYTHONPATH=<tree> HF_HOME=/root/.cache/huggingface CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=<gpu>
python -P -m pytest -q -p no:cacheprovider -rs \
  tests/test_exl3_*.py tests/test_exllamav3*.py tests/test_qwen4_exp_exl3_contracts.py \
  tests/test_qqq_exl3_oom_fallback_4400.py tests/test_rocm_exl3_auto.py \
  tests/test_calibration_attention_sinks.py tests/test_deepseek_v4_support.py \
  tests/test_gptq_shared_hessian.py tests/test_quantize_config_offload_tempdir.py \
  tests/test_rco_formats.py tests/test_shared_input_hessian_dedup_methods.py \
  tests/test_host_memory_trim_4990.py tests/test_offload_files.py
# origin/main: 1505 passed, 13 skipped in 373.64s
# branch:      1498 passed, 13 skipped in 334.26s   (-7 = the deleted tests)

The selection is every tests/test_exl3_* and tests/test_exllamav3* file, every test that imports EXL3Processor or exllamav3_processor, and the host-memory and offload suites behind the removed imports. These are the CUDA and CPU EXL3 tests.

The 13 skips are identical on both trees. Here is what each leaves unverified:

  • test_exl3_dispatch_concurrency.py:151 (x2), :364, test_exl3_workspace.py:342: these need a free-threaded PYTHON_GIL=0 build, so concurrent native dispatch under GIL=0 is not exercised here.
  • test_exl3_moe_dp_hessian_owner_5093.py:335,373, test_exl3_workspace.py:138: these need two CUDA devices, so the multi-GPU data-parallel Hessian owner and the cuda:1 workspace are unverified.
  • test_exl3_moe_owner_hessian_order_5518.py:130: the owner=False reduction runs on the capture-source CUDA devices and is skipped in this layout.
  • test_exl3_rng_isolation.py:13: reports "CUDA device unavailable" under this device mask.
  • test_exllamav3.py:366 (x2): ROCm only.
  • test_exllamav3_cpu.py:260 (x2): BF16 takes the native EXL3 path when CUDA is present, so the CPU BF16 path is not exercised here.

None of the skipped tests touch the removed code. After the rebase onto 382721e (no touched file changed), tests/test_exl3_projection_resume.py tests/test_exl3_route_evidence.py tests/test_exl3_capture_frontier.py tests/test_qwen4_exp_exl3_contracts.py tests/test_exl3_inline_mixed.py gave 37 passed.

Lint: ruff check gptqmodel gptqmodel/models/ports/native/auto/__init__.py gptqmodel/models/ports/native/auto/_registry.py docs/eora tests setup.py reports All checks passed! with ruff 0.14.2. This is the same command format/check.sh runs. On this host the script's own pip install ruff==0.14.2 step stops on PEP 668, so the lint step was run directly.

Structural A/B

The script hashes inspect.getsource of every EXL3Processor member and every module-level object of gptqmodel.looper.exllamav3_processor, on origin/main and on the branch:

[members] removed: ['_completed_checkpoint_tree_entries', '_malloc_trim', 'completed_layer_checkpoint_entries', 'defer_completed_layer_checkpoints', 'discard_capture_frontiers_through', 'offload_restored_layer_checkpoints', 'release_host_memory', 'restore_completed_checkpoint_tree_if_complete', 'restore_completed_layer_checkpoints']
[members] added: []
[members] common: 70, source changed: ['__firstlineno__']
[module] removed: ['PROJECTION_ORDER', 'gc', 'malloc_trim', 'offload_to_disk', 'offload_to_safetensors_reference', 'projection_score', 'recurse_setattr']
[module] added: []
[module] common: 128, source changed: []

Only the intended names are gone. All 70 remaining members and 128 module objects have byte-identical source. __firstlineno__ moves because lines were removed above the class body.

GPU A/B (EXL3 quantize, save, compare)

Qwen/Qwen2.5-0.5B-Instruct was quantized with EXL3Config(bits=4, offload_to_disk=X) for both X=True (the default) and X=False. Both trees used bf16, seed 0, the first 64 wikitext-2 train rows longer than 200 characters as calibration, and batch_size=4. Peak CUDA allocation was 891 MiB. Every saved tensor was then compared bit-for-bit.

Artifact offload_to_disk=True offload_to_disk=False
model.safetensors, all 794 tensors (168 trellis) bit-identical, file byte-identical bit-identical, file byte-identical
config.json, quantize_config.json, generation_config.json, tokenizer files byte-identical byte-identical
quant_log.csv (layer, module, loss, loss_kind, samples, damp) identical; rows differ only in thread completion order and the wall-clock time column identical
ds4rt-exl3-error-ledger.jsonl (168 records) identical except wall-clock duration_seconds, and the record_sha256 and manifest ledger_sha256 derived from it same

Measured Impact

Not applicable: dead code is removed and nothing in-tree runs differently. The GPU A/B above shows identical output.

Model Support / Module Plan

Not applicable: no model definitions, aliases or module plans change.

AWQ onboarding safety

Not applicable: AWQ is not touched.

Logic Flow Documentation

  • This change does not alter a major logic flow.

Diagram summary: not applicable. The removed methods were not reachable from any in-tree entry point, so no live control flow, selection order or tensor lifecycle changes. The structural A/B shows that every remaining member is source-identical.

Review Requirements

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions.
  • Avoided unnecessary monkeypatching and used the project's normal extension points where possible.
  • Minimized and compacted the impacted code surface.
  • Considered and eliminated potential regressions.

Kernel Accuracy Requirements

Not applicable: no kernel, dispatch or fusion code changes. Saved EXL3 tensors are bit-identical, as shown above.

Notes

  • Out-of-tree risk: an external ds4rt driver that called EXL3Processor.restore_completed_checkpoint_tree_if_complete, restore_completed_layer_checkpoints, defer_completed_layer_checkpoints, offload_restored_layer_checkpoints, release_host_memory or discard_capture_frontiers_through would break. The maintainer approved removing them.
  • This lands before the debloat item that turns the EXL3 getattr hooks into base methods, so that change does not need defaults for these methods.

🤖 Generated with Claude Code

f293733 (#3601) carried a completed-checkpoint-tree restore layer from
the ds4rt working fork into EXL3Processor. The later looper and model
layers that were meant to call it never landed. Nothing in gptqmodel/,
scripts/, docs/ or tools/ calls it; only tests/test_exl3_projection_resume.py
did.

Removed from gptqmodel/looper/exllamav3_processor.py:
- completed_layer_checkpoint_entries, _completed_checkpoint_tree_entries
- restore_completed_checkpoint_tree_if_complete (built a processor with
  cls.__new__ and skipped __init__)
- restore_completed_layer_checkpoints, defer_completed_layer_checkpoints,
  offload_restored_layer_checkpoints
- release_host_memory and its only helper _malloc_trim, and
  discard_capture_frontiers_through
- the seven imports that only these methods used

Also removed: the seven tests that called these methods, the
release_host_memory tail of the capture-memory-summary test (the summary
assertions stay), and the "completed checkpoint-tree publication" phrase
in docs/exl3-durable-execution.md.

This does not touch the live EXL3 paths: projection-checkpoint hits in
_process_on_slot, capture frontiers, batch spool, inline mixed tiers,
zero-route recovery, remote slots and deferred runtime weights. The
quantization_layer_boundary_checkpoint protocol is also left alone; it
moves into LoopExtensions in a separate PR. In-tree runtime behaviour
does not change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 14:23
@Qubitium
Qubitium merged commit 437decd into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the refactor/exl3-drop-checkpoint-tree-restore branch November 29, 2026 14:24
Qubitium pushed a commit that referenced this pull request Nov 29, 2026
Picks up main's commits since the previous merge base (6b25d2c):
#6395, #6399, #6407, #6408, #6409, #6410. Auto-merged cleanly; the
stable-ABI guards report no new offenders.
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