Repository navigation
refactor(worker): remove dead methods, shims, and legacy decode modes - #899
Merged
Merged
Conversation
Remove 36 dead methods, zero-prod-caller forwarding shims, and retired non-executable legacy decode mode 0/1/2 paths from batchgen_worker.py (-502 LOC) and batchgen/worker/decode_engine.py (-230 LOC). Update decoding_continuous to fail fast with NotImplementedError for retired modes and allow worker_method_source.py to synthesize signatures without requiring dead same-name delegators on BatchGenWorker.
Drop the 9 worker imports and 2 decode_engine imports that became unused when dead methods, zero-caller shims, and legacy decode paths were deleted.
test_trajectory_book_migration_reservations.py listed the removed _get_node_for_rank delegator in WORKER_METHODS even though migration helpers call node_of_rank directly.
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.
Description
Remove dead helper methods, zero-production-caller forwarding shims, and retired legacy decode mode 0/1/2 code paths from
batchgen/batchgen_worker.pyandbatchgen/worker/decode_engine.py.Key changes:
BatchGenWorkerand drop the 9 worker imports that became unused.DECOUPLED_GPUdecode strategy methods (LegacyDecodeBoundaryOutcome,run_legacy_decode_page_boundary,run_legacy_cpu_attn_decode_step,run_legacy_microbatch_gpu_decode_step) frombatchgen/worker/decode_engine.py, fail fast withNotImplementedErrorindecoding_continuousif an unsupported decode strategy is requested, and remove their 3 staleMODULE_CONTRACTentries and 2 unused imports.tests/worker_method_source.py(context_function_as_worker_method) to synthesize a(self, ...)signature directly from the extracted engine function without requiring a dead same-name delegator stub onBatchGenWorker.Motivation
After completing the worker module decomposition,
BatchGenWorkerstill retained dead legacy decode branches (modes 0/1/2) and forwarding shims kept alive solely by test-helper signature copying. Deleting them eliminates dead code paths, keepsMODULE_CONTRACTaccurate, and prevents stale shims from masking the real engine boundaries.Type of Change
model— add/extend model support (models/**+ registration seam + model kernels only)kernel— add/optimize a compute kernel (batchgen_kernels/**+ in-tree kernel dirs)core— change scheduling/serving/runtime scaffolding (the only type that may)fix— narrow bug fix (+ a regression test)infra— build / CI / packaging / scripts / Dockerdocs— documentation onlyFile changes
batchgen/batchgen_worker.pybatchgen/worker/decode_engine.pyMODULE_CONTRACTentries, and 2 newly unused importstests/test_worker_weight_passes.pytests/unit/test_legacy_decode_step_bound.pytests/unit/test_legacy_kv_accounting.pytests/unit/test_prefill_admission_reclaim.pytests/unit/test_prefix_drain_metric.pytests/unit/test_trajectory_book_migration_reservations.py_get_node_for_rankdelegator fromWORKER_METHODStests/worker/test_decode_legacy_helpers_direct_params.pytests/worker/test_decode_strategy.pyNotImplementedErrortests/worker/test_kv_capacity_context.pyKVCapacityEnginemethodstests/worker/test_sequence_table.pytests/worker/test_worker_lifecycle_engine.pytests/worker_method_source.py(self, ...)directly incontext_function_as_worker_methodwithout requiring dead worker delegatorsChecklist
README.mdchanged, I ranpython3 scripts/check_readme_update.py --base-ref origin/mainand preserved all News history.