Skip to content

[EagerJIT] Enhance auto inference of lazyjit and eager jit#1704

Merged
LeiWang1999 merged 2 commits intotile-ai:mainfrom
kurisu6912:fix-err-report
Jan 23, 2026
Merged

[EagerJIT] Enhance auto inference of lazyjit and eager jit#1704
LeiWang1999 merged 2 commits intotile-ai:mainfrom
kurisu6912:fix-err-report

Conversation

@kurisu6912
Copy link
Collaborator

@kurisu6912 kurisu6912 commented Jan 21, 2026

This pr adds a check of lazyjit by inspecting wether the function body contains a T.prim_func decorator. If it does, it must be lazyjit, because eager jit does not allow such nested prim_func definition.

Summary by CodeRabbit

  • Refactor

    • Consolidated AST evaluation into a single shared helper for more consistent behavior and easier maintenance.
  • Improvements

    • Added a utility to detect internal-implemented functions, enabling earlier/more accurate classification of function styles during processing.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run pre-commit run --all-files in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Adds a top-level _try_eval() to evaluate AST expressions safely and a public has_internal_prim_func() to detect prim_func decorators via AST; DSLMutator._try_eval() is delegated to the new helper and JITFunc._is_lazy_style() short-circuits when has_internal_prim_func() is true.

Changes

Cohort / File(s) Summary
AST Utilities
tilelang/language/eager/ast.py
Adds _try_eval(node, nonlocals, globals) for safe AST expr evaluation; adds has_internal_prim_func(func) to inspect decorators for prim_func; refactors DSLMutator._try_eval() to call the new top-level helper.
Builder Integration
tilelang/language/eager/builder.py
Imports and uses has_internal_prim_func() in JITFunc._is_lazy_style() to return early for internal prim_func implementations; narrows exception handling (excludes TypeError).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I nibble AST leaves with careful delight,
Sniff out a prim_func hidden from sight.
No needless call, no extra fuss—
I hop, I mark, I tuck it into us. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references the main objective of detecting and inferring lazyjit vs eager jit classification by inspecting function bodies for prim_func decorators.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LeiWang1999 LeiWang1999 merged commit 8f27a31 into tile-ai:main Jan 23, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants