Skip to content

[EagerJIT] Add Syntax Sugar for Kernel Source Retrieval#1720

Closed
kurisu6912 wants to merge 1 commit intotile-ai:mainfrom
kurisu6912:eagerjit-get-kernel-source
Closed

[EagerJIT] Add Syntax Sugar for Kernel Source Retrieval#1720
kurisu6912 wants to merge 1 commit intotile-ai:mainfrom
kurisu6912:eagerjit-get-kernel-source

Conversation

@kurisu6912
Copy link
Collaborator

@kurisu6912 kurisu6912 commented Jan 23, 2026

This pr add kernel.get_kernel_source(N=1) to allow kernel source retrieval

Summary by CodeRabbit

  • New Features

    • Added kernel caching to optimize compilation performance for repeated function calls with identical arguments.
    • Introduced get_kernel_source() method to inspect and debug compiled kernel code.
  • Performance

    • Enhanced execution mode auto-detection for more efficient optimization selection.

✏️ 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 23, 2026

📝 Walkthrough

Walkthrough

This change introduces kernel result caching to the JIT compilation path and adds automatic execution style detection in argument parsing. The JIT module now caches compiled kernels by argument hash to avoid recompilation, and exposes the compiled kernel source via a new public API. The eager builder now auto-detects lazy execution style when mode is set to "auto" before template construction.

Changes

Cohort / File(s) Summary
Kernel Caching in JIT
tilelang/jit/__init__.py
Adds cache key computation and per-argument kernel caching in compile() method; caches compiled kernels to avoid recompilation. Introduces new public method get_kernel_source() to retrieve compiled kernel source. Extends __call__() path to utilize the cache.
Auto-Detection of Execution Style
tilelang/language/eager/builder.py
Modifies parse_args() to auto-detect execution style by calling _is_lazy_style() when mode is "auto", setting mode to "lazy" or "eager" accordingly. When lazy mode is detected, returns early with None tensor_args, tightening separation between lazy and eager branches.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰✨ A rabbit hopped through caches bright,
Where kernels rest in storage tight,
Auto-magic finds the way,
Lazy styles save the day!
Thump thump — optimization's might! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 and specifically identifies the main change: adding a syntax sugar API (get_kernel_source method) for kernel source retrieval in the EagerJIT context. The title matches the primary changes in the changeset.

✏️ 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.

@kurisu6912 kurisu6912 closed this Jan 23, 2026
@kurisu6912
Copy link
Collaborator Author

Closed and wait for #1694

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.

1 participant