← Back to Pull requests

Fix Clang CUDA launch bounds #1969

Closed
unknown closed this pull request without merging on Sep 24, 2026 16:29 UTC
View on GitHub
unknown unknown commented on Sep 17, 2026 06:55 UTC
Author

What problem are you trying to solve?

Kernels using @wp.kernel(launch_bounds=...) compile through NVRTC but fail
under wp.config.llvm_cuda because __launch_bounds__ is undefined. I found
this while evaluating the Clang CUDA path; removing the option prevents
comparing the compilers with the same launch-bound constraints.

Closes #1968.

What does this change?

Define __launch_bounds__ in the minimal CUDA runtime using CUDA's attribute
expansion. Add Clang CUDA regression coverage for integer and tuple bounds,
checking kernel results and that the tuple form emits .maxntid 64 and
.minnctapersm 2 in PTX.

Existing pull requests

  • I searched open pull requests for duplicate or overlapping work.

  • Related pull requests: None found.
  • Validation

  • Regression validation: The test fails to compile without the macro and

  • passes with it. The PTX assertion also fails when the macro expands to
    nothing or forwards only the first argument. All 9 Clang CUDA tests pass
    with the revised test.
  • NVIDIA GPU: GeForce RTX 4050 Laptop GPU on Ubuntu 24.04, CUDA 13.0,

  • bundled LLVM 22.1.8.
  • Other validation: Pre-commit hooks pass. Before this test-only revision,

  • the 9 NVRTC launch-bounds tests and the launch-bounds occupancy test passed;
    a broader targeted run covering CUDA launch options, codegen, and module
    handling reported 480 passed and 8 skipped. The production fix is unchanged.

    Checklist

  • I have read and followed the Contributing Guidelines.

  • This pull request does not bundle unrelated changes unless a maintainer agreed to the broader scope.

  • My branch is up to date with main and contains one commit, unless a maintainer agreed to keep the change as multiple commits.

  • I included any required changelog fragments and used a + prefix only for changes that do not require a GitHub issue.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

  • Bug Fixes

  • - Fixed Clang CUDA compilation failures for Warp kernels using launch_bounds.
    - Integer and tuple forms of launch_bounds are supported, including settings for the minimum number of blocks per multiprocessor.
    - Kernels using these settings can execute with the configured block size and occupancy limits.

  • Tests

  • - Added CUDA tests verifying that kernels with integer and tuple launch bounds compile and execute correctly.
    - Added checks confirming the configured thread and occupancy limits appear in generated PTX.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 339 lines (+254 / -85) across 4 files Reviewer: and2049 Review duration: 10653m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 339 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1969"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.3% (MEDIUM) · Higher = larger blast radius
    42.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%
    Repository