Skip to content

PR #41079: [XLA:GPU] Migrate MemzeroCmd into MemzeroThunk#116330

Draft
copybara-service[bot] wants to merge 1 commit intomasterfrom
exported_pr_902431513
Draft

PR #41079: [XLA:GPU] Migrate MemzeroCmd into MemzeroThunk#116330
copybara-service[bot] wants to merge 1 commit intomasterfrom
exported_pr_902431513

Conversation

@copybara-service
Copy link
Copy Markdown

PR #41079: [XLA:GPU] Migrate MemzeroCmd into MemzeroThunk

Imported from GitHub PR openxla/xla#41079

Description

Follows the same pattern as #40722 ([XLA:GPU] Migrate Memset32Cmd into Memset32BitValueThunk): eliminate the standalone MemzeroCmd wrapper class by making MemzeroThunk directly implement Command and provide its own Record() method.

Before

MemzeroThunk (a plain Thunk subclass) was converted by the command buffer emitter into a heap-allocated MemzeroCmd object via Convert(). This meant the same logical operation was split across two classes with duplicated state.

After

MemzeroThunk inherits from Command (using the protected three-argument constructor to preserve Kind::kMemzero), implements Record() directly, and is emplaced into the command sequence via static_cast — the same pattern as Memset32BitValueThunk, GemmThunk, KernelThunk, and DeviceToDeviceCopyThunk. MemzeroCmd is deleted entirely.

Changes

  • memset_thunk.h/cc: MemzeroThunk now extends Command; Record() added
  • command_buffer_cmd.h/cc: MemzeroCmd class removed
  • command_buffer_cmd_emitter.cc: Convert(const MemzeroThunk&) helper removed; kMemzero case uses static_cast append
  • memset_thunk_test.cc: Added RecordCommandBuffer and RecordCommandBufferUpdate GPU tests for MemzeroThunk
  • command_buffer_thunk_test.cc, command_buffer_cmd_test.cc: Updated call sites

Testing

New MemzeroThunkTest::RecordCommandBuffer and MemzeroThunkTest::RecordCommandBufferUpdate tests cover the create and update paths.
Copybara import of the project:

--
245fff2c7f3d4a2490391738e78ff6291589bec0 by Shawn Wang shawnw@nvidia.com:

[XLA:GPU] Migrate MemzeroCmd into MemzeroThunk

Follows the same pattern as the recent Memset32Cmd migration: make
MemzeroThunk directly inherit Command and implement Record(), removing
the separate MemzeroCmd wrapper class entirely.

Merging this change closes #41079

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#41079 from shawnwang18:shawnw/migrate_memset_command_to_thunk 245fff2c7f3d4a2490391738e78ff6291589bec0

Imported from GitHub PR openxla/xla#41079

 Description

  Follows the same pattern as #40722 ([XLA:GPU] Migrate Memset32Cmd into Memset32BitValueThunk): eliminate the standalone MemzeroCmd wrapper class by making MemzeroThunk directly implement Command and provide its own Record() method.

  Before

  MemzeroThunk (a plain Thunk subclass) was converted by the command buffer emitter into a heap-allocated MemzeroCmd object via Convert<MemzeroThunk>(). This meant the same logical operation was split across two classes with duplicated state.

  After

  MemzeroThunk inherits from Command (using the protected three-argument constructor to preserve Kind::kMemzero), implements Record() directly, and is emplaced into the command sequence via static_cast — the same pattern as Memset32BitValueThunk, GemmThunk, KernelThunk, and DeviceToDeviceCopyThunk. MemzeroCmd is deleted entirely.

  Changes

  - memset_thunk.h/cc: MemzeroThunk now extends Command; Record() added
  - command_buffer_cmd.h/cc: MemzeroCmd class removed
  - command_buffer_cmd_emitter.cc: Convert(const MemzeroThunk&) helper removed; kMemzero case uses static_cast append
  - memset_thunk_test.cc: Added RecordCommandBuffer and RecordCommandBufferUpdate GPU tests for MemzeroThunk
  - command_buffer_thunk_test.cc, command_buffer_cmd_test.cc: Updated call sites

  Testing

  New MemzeroThunkTest::RecordCommandBuffer and MemzeroThunkTest::RecordCommandBufferUpdate tests cover the create and update paths.
Copybara import of the project:

--
245fff2c7f3d4a2490391738e78ff6291589bec0 by Shawn Wang <shawnw@nvidia.com>:

[XLA:GPU] Migrate MemzeroCmd into MemzeroThunk

Follows the same pattern as the recent Memset32Cmd migration: make
MemzeroThunk directly inherit Command and implement Record(), removing
the separate MemzeroCmd wrapper class entirely.

Merging this change closes #41079

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#41079 from shawnwang18:shawnw/migrate_memset_command_to_thunk 245fff2c7f3d4a2490391738e78ff6291589bec0
PiperOrigin-RevId: 902431513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant