[Refactor][Engram] Move the decode compile boundary to the op layer - #2280
Merged
lcy-seso merged 1 commit intoSep 27, 2026
Merged
Conversation
EngramDecodeKernel registered its own torch.library custom op and fake. EngramDecodeFwdOp already declares compile_boundary = True, so the kernel only ever runs inside the op's generated operator, where the nested custom op was an extra dispatcher round trip. The kernel now allocates its outputs and launches its two programs directly. The other kernel-level custom ops lost their decorators earlier but kept their bodies: undecorated fake functions, uncalled launch wrappers, and comments claiming a custom op still exists. They are deleted.
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.
Problems
EngramDecodeKernelregisters its owntorch.librarycustom optileops::engram_decodewith a hand-written fake, the last kernel-level custom op undersrc/tileops/kernels/; the compile boundary belongs to the op layer (ops-design.md § Compile Dispatch Boundary).EngramDecodeFwdOpalready declarescompile_boundary = Trueand is in the compile-contract registry, so the kernel only runs inside the op's generated operator and the nested custom op is an extra dispatcher round trip.def _fake functions, nine uncalled launch wrappers and fakes in DeltaNet and GLA, and comments claiming a custom op or torch.compile wrapper still exists.Changes
EngramDecodeKernel.forwardallocates its outputs and launches the projection and step programs directly, with the same arguments, buffers and order as the deleted custom op body.src/tileops/kernels/.torch.ops.tileops.engram_decodeno longer exists; nothing in the repo called it, and the op's generated operator is unchanged.EngramDecodeFwdOpare bit-identical (torch.equal) before and after on the three manifest rows and two extra rows (history shorter than the cache, unalignedd_mem).