Fix ReshardStore to accept the native RaidenId binding. - #883
Closed
majunze2001 wants to merge 1 commit into
Closed
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
majunze2001
force-pushed
the
jeff/fix-reshard-store-raiden-id
branch
from
September 8, 2026 18:18
ee2cf69 to
2f5d8d0
Compare
kv_cache_store.RaidenId has been the nanobind class itself (or the pure-Python dataclass fallback) since 7efa546; neither carries an `_impl` attribute, so ReshardStore.__init__'s `raiden_id._impl` raised AttributeError on every call. Unwrap with getattr(raiden_id, "_impl", raiden_id), matching the guard the other call sites in kv_cache_store.py already use, and add reshard_store_test.py (registered in BUILD and run_tests.sh). Claude-Session: https://claude.ai/code/session_012cbF1oLqDSJhgcQS3BBhiy Signed-off-by: Jeff Ma <jeffjma@umich.edu>
majunze2001
force-pushed
the
jeff/fix-reshard-store-raiden-id
branch
from
September 8, 2026 18:38
2f5d8d0 to
375094c
Compare
Author
|
closed since #889 is merged |
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.
Summary
tpu_sync.api.torch.reshard_store.ReshardStore.__init__could not be called atall: it unwrapped its
raiden_idargument withraiden_id._impl, butkv_cache_store.RaidenIdhas not had an_implattribute since Aug 27. Everyconstruction raised
AttributeError.This change unwraps with
getattr(raiden_id, "_impl", raiden_id), matching theguard the other call sites in
kv_cache_store.pyalready use, and adds thefirst test for the class.
Root cause
kv_cache_store.RaidenIdis resolved asi.e. the nanobind class exported by
_tpu_raiden_torchwhen present, else thepure-Python dataclass in
tpu_sync/api/common.py. Neither carries_impl.Timeline:
4b2b466(Aug 12) addedreshard_store.pywithraiden_id._impl. At thattime
kv_cache_store.RaidenIdwas a Python wrapper class holding the C++object in
_impl, so the line was correct.7efa546(Aug 27, "fix RaidenId binding") deleted that wrapper and setRaidenId = _impl.RaidenId. It updated the unwrap sites inkv_cache_store.pywithhasattr(x, "_impl")guards but did not touchreshard_store.py. From here on the constructor raises.a0f5ea1(Aug 30) changed the alias to the currentgetattr(...)form withthe dataclass fallback. Still no
_implon either branch.Nothing tested
ReshardStore, so the breakage went unnoticed.Fix
tpu_sync/api/torch/reshard_store.py: one-line change fromraiden_id._implto
getattr(raiden_id, "_impl", raiden_id). Native ids pass through; a Pythonwrapper that does carry
_implis still unwrapped.Tests
New
tpu_sync/api/torch/reshard_store_test.py(absltest, registered as apy_testintpu_sync/api/torch/BUILDand added torun_tests.sh):test_accepts_native_raiden_id: asserts the nativeRaidenIdhas no_impl(the premise), mocks
create_reshard_store, and checks the native id isforwarded verbatim. Fails on the old code with
AttributeError.test_unwraps_python_wrapper_with_impl: an object exposing_implisunwrapped before reaching the factory.
test_constructs_real_store_on_localhost: builds a real in-engine store on127.0.0.1and checks the controller address and reshard service port.Testing performed
Before the fix, the old expression on a native id:
After the fix:
Notes