Skip to content

PR #39201: [xla:gpu] Split legacy custom calls into LegacyCustomCallThunk#41072

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
test_900699293
Open

PR #39201: [xla:gpu] Split legacy custom calls into LegacyCustomCallThunk#41072
copybara-service[bot] wants to merge 1 commit intomainfrom
test_900699293

Conversation

@copybara-service
Copy link
Copy Markdown

PR #39201: [xla:gpu] Split legacy custom calls into LegacyCustomCallThunk

Imported from GitHub PR #39201

Split CustomCallThunk into two separate classes to cleanly separate FFI from legacy custom call APIs (to be deleted). This change is NFC, simply splitting existing thunk/command into two classes to clearly separate legacy calling conventions from FFI.

  • CustomCallThunk — now exclusively handles XLA FFI custom calls. Simplified by removing all legacy code paths, optional bundle checks, and the ExecuteCustomCall() fallback. The bundle_ field is now a plain std::variant (always present) instead of std::optional<std::variant>.

  • LegacyCustomCallThunk (new) — handles deprecated legacy custom calls (API_VERSION_STATUS_RETURNING, etc.) using CustomCallTargetRegistry. Marked as deprecated in its class comment, directing users to FFI via CustomCallThunk.

Also split CustomCallCmd in the command buffer layer into:

  • CustomCallCmd — FFI only, builds ffi::CallFrame and invokes FFI handlers directly.
  • LegacyCustomCallCmd — legacy only, traces custom call execution via TraceCommandBufferFactory.

Unified CustomCallThunk accumulated too much complexity related to dispatching between two unrelated custom all ABIs, by splitting them into separate files we can keep on improving FFI without having to deal with legacy custom calls.
Copybara import of the project:

--
9f2fb95 by Eugene Zhulenev ezhulenev@openxla.org:

[xla:gpu] Split legacy custom calls into LegacyCustomCallThunk

Merging this change closes #39201

FUTURE_COPYBARA_INTEGRATE_REVIEW=#39201 from ezhulenev:split-custom-call-thunk 9f2fb95

@copybara-service copybara-service bot force-pushed the test_900699293 branch 4 times, most recently from f872317 to 582f91a Compare April 17, 2026 02:31
…hunk

Imported from GitHub PR #39201

Split `CustomCallThunk` into two separate classes to cleanly separate FFI from legacy custom call APIs (to be deleted). This change is **NFC**, simply splitting existing thunk/command into two classes to clearly separate legacy calling conventions from FFI.

- **`CustomCallThunk`** — now exclusively handles XLA FFI custom calls. Simplified by removing all legacy code paths, optional bundle checks, and the `ExecuteCustomCall()` fallback. The `bundle_` field is now a plain `std::variant` (always present) instead of `std::optional<std::variant>`.

- **`LegacyCustomCallThunk`** (new) — handles deprecated legacy custom calls (`API_VERSION_STATUS_RETURNING`, etc.) using `CustomCallTargetRegistry`. Marked as deprecated in its class comment, directing users to FFI via `CustomCallThunk`.

Also split `CustomCallCmd` in the command buffer layer into:
- **`CustomCallCmd`** — FFI only, builds `ffi::CallFrame` and invokes FFI handlers directly.
- **`LegacyCustomCallCmd`** — legacy only, traces custom call execution via `TraceCommandBufferFactory`.

Unified `CustomCallThunk` accumulated too much complexity related to dispatching between two unrelated custom all ABIs, by splitting them into separate files we can keep on improving FFI without having to deal with legacy custom calls.
Copybara import of the project:

--
9f2fb95 by Eugene Zhulenev <ezhulenev@openxla.org>:

[xla:gpu] Split legacy custom calls into LegacyCustomCallThunk

Merging this change closes #39201

FUTURE_COPYBARA_INTEGRATE_REVIEW=#39201 from ezhulenev:split-custom-call-thunk 9f2fb95
PiperOrigin-RevId: 900699293
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