[Pallas] Exclude output-only tensors from pallas_call inputs#1998
Draft
[Pallas] Exclude output-only tensors from pallas_call inputs#1998
Conversation
76fcda7 to
6a459f3
Compare
Output-only tensors (allocated with empty/empty_like/new_empty and never read by the kernel) are excluded from pallas_call inputs entirely. The launcher returns the pallas_call results for these tensors, and the generated host code captures the return value. This eliminates both VMEM pressure (output-only tensor not loaded) and the OpSplitMode::kSplitBoth graph split in torch_tpu (empty input_output_aliases for output-only kernels).
6a459f3 to
3a26351
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on #1984 (HBM donate for output-only tensors). Output-only tensors are now excluded from
pallas_callinputs entirely, and the launcher returns the pallas_call results as torch tensors. The generated host code captures the return value.#1984 already eliminated VMEM pressure via HBM
in_specs, but the donated tensor still triggeredOpSplitMode::kSplitBothin torch_tpu, inserting anempty.1broadcast op (~127 us overhead). This PR eliminates that by makinginput_output_aliasesempty for output-only kernels — no donation, no graph split.Generated code before (#1984):
Generated code after:
The launcher excludes
outfrom pallas_call inputs and returns the result directly. For multiple output-only tensors:out1, out2 = _launcher(...).Authored with Claude Code.