Skip to content

README: update Linaro CI links - #45595

Merged
copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
hrw:hrw/update-ci-links
Dec 15, 2020
Merged

copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
hrw:hrw/update-ci-links

Conversation

@hrw

@hrw hrw commented Dec 11, 2020

Copy link
Copy Markdown
Contributor

We have two CI jobs now:

  • Tensorflow stable (1.15.x and 2.x)
  • Tensorflow nightly (git master HEAD)

Builds are done on CentOS 8 (Python 3.6) and Debian 'buster' (Python 3.7).

@google-ml-butler google-ml-butler Bot added the size:XS CL Change Size: Extra Small label Dec 11, 2020
@google-cla

google-cla Bot commented Dec 11, 2020

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla Bot added the cla: no label Dec 11, 2020
@google-cla

google-cla Bot commented Dec 11, 2020

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@hrw

hrw commented Dec 11, 2020

Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@google-cla google-cla Bot added cla: yes and removed cla: no labels Dec 11, 2020
@gbaned gbaned self-assigned this Dec 11, 2020
@gbaned
gbaned requested a review from mihaimaruseac December 11, 2020 13:58
@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Dec 11, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Dec 11, 2020
@gbaned gbaned added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Dec 15, 2020
@copybara-service
copybara-service Bot merged commit aaed2c6 into tensorflow:master Dec 15, 2020
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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
copybara-service Bot pushed a commit that referenced this pull request Jul 16, 2026
…ions

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

PiperOrigin-RevId: 948990342
copybara-service Bot pushed a commit that referenced this pull request Jul 20, 2026
Imported from GitHub PR openxla/xla#45596

## 📝 Summary of Changes

This PR extends command-buffer virtual-address remapping to allocations that
escape to the caller (`maybe_live_out`) while preserving the const ownership
model introduced by #45595.

- Keeps selected live-out allocations at normal allocator-owned addresses in
  the owning `BufferAllocations` table.
- Extends `GetRemappedBufferAllocations` to map finalized selected input/output
  addresses into their stable reservation slices immediately before execution.
- Rewrites only the non-owning execution copy, so result handling and teardown
  continue to see external, deallocatable addresses.
- Handles donated and copy-protected aliases by mapping after output setup has
  finalized the owning address table.
- Extends the host-only fake-VMM tests to cover stable execution aliases,
  logical external sizes, output deallocation, and deferred alias cleanup.

This PR is stacked on #45595, **[XLA:GPU] Support VA remapping of parameter
buffer allocations**. It is part 2 of 3 splitting the former #45568
implementation; #45597 adds the `SKIP_PROFILED` mode.

## 🎯 Justification

Live-out buffers can outlive an execution scope, so the caller must retain a
normal allocator-owned address that remains valid and can be passed to
`Deallocate()`. At the same time, recorded command buffers need a stable
reservation address.

Building a separate execution allocation table provides both properties
without mutating the owning table or removing its const qualifier. Deferring
the mapping until execution also ensures donation and copy protection have
already selected the final external address.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

Not applicable as a standalone change. This PR adds output-buffer remapping
support but does not independently enable a new command-buffer update mode.
Performance evaluation belongs to the final `SKIP_PROFILED` policy in #45597.

## 🧪 Unit Tests:

- Extends the host-only fake-VMM allocator test with a non-granularity-aligned
  remapped live-out allocation.
- Verifies the owning table contains the logical-size external address before
  and after execution.
- Verifies execution receives the same stable reservation address across runs
  and maps the correct raw physical allocation.
- Verifies the external address is deallocatable and all aliases are released.

## 🧪 Execution Tests:

No standalone execution test is added for this enabling layer. End-to-end
live-out selection, execution, and output deallocation are covered by the
stacked `SKIP_PROFILED` change in #45597.

Copybara import of the project:

--
b7b79af2174271e65f2c7d8e8bac527a72e97af9 by Shawn Wang <[email protected]>:

[XLA:GPU] Support VA remapping of output buffer allocations

Keep selected maybe_live_out allocations at normal allocator-owned addresses in the owning BufferAllocations table. Immediately before execution, GetRemappedBufferAllocations maps the finalized selected input/output addresses into their stable reservation slices and rewrites only a non-owning execution copy.

This preserves const ownership semantics, handles donation and copy protection before mapping, and leaves output addresses deallocatable by callers. Extend the host-only VMM test to verify stable execution addresses, logical external sizes, unchanged owning buffers, and alias cleanup across executions.

Merging this change closes #45596

Reverts changelist 949495726

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45596 from shawnwang18:shawnw/cmd_buffer_va_remap_outputs b7b79af2174271e65f2c7d8e8bac527a72e97af9
PiperOrigin-RevId: 950641350
copybara-service Bot pushed a commit that referenced this pull request Jul 20, 2026
Imported from GitHub PR openxla/xla#45596

## 📝 Summary of Changes

This PR extends command-buffer virtual-address remapping to allocations that
escape to the caller (`maybe_live_out`) while preserving the const ownership
model introduced by #45595.

- Keeps selected live-out allocations at normal allocator-owned addresses in
  the owning `BufferAllocations` table.
- Extends `GetRemappedBufferAllocations` to map finalized selected input/output
  addresses into their stable reservation slices immediately before execution.
- Rewrites only the non-owning execution copy, so result handling and teardown
  continue to see external, deallocatable addresses.
- Handles donated and copy-protected aliases by mapping after output setup has
  finalized the owning address table.
- Extends the host-only fake-VMM tests to cover stable execution aliases,
  logical external sizes, output deallocation, and deferred alias cleanup.

This PR is stacked on #45595, **[XLA:GPU] Support VA remapping of parameter
buffer allocations**. It is part 2 of 3 splitting the former #45568
implementation; #45597 adds the `SKIP_PROFILED` mode.

## 🎯 Justification

Live-out buffers can outlive an execution scope, so the caller must retain a
normal allocator-owned address that remains valid and can be passed to
`Deallocate()`. At the same time, recorded command buffers need a stable
reservation address.

Building a separate execution allocation table provides both properties
without mutating the owning table or removing its const qualifier. Deferring
the mapping until execution also ensures donation and copy protection have
already selected the final external address.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

Not applicable as a standalone change. This PR adds output-buffer remapping
support but does not independently enable a new command-buffer update mode.
Performance evaluation belongs to the final `SKIP_PROFILED` policy in #45597.

## 🧪 Unit Tests:

- Extends the host-only fake-VMM allocator test with a non-granularity-aligned
  remapped live-out allocation.
- Verifies the owning table contains the logical-size external address before
  and after execution.
- Verifies execution receives the same stable reservation address across runs
  and maps the correct raw physical allocation.
- Verifies the external address is deallocatable and all aliases are released.

## 🧪 Execution Tests:

No standalone execution test is added for this enabling layer. End-to-end
live-out selection, execution, and output deallocation are covered by the
stacked `SKIP_PROFILED` change in #45597.

Copybara import of the project:

--
b7b79af2174271e65f2c7d8e8bac527a72e97af9 by Shawn Wang <[email protected]>:

[XLA:GPU] Support VA remapping of output buffer allocations

Keep selected maybe_live_out allocations at normal allocator-owned addresses in the owning BufferAllocations table. Immediately before execution, GetRemappedBufferAllocations maps the finalized selected input/output addresses into their stable reservation slices and rewrites only a non-owning execution copy.

This preserves const ownership semantics, handles donation and copy protection before mapping, and leaves output addresses deallocatable by callers. Extend the host-only VMM test to verify stable execution addresses, logical external sizes, unchanged owning buffers, and alias cleanup across executions.

Merging this change closes #45596

Reverts changelist 949495726

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45596 from shawnwang18:shawnw/cmd_buffer_va_remap_outputs b7b79af2174271e65f2c7d8e8bac527a72e97af9
PiperOrigin-RevId: 950641350
copybara-service Bot pushed a commit that referenced this pull request Jul 20, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts changelist 949495726

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 20, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts changelist 949495726

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 20, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts changelist 949495726

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

Reverts 1b96579

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 21, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
8b5c4d766fdb20611c575203a9851ff7c67c27e8 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
a099d0ccb63bb1c45c39fb54a40e6431ba806253 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
153df493569ae521e8e0058d55241298ead297aa by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
16473a0c5bacc88055d839393b332223781dbb3e by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
760026228f016ed3b0a6214b7286c1cda8bd5ab9 by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split 760026228f016ed3b0a6214b7286c1cda8bd5ab9
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
f53c11fbb9238a010cdfb8effe8df509a0fb6f31 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
d76dd3608493868568470916e2f90c67f8683bb2 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
89d3dd241d75df2e4de0198a50542777e6dc66b2 by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
51adad438dfea34c10f0c20b2bda9de2e1a3bb7b by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
e32b96bbcd29211ca08b682050cbd24eeb6401ba by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split e32b96bbcd29211ca08b682050cbd24eeb6401ba
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
f53c11fbb9238a010cdfb8effe8df509a0fb6f31 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
d76dd3608493868568470916e2f90c67f8683bb2 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
89d3dd241d75df2e4de0198a50542777e6dc66b2 by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
51adad438dfea34c10f0c20b2bda9de2e1a3bb7b by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
e32b96bbcd29211ca08b682050cbd24eeb6401ba by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split e32b96bbcd29211ca08b682050cbd24eeb6401ba
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
f53c11fbb9238a010cdfb8effe8df509a0fb6f31 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
d76dd3608493868568470916e2f90c67f8683bb2 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
89d3dd241d75df2e4de0198a50542777e6dc66b2 by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
51adad438dfea34c10f0c20b2bda9de2e1a3bb7b by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
e32b96bbcd29211ca08b682050cbd24eeb6401ba by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#45597 from shawnwang18:shawnw/cmd_buffer_skip_profiled_split e32b96bbcd29211ca08b682050cbd24eeb6401ba
PiperOrigin-RevId: 950773148
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2026
Imported from GitHub PR openxla/xla#45597

## 📝 Summary of Changes

This PR adds the `SKIP_PROFILED` command-buffer update mode. The mode
automatically includes command-buffer-referenced preallocated temp allocations
in the final VA-remap set while profiling other eligible non-constant
allocations during the first three successful executions. Stable profile
candidates are combined with the temp allocations so subsequent command-buffer
executions can treat the final set as persistent and avoid unnecessary address
updates.

- Adds `DebugOptions::SKIP_PROFILED` and routes it through the GPU executable
  buffer-allocation policy.
- Adds a per-executor profile state machine to
  `GpuExecutableVaRemapAllocator`: `kProfiling` transitions exactly once to
  `kActive` when an automatic temp or safe profile candidate exists, or to
  `kDisabled` when the final remap set is empty.
- Automatically selects preallocated temp buffers and profiles eligible
  parameter and live-out candidates while filtering unstable addresses,
  non-VMM-backed parameters, and incompatible shared parameter buffers.
- Counts only successful executions toward the profiling window and passes
  `std::nullopt` for persistent allocation indices while profiling, followed by
  one absent-to-present transition to the final persistent set.
- Uses the parameter-remapping support from #45595 and output-buffer remapping
  support from #45596. Parameters and outputs remain externally owned in the
  const owning allocation table; finalized external addresses are mapped into
  an execution-only allocation-table copy immediately before execution.
- Preserves the base allocator fallback when VMM remapping is unavailable or
  there are neither automatic temp buffers nor stable profile candidates.

This PR is stacked on #45596, **[XLA:GPU] Support VA remapping of output buffer
allocations**. It is part 3 of 3 and, together with #45595 and #45596,
supersedes the closed pre-split PR #45568.

## 🎯 Justification

`SKIP_TEMP` can stabilize preallocated temporary buffers, but parameters and
live-out buffers may also keep stable physical addresses across repeated
executions. Updating command-buffer node addresses for those stable allocations
adds avoidable runtime overhead.

