- 
                Notifications
    You must be signed in to change notification settings 
- Fork 290
[Language] Support loop_break primitive #873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| WalkthroughIntroduces a new public function loop_break() in tilelang/language/builtin.py that calls the intrinsic "tl.loop_break" via tir.call_intrin with tir.op.Op.get. Positioned after sync_grid, it returns the intrinsic handle. No other files or behaviors are changed. Changes
 Sequence Diagram(s)sequenceDiagram
    autonumber
    actor Dev as Developer Code
    participant Builtin as builtin.loop_break()
    participant TIR as tir.call_intrin(...)
    participant Op as tir.op.Op.get("tl.loop_break")
    participant IR as TL Intrinsic: tl.loop_break
    Dev->>Builtin: loop_break()
    Builtin->>Op: get("tl.loop_break")
    Op-->>Builtin: Op handle
    Builtin->>TIR: call_intrin("handle", Op)
    TIR->>IR: Invoke intrinsic
    Note right of IR: Signals break from innermost loop
    IR-->>Builtin: handle
    Builtin-->>Dev: return handle
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
 Pre-merge checks and finishing touches✅ Passed checks (3 passed)
 ✨ Finishing touches
 🧪 Generate unit tests
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
 🧰 Additional context used🧬 Code graph analysis (1)tilelang/language/builtin.py (2)
 ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
 🔇 Additional comments (1)
 Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs. 
 Please see the documentation for more information. Example: reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment  | 
| 👋 Hi! Thank you for contributing to the TileLang project. Please remember to run  We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 | 
| Summary of ChangesHello @chengyupku, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new  Highlights
 Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either  
 Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a  Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a loop_break primitive. The implementation in tilelang/language/builtin.py is correct and consistent with the surrounding code. However, there are no tests included for this new functionality. Adding tests is crucial to ensure correctness and prevent future regressions. I also noticed a minor documentation issue in a related C++ header file (src/op/builtin.h) where the comment for loop_break incorrectly states it's for loop continue; it would be good to fix that as part of this change.
| def loop_break(): | ||
| """Break out of the innermost loop. | ||
| """ | ||
| return tir.call_intrin("handle", tir.op.Op.get("tl.loop_break")) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary by CodeRabbit