Skip to content

[Misc] Add named top-level loops#440

Draft
hughperkins wants to merge 3 commits intomainfrom
hp/named-loops
Draft

[Misc] Add named top-level loops#440
hughperkins wants to merge 3 commits intomainfrom
hp/named-loops

Conversation

@hughperkins
Copy link
Copy Markdown
Collaborator

Issue: #

Brief Summary

copilot:summary

Walkthrough

copilot:walkthrough

When a kernel has multiple top-level for loops, each becomes a separate
GPU kernel. This adds a `name` parameter to `qd.loop_config()` that
propagates through the compilation pipeline and appears in the compiled
kernel names, making them identifiable in profilers and traces.

Example: `qd.loop_config(name="compute_forces")` produces kernel names
like `my_kernel_c0_abc_0_compute_forces_range_for` instead of the
generic `my_kernel_c0_abc_0_range_for`.

The loop_name also appears in IR dumps (QD_DUMP_IR=1) as
`loop_name=...` on offloaded range_for/struct_for statements.

Includes 6 unit tests covering correctness, name propagation in IR
dumps, no-leak between loops, mixed named/unnamed, and serialize combo.
The clone() methods for RangeForStmt, StructForStmt, and OffloadedStmt
were not copying the loop_name field. Since the LLVM codegen clones each
offloaded task before compilation, the user-provided loop name was lost.
@hughperkins hughperkins deployed to publish_pypi March 31, 2026 16:08 — with GitHub Actions Active
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