Skip to content

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

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

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

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:

--
2d33e5b 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 2d33e5b

…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:

--
2d33e5b 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 2d33e5b
PiperOrigin-RevId: 894119940
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