Skip to content

chore(umbp): remove dead code, an orphaned test and duplicated helpers - #778

Merged
TianDi101 merged 1 commit into
mainfrom
chore/umbp-dead-code-cleanup
Oct 16, 2026
Merged

TianDi101 merged 1 commit into
mainfrom
chore/umbp-dead-code-cleanup

Conversation

@TianDi101

Copy link
Copy Markdown
Collaborator

Summary

Removes UMBP code that nothing calls, a test that has never been built, and five copies of the same helper. Most of it lost its last caller in the backend-agnostic refactor (#540). No behavior change. Net −1,370 lines across 45 files.

Each removal was checked three ways:

  • Grep: a comment-stripped token count across every tracked file (C++, pybind, Python, tests, CMake, CI).
  • Relocations: an objdump -r scan over every object file of a full UMBP build, to catch dead functions whose names are too common for grep.
  • Delegation: a scan for virtual methods whose only call site is a same-named delegating override (e.g. GetLocationId, SetColdRead).

Dead files

File Why it is dead
local/tiers/device_copy_run.h Run planner "shared only by DRAMTier and its unit test"; both were removed in #540
local/tiers/device_gather.h, local/tiers/host_registration.h "Backward-compatible" shims; nothing includes them (the real headers live in include/umbp/common/)
tests/cpp/umbp/local/test_spdk_proxy.cpp Not in any CMakeLists.txt, at any point in history, so it has never been compiled

Dead functions and state

  • PoolClient::ExecuteLocalGet (and GetAttemptOutcome) and PoolClient::CopyRangesToContiguous.
  • SpdkSsdTier::Batch{Write,Read}Dma{Direct,Streaming}, about 490 lines.
  • TierBackend::ReadPtr, BatchWriteRanges, GetLocationId, SetColdRead, plus their SSDTier, ShardedSsdTier and SpdkProxyTier overrides. Because nothing ever set it, SpdkProxyTier::cold_read_ was always false; the field and its branch are removed.
  • SSDTier::last_io_status_ (with LastIoStatus/RememberStatus): written at 13 sites but never read. The writes ran concurrently from const read paths, so this also removes a latent data race.
  • SPDK proxy and environment code:
    • SpdkEnv: the reactor accessors, PollIo, CleanupThreadLocalCtx, CleanupOnSpdkThread and bdev_.
    • ProxyShmRegion::ProbeExisting and its file-local HeartbeatStaleMs.
    • SpdkProxyTier::WaitForProxy and ProxyPollInterval. UMBP_SPDK_PROXY_POLL_INTERVAL_MS is dropped from runtime-env-vars.md because nothing reads it now.
    • TenantRegistry::FindTenant.
  • Unused accessors, constants and fields:
    • HostTierRegistration::Covers and RegisteredBytes.
    • MasterClient::SupportsLogicalTiers, MoriIoEngine::LocalEngineKey, UMBPConfig::ResolveRole, kAutoRankId, kLocFieldMarker, LocalLocation, SegmentIndex::ClearKnownSegments, ThreadDoesBackgroundCopies.
    • Two "legacy alias" SPDK proxy names.
    • Write-only PeerSsdManager eviction counters (eviction is counted by the decorator and the pool) and write-only io_uring ring-entry fields.
  • route_get_strategy.cpp: commented-out debug logging, plus SummarizeLocations, which only that logging used.

Duplicated code

  • Five identical TierType ↔ ::umbp::TierType switch converters (three standalone/*.cpp files, peer_service.cpp, batch_resolve_codec.h) are now one inline pair in umbp/distributed/tier_proto.h. The static_cast versions in master_client.cpp behave differently on unknown values, so they are left alone.
  • Three identical MatchedHashCount() bodies now call one shared CountDistinctHashes() in types.h. IUMBPClient::ExternalKvMatch and MasterClient::ExternalKvNodeMatch stay separate types because pybind registers them as two different Python classes.

Also

Kept on purpose

  • TierBackend::ReadBatchRangesIntoPtr and the ranged_read capability: only tests call them today, but they are the building block for the still-open D1 phase of design-ssd-ranged-io.md.
  • APIs used only by tests as inspection helpers (IMasterMetadataStore::LookupBlock, GetExternalKvCount, ...), the vendored SPDK offset_allocator, and the bench and run scripts (all referenced).
  • Near-duplicates that have drifted apart, such as bench_pool_client_batch_{get,put}.cpp, or whose env parsing differs slightly. Merging those would be a refactor, not a deletion.

Test plan

Before/after comparison on n06-21 (local/mori-dev:sglang-0.5.19-*, gfx950). Build flags: BUILD_UMBP=ON, USE_REDIS_BACKEND=ON, BUILD_TESTS=ON, pybind mori_umbp_pybinds.

  • Build: 290/290 targets for both main and this branch. Compiler warnings are identical (same 100).
  • C++ unit tests (tests/cpp/umbp, 57 ctests): per-test outcomes are identical between main and this branch, 46 pass. The other 11 are PoolClient/IO-engine tests that need a GPU; they fail identically on both with rsmi_num_monitor_devices reported 0 GPUs, because the container had no GPU while the node's GPUs were fully busy with another job. CI runs them with a GPU.
  • Python unit tests (pytest tests/python/umbp/): 105/105 on both, loading the freshly built libmori_umbp_pybinds.so (md5 verified). matched_hash_count() returns the same value on both match types.
  • clang-format 20.1.8 and the repo pre-commit hooks: clean.
  • SPDK-only files (spdk_env.cpp, spdk_ssd_tier.cpp, spdk_proxy_daemon.cpp): not compiled, because SPDK isn't available in the build image. Every edit there is a pure deletion of unreferenced code (braces balanced, no remaining references), but it still needs an SPDK build to confirm.
  • GDS (hipfile): not compiled, but untouched.

🤖 Generated with Claude Code

Everything removed here has no caller anywhere in the repo (C++, pybind,
Python, tests); most of it lost its last caller in the backend-agnostic
refactor (#540). No behavior change.

Dead files
- local/tiers/device_copy_run.h: run planner for the removed DRAMTier.
- local/tiers/{device_gather,host_registration}.h: "backward-compatible"
  shims that nothing includes.
- tests/cpp/umbp/local/test_spdk_proxy.cpp: never in any CMakeLists, so it
  has never been built.

Dead functions and state
- PoolClient::ExecuteLocalGet (+ GetAttemptOutcome), CopyRangesToContiguous.
- SpdkSsdTier::Batch{Write,Read}Dma{Direct,Streaming} (~490 lines).
- TierBackend::ReadPtr / BatchWriteRanges / GetLocationId / SetColdRead and
  their SSDTier / ShardedSsdTier / SpdkProxyTier overrides; SpdkProxyTier's
  cold_read_ was therefore always false.
- SSDTier::last_io_status_: written at 13 sites (racily, from const reads),
  never read.
- SpdkEnv reactor accessors, PollIo, CleanupThreadLocalCtx,
  CleanupOnSpdkThread, bdev_; ProxyShmRegion::ProbeExisting and its
  HeartbeatStaleMs; SpdkProxyTier::WaitForProxy and ProxyPollInterval;
  TenantRegistry::FindTenant.
- Unused accessors/constants: HostTierRegistration::Covers/RegisteredBytes,
  MasterClient::SupportsLogicalTiers, MoriIoEngine::LocalEngineKey,
  UMBPConfig::ResolveRole, kAutoRankId, kLocFieldMarker, LocalLocation,
  SegmentIndex::ClearKnownSegments, ThreadDoesBackgroundCopies, two legacy
  SPDK proxy aliases, write-only PeerSsdManager eviction counters and
  io_uring ring-entry fields.
- route_get_strategy.cpp: commented-out debug logging and the
  SummarizeLocations helper only it used.

Duplicated code
- Five identical TierType <-> proto switch converters (three standalone
  files, peer_service.cpp, batch_resolve_codec.h) are now one inline pair in
  umbp/distributed/tier_proto.h.
- Three identical MatchedHashCount bodies now share CountDistinctHashes().
  The two Python-visible match types stay distinct classes.

Also drops test_prefix_aware_eviction from the CI ctest regex: no such test
has existed since #540.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TianDi101
TianDi101 merged commit b3b290b into main Oct 16, 2026
15 checks passed
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