Skip to content

[pull] master from tensorflow:master - #8847

Merged
pull[bot] merged 3 commits into
Cache-Cloud:masterfrom
tensorflow:master
Sep 22, 2026
Merged

pull[bot] merged 3 commits into
Cache-Cloud:masterfrom
tensorflow:master

Conversation

@pull

@pull pull Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

PiperOrigin-RevId: 985391075
…uments and typed attributes

Writing a native custom-call handler requires hand-rolling a large amount of
boilerplate that XLA is in a better position to own, and several of those
hand-rolled pieces are easy to get subtly wrong. This change moves that work
into `NativeCustomCallEmitterContext`, which gains:

-   `GetDeviceDescription()`. Handlers previously had to dig the device
    description out of `GetTargetTopology()->gpu_target_config()`, guarding
    against a target config that, in this code path, is always present.
-   `GetResultShapedSlice()` / `GetOperandShapedSlice()`, which return the
    `ShapedSlice` that thunks actually consume, rather than a bare slice the
    handler then has to pair up with a shape by hand.
-   `CreateKernelArguments()`, which builds the conventional kernel argument
    list. Assembling `emitters::KernelArgument`s by hand leaves `slice_index_`
    uninitialized, skips alignment and aliasing computation, and requires the
    author to set `written` correctly - and `written` drives thunk scheduling,
    so getting it wrong produces races rather than an obvious failure.
    The implementation resolves buffers through `ThunkEmitter`'s allocation
    overrides, which a handler could not have done itself.
-   `GetFfiAttributes()` now returns a typed `ffi::Attributes` instead of an
    `AttributesMap`, so reading an attribute is `attrs.Get<float>("epsilon")`
    rather than two layers of hand-written `std::get_if` on nested variants.
    The demonstrator handler is updated for the new signature.

PiperOrigin-RevId: 985413447
This frequently shows up in x86 CPU logs on the critical path, but we don't actually test this on CI.

PiperOrigin-RevId: 985426107
@pull pull Bot locked and limited conversation to collaborators Sep 22, 2026
@pull pull Bot added the ⤵️ pull label Sep 22, 2026
@pull
pull Bot merged commit 9edd58f into Cache-Cloud:master Sep 22, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants