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
Consolidate ring buffer implementation and clean dead code paths #34
Ring transport was added on top of the existing native backend. Over time, ring-related branches were added into HookedRootModule methods that ring never actually calls in production.
Dead code in hook_points.py
Ring's actual call chain (both HF and vLLM paths) only touches:
HookPoint.forward() → torch.ops.ring.producer()
HookPoint.name setter (converts hook name → ring type/id)
HookPoint.enabled flag
It never enters these HookedRootModule methods:
prepare_monitoring() — ring enters and immediately returns
run_with_cache() — ring branches at lines 717-728 and 780-782 are unreachable; HF ring path uses generate_with_monitoring, vLLM uses DMXGPUWorker.execute_model
get_caching_hooks() — ring skip logic at lines 1004-1006 is unreachable for the same reason
All _using_ring_transport / _using_native_backend if/else branches in these methods are dead code for ring mode.
Hook type constants triplicated
HOOK_TYPE_RESID_PRE = 0, HOOK_TYPE_LN1 = 1, etc. are defined in three places:
Python: ring_transport.py (lines 51-71)
C++ enum: csrc/ring/tensor_meta.h (lines 28-50)
C++ display names: csrc/ring/tensor_meta.h (lines 56-67)
Plus a legacy name mapping dict in ring_transport.py (lines 221-242). Adding a new hook type requires synchronized edits to all four locations. Should define once and share.
No-op forward hooks
_make_ring_hook() in ring_transport.py creates empty hooks that do nothing. install_ring_hooks() registers them but the actual work is in HookPoint.forward(). Dead code.
Tasks
Remove dead ring branches from HookedRootModule (run_with_cache, prepare_monitoring, get_caching_hooks)
Activity