Repository navigation
[Store] Skip hot-cache writeback for device-resident read destinations - #4764
Conversation
| // Identify TE transfer slices (non-local) and submit async put tasks | ||
| for (size_t i = 0; i < slices.size(); ++i) { | ||
| if (runtime_accelerator.FindDeviceForPointer(slices[i].ptr) != | ||
| nullptr) { |
There was a problem hiding this comment.
Nit: maybe a logging here to show how many slice we skipped.
There was a problem hiding this comment.
Counted and logged per batch now (device_dest_slices -> one INFO line with key and skip count). 40/40 in the Linux container.
|
CI note: the one CTest failure is |
c46d268 to
c0c5ccb
Compare
|
Done — skipped slices are now counted and logged once per batch ( |
Fixes kvcache-ai#4761. With the local hot cache enabled, batch_get_into into CUDA memory crashed the reader with SIGSEGV: ProcessSlicesAsync handed every destination slice to LocalHotCacheHandler::SubmitPutTask, which copies into the cache block with a host std::memcpy. For a device pointer that dereference faults. Probe each slice with the accelerator registry (the same FindDeviceForPointer discriminator the checksum and DFS staging paths already use) and skip the writeback for device-resident destinations. The read path is unaffected; the local-memcpy worker pool is already device-aware, so cache hits into device memory keep working when the entry was cached by a host read. Add a regression test that registers a fake accelerator claiming a static buffer as device memory and drives a real two-client TCP batch read: the device-destined key stays out of the hot cache while the host-destined control key in the same batch is written back.
c0c5ccb to
a3b0562
Compare
…20261021 * upstream/main: (507 commits) [Reshard] Plan Store KV reuse across TP, PP and host layouts (kvcache-ai#4762) [Store] Walk tenants through shard-backed cursors and build the removes on them (kvcache-ai#4796) [Store-RS][Bugfix] Match TENT Request Layout to the C ABI (kvcache-ai#4732) [TransferEngine] Recover auto GID after data-path retry exhaustion (kvcache-ai#4290) [Store] Add the namespace layer over the object route (kvcache-ai#4721) [Store] Fix silent loss of offload keys deferred to the ungrouped pool (kvcache-ai#3006) (kvcache-ai#3009) [Store] Remove redundant alignment headroom from DFS shard allocation (kvcache-ai#4753) [CI/Build] Gate ROCm hardware tests and bound nightly Docker builds (kvcache-ai#4750) [Bugfix][Store] Fix double-counting of segment OpLog metrics in OpLogApplier (kvcache-ai#4771) [Store] Skip hot-cache writeback for device-resident read destinations (kvcache-ai#4764) [Reshard] Add bounded in-flight execution for weight transfers (kvcache-ai#4628) [Store] Avoid racing with detached hot-cache fills during key scans (kvcache-ai#4334) [Store] HA: drain the master on SIGTERM/SIGINT before exit (part 1 of kvcache-ai#4710) (kvcache-ai#4745) TENT: report a notification the receiver could not take (kvcache-ai#4754) [Store] Reach object metadata through a per-key accessor contract (kvcache-ai#4717) [Store][Bugfix] Fix DFS sync client test retry failure (kvcache-ai#4781) [Wheel] Keep integer dtype for typed_ragged rows when a row is an empty list (kvcache-ai#4611) [Doc] Sync README news onto the docs homepage (kvcache-ai#4767) [CI] remove stale Torch version binding after PG JIT (kvcache-ai#4760) [TransferEngine] Add buffer-protocol and page-gathered batch transfer APIs (kvcache-ai#4763) ...
…-ranges-20261021 * upstream/main: (394 commits) [Reshard] Plan Store KV reuse across TP, PP and host layouts (kvcache-ai#4762) [Store] Walk tenants through shard-backed cursors and build the removes on them (kvcache-ai#4796) [Store-RS][Bugfix] Match TENT Request Layout to the C ABI (kvcache-ai#4732) [TransferEngine] Recover auto GID after data-path retry exhaustion (kvcache-ai#4290) [Store] Add the namespace layer over the object route (kvcache-ai#4721) [Store] Fix silent loss of offload keys deferred to the ungrouped pool (kvcache-ai#3006) (kvcache-ai#3009) [Store] Remove redundant alignment headroom from DFS shard allocation (kvcache-ai#4753) [CI/Build] Gate ROCm hardware tests and bound nightly Docker builds (kvcache-ai#4750) [Bugfix][Store] Fix double-counting of segment OpLog metrics in OpLogApplier (kvcache-ai#4771) [Store] Skip hot-cache writeback for device-resident read destinations (kvcache-ai#4764) [Reshard] Add bounded in-flight execution for weight transfers (kvcache-ai#4628) [Store] Avoid racing with detached hot-cache fills during key scans (kvcache-ai#4334) [Store] HA: drain the master on SIGTERM/SIGINT before exit (part 1 of kvcache-ai#4710) (kvcache-ai#4745) TENT: report a notification the receiver could not take (kvcache-ai#4754) [Store] Reach object metadata through a per-key accessor contract (kvcache-ai#4717) [Store][Bugfix] Fix DFS sync client test retry failure (kvcache-ai#4781) [Wheel] Keep integer dtype for typed_ragged rows when a row is an empty list (kvcache-ai#4611) [Doc] Sync README news onto the docs homepage (kvcache-ai#4767) [CI] remove stale Torch version binding after PG JIT (kvcache-ai#4760) [TransferEngine] Add buffer-protocol and page-gathered batch transfer APIs (kvcache-ai#4763) ...
What
Fix the SIGSEGV reported in #4761: with the local hot cache enabled
(
MC_STORE_LOCAL_HOT_CACHE_SIZE),batch_get_into/batch_get_into_multi_bufferscrash the reading process when the destinationbuffer is CUDA memory.
Root cause
After a successful remote read,
Client::ProcessSlicesAsyncsubmits everydestination slice to
LocalHotCacheHandler::SubmitPutTask, which copies thedata into the cache block with a host
std::memcpy(block->addr, slice.ptr, slice.size)(local_hot_cache.cpp). When the destination is a device pointer,that host memcpy dereferences a device address and the process dies
(
__memcpy_avx512_unalignedin the reporter's stack).Single
get_intointo CUDA and batch reads with the hot cache disabled neverreach this path, which matches the reporter's matrix of what works and what
crashes.
Fix
In
ProcessSlicesAsync, skip the writeback for slices whose destination isdevice memory, using the existing accelerator registry probe
(
RuntimeAccelerators().FindDeviceForPointer) — the same discriminator thechecksum path (
ComputeObjectChecksumForSlices) and the DFS staging pathsalready use. Device-resident read results are simply not promoted into the
host hot cache; the read itself is unaffected. On builds without any
accelerator backend the registry is empty and behavior is unchanged.
Caching device-destined reads by staging D2H into the cache block is a
possible follow-up, but silently dropping the writeback is the safe fix: it
restores the pre-hot-cache behavior for exactly the configurations that crash
today.
Test
New regression test
LocalHotCacheTest.BatchGetSkipsHotCacheWritebackForDeviceDestination:AcceleratorDevice(same pattern asruntime_accelerator_test.cpp) that classifies one static buffer as device
memory, so the guard is exercised on CPU-only runners;
none) so the writeback path in
ProcessSlicesAsyncactually executes;host-destined control key from the same batch is (waits for the async
publish, so the skip cannot pass vacuously).
Verified on Linux (ubuntu:22.04 container, aarch64): the new test fails with
the guard removed (the fake-device key gets cached) and passes with it.
Fixes #4761