`SKIP_PROFILED` discovers address stability for each executable/executor pair
instead of assuming every dynamic allocation is stable. Workloads with
repeatable allocation behavior can therefore stabilize more
command-buffer-visible addresses, while unstable or unsupported workloads retain
the existing fallback behavior. Mapping finalized owning addresses immediately
before execution also keeps donation and copy-protection changes compatible with
the const owning-allocation API introduced by the lower PRs.

## 🚀 Kind of Contribution

✨ New Feature

## 📊 Benchmark (for Performance Improvements)

No benchmark result is claimed in this draft. The PR adds the policy and
correctness coverage; a public-HLO performance benchmark can be added separately
when reporting workload-specific speedups.

## 🧪 Unit Tests:

- Extended `GpuExecutableTest.CommandBufferAllocationPolicy` expectations for
  automatic temp-buffer selection in `SKIP_PROFILED`.
- Added host-only fake-VMM coverage for profiling, transition, active remapping,
  and disabled fallback states.
- Verifies a temp-only executable transitions to an active persistent temp set,
  and an unstable parameter cannot disqualify an automatically selected temp.
- Verifies stable parameter and output selection, including non-granularity-sized
  externally owned outputs.
- Verifies failed executions do not advance the three-successful-execution
  profiling window.
- Verifies fallback for unstable and non-VMM-backed parameters and incompatible
  shared parameter buffers.
- Verifies copy protection both during profiling and after transition: the
  owning table retains the finalized external address while execution uses the
  stable reservation address.

## 🧪 Execution Tests:

- Added one-device `VmmTest` coverage using a two-GEMM command-buffer workload
  across profiling, transition, and remapped executions, checking numerical
  correctness on every run.
- Verifies one-time profile selection, automatic temp inclusion, VA-reservation
  creation and reuse, and successful deallocation of externally returned output
  buffers.
- Added a non-VMM allocator execution test verifying the workload remains
  correct and creates no VA reservation when remapping is unavailable.

Copybara import of the project:

--
f53c11fbb9238a010cdfb8effe8df509a0fb6f31 by Shawn Wang <[email protected]>:

[XLA:GPU] Add SKIP_PROFILED command buffer update mode

Add SKIP_PROFILED to profile command-buffer-referenced non-constant allocation addresses for three successful executions, then VA-remap the stable candidates so recorded command buffers can skip updating them.

The per-executor profile transitions once from profiling to active or disabled, preserving the required absent-to-present persistent-index transition. Active executions allocate selected temps at reservation addresses and map finalized selected input/output addresses into an execution-only BufferAllocations copy, leaving the owning table unchanged.

Filter unstable candidates and parameter addresses that are not VMM-backed or are shared by multiple parameter allocations. Add flag parsing, allocation-policy coverage, GPU end-to-end coverage, and fallback behavior without a VMM allocator.

--
d76dd3608493868568470916e2f90c67f8683bb2 by Shawn Wang <[email protected]>:

Add host-only unit tests for SKIP_PROFILED

Cover the SKIP_PROFILED profile state machine with the fake-VMM harness through a test-only profile-candidate seam.

Verify stable parameters and outputs transition to execution-only reservation addresses while owning buffers remain external, failed executions do not advance profiling, and unstable, non-VMM-backed, or shared parameter buffers disable remapping.

Verify copy-protected addresses are observed after output finalization and can be remapped both during a stable profile and when copy protection first appears after the transition.

--
89d3dd241d75df2e4de0198a50542777e6dc66b2 by Shawn Wang <[email protected]>:

Remove profile candidate count accessor

--
51adad438dfea34c10f0c20b2bda9de2e1a3bb7b by Shawn Wang <[email protected]>:

[XLA:GPU] Automatically remap temp buffers in SKIP_PROFILED

--
e32b96bbcd29211ca08b682050cbd24eeb6401ba by Shawn Wang <[email protected]>:

[XLA:GPU] Add direct VA remap allocator includes

Merging this change closes #45597

PiperOrigin-RevId: 952017749
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes ready to pull PR ready for merge process size:XS CL Change Size: Extra Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants