[EagerJIT] Lazy Evaluation of Kernel Body in Eager JIT (#1690)#1694
Merged
LeiWang1999 merged 7 commits intotile-ai:mainfrom Jan 23, 2026
Merged
[EagerJIT] Lazy Evaluation of Kernel Body in Eager JIT (#1690)#1694LeiWang1999 merged 7 commits intotile-ai:mainfrom
LeiWang1999 merged 7 commits intotile-ai:mainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
2 tasks
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tilelang/language/eager/builder.py`:
- Around line 892-901: The phase2 branch in the eager JIT substitution (when
builder.eager_jit == "phase2") currently indexes builder.eager_jit_subs[name]
(and for comma/space-separated lists) which can raise an unhelpful KeyError for
unknown constexpr names; update the code in that branch to validate each name
exists in builder.eager_jit_subs before returning substitutions and raise a
clear, descriptive error (e.g., raise KeyError or ValueError with a message that
lists the missing names and the original requested name(s) and mentions phase2)
so callers can see which constexpr(s) were not registered in phase1; apply this
check for the single-name path and the tuple paths that iterate over names.
♻️ Duplicate comments (1)
tilelang/language/eager/builder.py (1)
977-990: Add defensive null check forir_genwhenis_lazy_styleis false.The type annotation allows
ir_gen: IRGenerator[_P, _T] | None = None, but line 986 callsself.ir_gen.gen(builder)without checking for None. Add a guard after the lazy style check:🐛 Proposed fix
def get_tir(self, tensor_args, given_tensor_args, kwargs): if self.is_lazy_style: return self.prim_func + if self.ir_gen is None: + raise RuntimeError(f"ir_gen not available for eager-style template '{self.name}'") values = self._parse_phase2_key(**given_tensor_args, **kwargs)
🧹 Nitpick comments (1)
tilelang/language/eager/builder.py (1)
917-917: Type annotation mismatch forconstexprsfield.The field is typed as
set[Var]but defaults toNone. For type correctness, annotate asset[Var] | None = None.✏️ Suggested fix
- constexprs: set[Var] = None + constexprs: set[Var] | None = None
LeiWang1999
approved these changes
Jan 23, 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.
This function modify the elaboration process of EagerJIT
In the previous version of EagerJIT:
However, #1690 gives an bad case: the constexprs are used in
T.alloc_xxx. In this case, the shape of the allocated buffer is a unknown variable, thus compilation error arises.In this pr, we modify the elaboration process of EagerJIT:
T.Kernel, only retrieve the signatureSummary by CodeRabbit
Bug Fixes
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.