raw_transfer: compile across the XLA PjRtRawBufferInterface->CommonPjRtRawBuffer rename - #732
Open
lokic233 wants to merge 1 commit into
Open
raw_transfer: compile across the XLA PjRtRawBufferInterface->CommonPjRtRawBuffer rename#732lokic233 wants to merge 1 commit into
lokic233 wants to merge 1 commit into
Conversation
…RtRawBuffer rename raw_transfer_core.h names xla::PjRtRawBufferInterface directly. XLA renamed that class to xla::CommonPjRtRawBuffer (xla/pjrt/raw_buffer.h), so this header fails to compile against XLA revisions on the other side of the rename. Derive the type from the stable xla::PjRtRawBufferRef (tsl::RCReference<...>) alias via decltype so the header builds against both pre- and post-rename XLA. Co-authored-by: Navi <navi@navibot.dev>
|
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. |
Collaborator
|
Thanks, @lokic233. |
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.
Problem
tpu_sync/core/raw_transfer_core.hnamesxla::PjRtRawBufferInterfacedirectly (thecommon_raw_bufferfield, thetsl::FormRef<...>inAcquire, and theAcquireFromRawparameter). XLA has since renamed that class toxla::CommonPjRtRawBuffer(seexla/pjrt/raw_buffer.h, whereclass CommonPjRtRawBuffer : public PjRtRawBufferandusing PjRtRawBufferRef = tsl::RCReference<CommonPjRtRawBuffer>).Because the concrete class name is hard-coded, this header fails to compile against XLA revisions on the post-rename side:
(The
common_raw_buffer/memory_spacecascade errors are all downstream of the single type-name failure.)This is not hypothetical: when a prebuilt
_raw_transfer.so(built against a pre-rename XLA) is loaded against a runtime whose XLA is on the other side of the rename, the mismatch surfaces at runtime asRuntimeError: Not a PjRt compatible arrayfromjax_utils.h(CastToPjRtCompatibleArrayreturns null across the ABI), and every transfer silently moves 0 bytes because the exception is swallowed inside producer threads. Building the.soversion-matched to the target runtime is the real fix — but the source only compiles against one side of the rename at a time.Fix (version-agnostic, no preprocessor gate)
The
xla::PjRtRawBufferRefalias (tsl::RCReference<...>) is stable across the rename — only the pointee class name changed. Derive the concrete type from it viadecltypeand use that everywhere:RaidenRawBufferresolves toPjRtRawBufferInterfaceon pre-rename XLA andCommonPjRtRawBufferon post-rename XLA, soraw_transfer_core.hbuilds against both without a version macro. The 4 usages are switched toRaidenRawBuffer;<type_traits>is added forstd::remove_reference_t(<utility>forstd::declvalis already included).Verified: the
decltypeidiom compiles under-std=c++17and astatic_assertconfirms the alias resolves to the correct concrete type on each side of the rename.1 file changed, +17/-4.
— via Navi on behalf of Loki Chen