Fix duplicate overload type resolution - #914
Open
ZzEeKkAa wants to merge 2 commits into
Open
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test |
ZzEeKkAa
marked this pull request as ready for review
July 9, 2026 23:43
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
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.
Fix duplicate overload type resolution
Summary
@overload/@overload_methodimplementation functions are re-executed once perdistinct compiler-
Flagscontext in which a call is resolved. Because the overloadbody is where user code does its (sometimes very expensive) work, this doubles that
work for every overload that is resolved both during an enclosing kernel's type
inference and during a device-function compile.
This MR memoizes the overload-function result on the typing context + argument
types only — the inputs the overload actually depends on — so the body runs at
most once per distinct signature, while leaving the existing flag-sensitive
_impl_cacheuntouched.Root cause
_OverloadFunctionTemplate._get_implkeys its implementation cache on the activeflags: