[REFACTOR][EXTRA] Add TVM_FFI_S_VISIT_RETURN_NONE for visit hook tails - #753
Merged
Conversation
A visit hook ends by returning "no interrupt", which every hook spells out by hand as MoveToTVMFFIAny(Expected<Optional<VisitInterrupt>>(std::nullopt)). That puts the Expected storage representation in every hook body, including downstream ones outside this repository. Add the terminal counterpart to TVM_FFI_S_VISIT_MAYBE_EARLY_RETURN, going through the same MaybeReturnHelper proxy so it works from a raw TVMFFIAny hook and a typed helper alike. Adopt it in the container hooks, and document both visit macros with the canonical hook shape, matching how TVM_FFI_S_MUTATE_ASSIGN_OR_RETURN is already documented.
tqchen
force-pushed
the
visit-return-none
branch
from
September 6, 2026 13:51
01ed754 to
ef95be9
Compare
tlopex
approved these changes
Sep 6, 2026
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.
A visit hook ends by returning "no interrupt", which every hook currently spells
out by hand:
That puts the
Expectedstorage representation into every hook body, includingdownstream ones outside this repository, where it would keep compiling if the
representation ever changed.
TVM_FFI_S_VISIT_MAYBE_EARLY_RETURNalready owns the other half of this ABIboundary; the tail was the only part still written by hand. This adds the
terminal counterpart, going through the same
MaybeReturnHelperproxy so itworks from a raw
TVMFFIAnyhook and a typed helper alike, adopts it in thecontainer hooks, and documents the canonical hook shape once beside the macro
pair.