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
Commit 0ef8a03
Browse filesBrowse the repository at this point in the historyBrowse files
PR #45595: [XLA:GPU] Support VA remapping of parameter buffer allocations
Imported from GitHub PR openxla/xla#45595
## 📝 Summary of Changes
This PR extends command-buffer virtual-address remapping to entry-computation parameter allocations. Parameter buffers remain caller-owned, so each execution aliases their physical memory into stable VA-reservation addresses instead of transferring ownership to the VMM allocator.
- Adds `ExecutionScope::ResolveParameterBuffer`; the base implementation returns the caller buffer, while the VA-remapping implementation installs and returns the stable reservation alias.
- Renames the `PrepareReservation` hook to `Prepare` and makes `ExecuteWithBufferAllocations` accept mutable `BufferAllocations`, allowing addresses to be restored after execution.
- Tracks per-execution parameter aliases with `RecordStepAlias`.
- Releases those aliases after every execution and rewrites remapped entries back to their caller-owned addresses before teardown and result handling. The execution-scope destructor provides cleanup for error paths.
- Adds `AddVaRemappedAllocationForTesting` and a host-only fake VMM allocator to exercise the parameter-remapping path without requiring a GPU.
This PR is stacked on #45567, **[XLA:GPU] Split command buffer VA remapping into its own allocator class**. It is part 1 of 3 splitting the former #45568 implementation into reviewable changes; #45596 adds output-buffer remapping and #45597 adds the `SKIP_PROFILED` mode.
## 🎯 Justification
`SKIP_TEMP` stabilizes only preallocated temporary buffers, but profiled command-buffer update policies also need to stabilize caller-owned parameters whose physical addresses remain constant across executions. Parameter ownership prevents allocating them directly through the command-buffer reservation.
Creating a per-execution alias gives recorded command buffers a stable VA while preserving the caller's original address and ownership. Restoring the original address after execution ensures teardown and result handling never observe a reservation address.
## 🚀 Kind of Contribution
✨ New Feature
## 📊 Benchmark (for Performance Improvements)
Not applicable as a standalone change. This PR adds parameter-remapping support but does not select it in a production update mode. Performance evaluation belongs to the final `SKIP_PROFILED` policy in #45597.
## 🧪 Unit Tests:
- Added host-only `gpu_executable_va_remap_allocator_test.cc` coverage using a fake VMM allocator.
- Verifies that a caller-owned parameter receives the same stable reservation address across executions.
- Verifies persistent allocation-index handling, post-execution restoration to the caller address, and release of each per-execution mapping.
- Covers cleanup behavior without requiring a GPU.
## 🧪 Execution Tests:
No standalone execution test is added because no production update mode selects parameter allocations in this PR. End-to-end selection and execution coverage is provided by the stacked `SKIP_PROFILED` change in #45597.
Copybara import of the project:
--
a0de77a1e85642e79d8b9f5d4d988402280ecfbb by Shawn Wang <[email protected]>:
[XLA:GPU] Support VA remapping of parameter buffer allocations
Allow command buffer VA remapping to give stable reservation addresses
to entry-computation-parameter allocations. Parameter buffers are owned
by the caller, so they are aliased into the VA reservation with Map()
each execution instead of being allocated through it:
- GpuExecutableBufferAllocator::ExecutionScope gains a
ResolveParameterBuffer hook (base returns the caller buffer), and
ExecuteWithBufferAllocations now takes a mutable BufferAllocations so
subclasses can rewrite entries after execution. The Prepare hook is
renamed from PrepareReservation.
- GpuExecutableVaRemapAllocator records each installed alias
(RecordStepAlias) and, after every execution, UnMaps the aliases and
rewrites the remapped BufferAllocations entries back to the
caller-owned addresses so TearDown and result handling never see
reservation addresses (ReleaseStepAliases; the scope destructor is a
safety net for error paths).
- No production update mode selects parameter allocations yet
(SKIP_TEMP remaps only preallocated temp buffers); the
AddVaRemappedAllocationForTesting seam plus a host-only fake VMM
allocator (gpu_executable_va_remap_allocator_test.cc) exercise the
new path: stable reservation address across executions, persistent
allocation indices, post-execution rewrite, and mapping release.
--
9e7c7fb688b5e3e13538d5e6f1588faaea428932 by Shawn Wang <[email protected]>:
Fix VA remap allocator CI failures
--
7ec80637270003249062139a8fec29202ce79422 by Shawn Wang <[email protected]>:
[XLA:GPU] Preserve owning buffers during VA remapping
--
b4db679bf775ee4bc2046303d3815488d711c084 by Shawn Wang <[email protected]>:
[XLA:GPU] Return remapped buffer allocations by value
--
4d5aabb280d3aab7bbe57754e30cbf47386fd35b by Shawn Wang <[email protected]>:
[XLA:GPU] Rename remapped allocation helper
Merging this change closes#45595
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45595 from shawnwang18:shawnw/cmd_buffer_va_remap_params 4d5aabb280d3aab7bbe57754e30cbf47386fd35b
PiperOrigin-RevId: 948758452
0 commit comments