← Back to Pull requests

Return from the raise site instead of branching to a Return block #407

Merged
diptorupd merged 2 files (149 lines) on Nov 10, 2026 17:03 UTC
View on GitHub
diptorupd diptorupd commented on Oct 26, 2026 16:56 UTC
Author

This PR fixes how a raise in device code is lowered. Today a taken raise sets the error code and then jumps into the function's last return block, which can hold ordinary user code. That code then runs after the raise, and when it uses a value defined after the raise point, the module fails to verify. With this change a raise returns from the function at the raise site.

Why

lower_static_raise sets the error code and branches to the Return block with the highest offset. That block is not an exit block: it holds whatever user code comes before the function's last return. Two things go wrong.

The kernel keeps running after the raise. With debug=True the host sees the ValueError, but out[0] is still written:

@cuda.jit(debug=True, opt=False)
def k(out, x):
if x[0] < 0:
raise ValueError("negative")
out[0] = 5 # runs even when x[0] < 0

And when that block uses a value defined after the raise point, the module doesn't verify. The tail only needs to branch once so the store lands in a block of its own:

@cuda.jit
def k(out, x):
if x[0] < 0:
raise ValueError("negative")
v = x[0] 2
if x[1] > 0:
out[1] = 1
out[0] = v # InternalCompilerError: operand #0 does not dominate this use

The raise block branches straight to the block of out[0] = v (^bb4), which uses %25 (v) from ^bb2:

^bb1: // pred: ^bb0 (raise)
%14 = "llvm.cmpxchg"(%11, %13, %12) ... // error code 3 (ValueError)
"cf.br"()[^bb4] : () -> ()
^bb2: // pred: ^bb0
...
%25 = "arith.muli"(%23, %24) ... // v = x[0]
2
"cf.cond_br"(%36)[^bb3, ^bb4] ...
...
^bb4: // 3 preds: ^bb1, ^bb2, ^bb3
...
"memref.store"(%25, %arg0, %53) ... // out[0] = v: %25 does not dominate ^bb1 -> ^bb4
"gpu.return"() : () -> ()

The same happens without a raise in the source. literal_unroll dispatches on the tuple index, and its unmatched-case branch raises, so every literal_unroll loop has a raise block. A tail after the loop that branches fails the same way:

@cuda.jit
def k(out, x):
value = 0
for item in literal_unroll((1, 2)):
value += item
v = value * x[0]
if x[1] > 0:
out[1] = 1
out[0] = v # operand #0 does not dominate this use

Value-returning device functions are affected in the same way, and when the jump does verify there, the function returns whatever the tail computes from values the raise path never set.

Why cuda.coop triggers it

cuda.coop (NVIDIA/cccl#11200) handles cooperative calls today with a whole-function planner that rewrites the kernel before numba-cuda-mlir's type inference, and it compiles the kernel below. We're working toward moving coop's typing onto numba-cuda-mlir's type inference, which leaves the kernel's control flow to numba-cuda-mlir's lowering. There, a cooperative call after a literal_unroll loop hits this bug:

value = 0
for item in literal_unroll((1, 2)):
value += item
coop.store(coop.this_block(), destination, value)

The inlined coop.store adds a branch after the loop, so the store of value sits in the Return block and the unmatched-case raise jumps to it.

What changes

  • lower_static_raise returns from the raise site: gpu.return in a kernel, func.return in a device function. A value-returning device function returns zero values of its result types (from _zero_value_for_type); the error code is what reports the raise, as before.

  • _zero_value_for_type handles generic-address-space memrefs (a zero descriptor through unrealized_conversion_cast, the way NCM builds memrefs from descriptors elsewhere), for device functions that return arrays.

  • The case with no Return block (a raise-only kernel, #52) goes through the same path, as it already did.
  • Behaviour

  • A taken raise no longer runs the code after it. The error code and its readback with debug=True are unchanged.

  • Kernels and device functions whose tail uses a value defined after a raise, including any branching tail after literal_unroll, now compile.

  • A device function returns zeros after a raise instead of whatever its last block computes. As before, the caller isn't stopped; the raise surfaces through the error code.

  • Functions without a raise lower as before: the change is confined to the raise lowering and to a type _zero_value_for_type used to reject.
  • Tests

  • 9 new tests in tests/test_kernel_exceptions.py, all failing on main: the code after a taken raise doesn't run (debug=False and True); a branching tail after a raise and after literal_unroll compiles and computes the right values; a device function with scalar and tuple results raises and returns; device functions returning a 1-D and a 2-D array view compile.

  • Full suite, serially on an RTX PRO 6000 Blackwell (sm_120), Python 3.14: 5161 passed on main, 5170 on this branch (the 9 new tests); 86 skipped and 295 xfailed on both. The one failure, test_cuda_gdb_debug_kernel, also fails on main in this environment. No other test changes outcome.
  • Not in this PR

    Two problems I found while testing are unrelated to this change and also on main:

  • Lowering a call to a non-inlined (inline="never") device function that returns an array doesn't finish (one run grew to 9.8 GB in 12 minutes). It spins in _call_results_tuple, which calls tuple() on the memref result and so iterates the memref's __getitem__. That happens with or without a raise.

  • With debug=True, a kernel with a literal_unroll loop fails in mlirTranslateModuleToLLVMIR.
  • Diff: 149 lines (+137 / -12) across 2 files Reviewer: atmnp Review duration: 21606m
    All Vouch review confidence checks passed
    Residual risk 0.05 = Change Risk (0.34) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 149 lines diff across 2 files
    0.34
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.81 · 5 substantive comment(s)
    0.81
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    85%
    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.300
    Real PR Conversation Timeline
    10 items
    copy-pr-bot[bot] copy-pr-bot[bot] commented on Oct 26, 2026 16:57 UTC
    Bot

    Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

    Contributors can view more details about this message here.

    coderabbitai[bot] coderabbitai[bot] commented on Oct 26, 2026 17:02 UTC
    Bot

    <!-- coderabbit-ai-generated:v1 -->

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- review_stack_entry_start -->

    <a href="https://app.coderabbit.ai/change-stack/NVIDIA/numba-cuda-mlir/pull/407?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>

    <!-- review_stack_entry_end -->
    <!-- walkthrough_start -->

    <details>
    <summary><strong>Walkthrough</strong></summary>
    <dl>
    <dd>
    <br>

    important: Static raises now return directly from the current block and supply zero values for function results. Added tests cover kernel and device-function raise paths.

    Changes: Static Raise Handling

    |Layer / File(s)|Summary|
    |:---|:---|
    |Direct returns and result values <br> src/numba_cuda_mlir/mlir_lowering.py|Static raise lowering emits a GPU or function return with zero values for declared results. Zero-value construction now handles default-memory-space memrefs.|
    |Kernel and device-function coverage <br> tests/test_kernel_exceptions.py|Tests cover raise paths followed by stores and branches, literal-unrolled loops, scalar and tuple results, and array-view returns. They check launch behavior and device-function PTX.|

    Suggested reviewers: jiel-nv

    </dd>
    </dl>
    </details>

    <!-- walkthrough_end -->
    <!-- change_assessment_start -->
    <!-- change_assessment_commit:"8d740f04c1bf7fd9166fc0e33c5ec0e8cda87f63" -->
    <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} -->

    <!-- change_assessment_end -->
    <details>
    <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>8d740</code></summary>
    <dl>
    <dd>
    <br>

    <!-- final_review_risk_start -->
    <!-- final_review_risk_label
    Merge Risk: 🔵 Low · up to 8d740
    -->
    <!-- final_review_risk_coverage:{"sourceCommitId":"8d740f04c1bf7fd9166fc0e33c5ec0e8cda87f63","coveredCommitId":"8d740f04c1bf7fd9166fc0e33c5ec0e8cda87f63","kind":"reviewed"} -->

    The change appears mergeable with awareness that the new array-view tests do not check the zero-valued descriptor produced on a raise.
    <!-- final_review_risk_end -->

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Security architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>8d740</code></summary>
    <dl>
    <dd>
    <br>

    <!-- architecture_review_start -->
    <!-- architecture_review_label

    Security Architecture Review

    Security architecture risk: 🔵 Low · up to 8d740
    -->

    Returning directly fixes execution after a raise. The remaining concern is bounded failure containment: an array-returning device function now produces a null descriptor on failure, while its caller can continue executing. A resulting GPU fault has not been demonstrated, and no broader privilege or data-isolation impact was established.

    Retained concerns

  • Medium · reliability · inferred: The new failure result for an array-returning device function is an all-zero descriptor, but call lowering does not branch on failure before exposing the result to ordinary array consumers. This creates a potential invalid-memory-access path before host exception handling. Caller continuation already existed; the null-descriptor result is the PR-specific change. The resulting runtime fault and recovery impact remain unverified, and documented support currently excludes device-function raises.
  • <details>
    <summary><strong>Security review details</strong></summary>
    <dl>
    <dd>
    <br>

    Security Blast Radius

  • _inferred_ — The identified exposure requires a compiled kernel that calls a raising, array-returning device function and subsequently consumes that result. Data influencing the raise condition could select the path. The supported scope is device-result consumption and the owning CUDA context's error handling; cross-tenant, host-memory, or privilege-escalation impact was not established.
  • Security Findings and Attack Paths

  • _inferred_ — The potential failure path is a data-dependent raise, followed by a null array descriptor, unchecked caller continuation, and ordinary array access before host error observation. Array getitem lowering normalizes negative indices and emits a load without an explicit exception-status guard. This supports a failure-containment concern, not a verified security exploit or demonstrated GPU fault.
  • Trust Boundaries and Controls

  • _observed_ — The relevant boundary is device execution to host error reporting. Host readback remains debug-only and occurs after context synchronization. A synchronization failure returns a runtime error before the normal error-code read and reset, so host reporting is not an in-kernel containment mechanism.
  • Resilience and Maintainability Implications

  • _observed_ — The existing repeated-launch test covers ordinary error-code reset, while the new array test does not launch a consuming caller. Recovery following a possible descriptor-induced device fault therefore remains outside the inspected test coverage.
  • Hardening Proposals

  • _proposed_ — Define and enforce a device-callee failure policy before memory-bearing results can be consumed, such as propagating failure to the caller or rejecting unsupported device-function raises. Validate the chosen policy through a taken array-return raise and subsequent caller access, including host observation and recovery.
  • </dd>
    </dl>
    </details>
    <!-- architecture_review_end -->

    </dd>
    </dl>
    </details>
    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- autopilot:end -->

    coderabbitai[bot] coderabbitai[bot] commented on Oct 26, 2026 17:02 UTC
    Reviewer

    <!-- coderabbit-ai-generated:v1 -->

    <details>
    <summary>🧹 Nitpick comments: 1</summary><blockquote>
    <dl>
    <dd>

    <details>
    <summary>tests/test_kernel_exceptions.py: 1</summary><blockquote>
    <dl>
    <dd>

    272-272: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial · Functional Correctness · Quick win

    suggestion: Assert the output from the negative-input launch.

    For x[0] < 0, both device functions return zero-valued results at the raise site, so k should produce [0, 0] for both debug settings. _launch currently returns this output, but line 272 discards it.

    -    _launch(k, debug, -1, 1)
    +    assert _launch(k, debug, -1, 1) == [0, 0]
    

    <!-- cr-comment:v1:c7c192f177f8a2fc05e98288 -->

    </dd>
    </dl>
    </blockquote></details>

    </dd>
    </dl>
    </blockquote></details>

    ---

    <details>
    <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Review info</summary>
    <dl>
    <dd>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary>
    <dl>
    <dd>

  • Source mode: Auto

  • Repository: [NVIDIA/numba-cuda-mlir](<https://github.com/NVIDIA/numba-cuda-mlir>)

  • Branch: [main](<https://github.com/NVIDIA/numba-cuda-mlir/tree/main>)

  • File: [.coderabbit.yaml](<https://github.com/NVIDIA/numba-cuda-mlir/blob/2c40bb721c8110e9548b9ef33d1716e230170261/.coderabbit.yaml>)

  • Commit: [2c40bb7](<https://github.com/NVIDIA/numba-cuda-mlir/commit/2c40bb721c8110e9548b9ef33d1716e230170261>)

  • Layers: Repository YAML

  • Review profile: CHILL

  • Plan: Enterprise

  • Run ID: 653f4f2e-ba66-426e-967a-1ff8785019c6
  • </dd>
    </dl>
    </details>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary>
    <dl>
    <dd>

    Reviewing files that changed from the base of the PR and between 2c40bb721c8110e9548b9ef33d1716e230170261 and 482bccce1314dec0f5a8848604f9b1846ee64bb0.

    </dd>
    </dl>
    </details>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</summary>
    <dl>
    <dd>

    src/numba_cuda_mlir/mlir_lowering.py
    tests/test_kernel_exceptions.py

    </dd>
    </dl>
    </details>

    Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

    </dd>
    </dl>
    </details>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    <!-- coderabbit-review-publication v1 publication=e635604a-8b02-48c5-b277-f884ffab06f7 attempt=fa70a7d6-c912-4f5b-a7da-aa11f67f3e81 batch=1/1 -->

    atmnp atmnp commented on code on Oct 27, 2026 15:14 UTC
    Code Review
    tests/test_kernel_exceptions.py:1
    @@ -167,3 +169,130 @@ def k():
             # and must not raise.
             k[1, 1]()
             cuda.synchronize()
    +
    +
    +def _launch(kernel, debug, *values):
    +    """Launch ``kernel`` on (out, x); return out and whether the launch raised ValueError."""
    +    out = cuda.to_device(np.zeros(2, dtype=np.int64))
    +    x = cuda.to_device(np.array(values, dtype=np.int64))
    +    raised = False
    +    try:
    +        kernel[1, 1](out, x)
    +        cuda.synchronize()
    +    except ValueError:
    +        raised = True
    +    assert raised == (debug and values[0] < 0)
    +    return out.copy_to_host().tolist()
    +
    +
    +@pytest.mark.parametrize("debug", [False, True])
    +def test_raise_skips_code_after_raise(debug):
    +    """A taken raise returns from the kernel; the store after it does not run."""
    +
    +    @cuda.jit(debug=debug, opt=not debug)
    +    def k(out, x):
    +        if x[0] < 0:
    +            raise ValueError("negative")
    +        out[0] = 5
    +
    +    assert _launch(k, debug, 1, 0) == [5, 0]
    +    assert _launch(k, debug, -1, 0) == [0, 0]
    +
    +
    +@pytest.mark.parametrize("debug", [False, True])
    +def test_raise_before_branching_tail(debug):
    +    """A value defined after the raise and used past a later branch compiles.
    +
    +    The raise used to branch to the last Return block, which here holds
    +    ``out[0] = v``; ``v`` does not dominate the raise, so the module failed to
    +    verify ("operand #0 does not dominate this use").
    +    """
    +
    +    @cuda.jit(debug=debug, opt=not debug)
    +    def k(out, x):
    +        if x[0] < 0:
    +            raise ValueError("negative")
    +        v = x[0] * 2
    +        if x[1] > 0:
    +            out[1] = 1
    +        out[0] = v
    +
    +    assert _launch(k, debug, 3, 0) == [6, 0]
    +    assert _launch(k, debug, 3, 1) == [6, 1]
    +    assert _launch(k, debug, -1, 1) == [0, 0]
    +
    +
    +def test_literal_unroll_before_branching_tail():
    +    """literal_unroll's unmatched-case raise does not break a branching tail."""
    +
    +    @cuda.jit
    +    def k(out, x):
    +        value = 0
    +        for item in literal_unroll((1, 2)):
    +            value += item
    +        v = value * x[0]
    +        if x[1] > 0:
    +            out[1] = 1
    +        out[0] = v
    +
    +    assert _launch(k, False, 2, 1) == [6, 1]
    +
    +
    +@cuda.jit(device=True, inline="never")
    +def _checked_scale(v, flag):
    +    if v < 0:
    +        raise ValueError("negative")
    +    w = v * 2
    +    if flag:
    +        v += 1
    +    return w
    +
    +
    +@cuda.jit(device=True, inline="never")
    +def _checked_pair(v):
    +    if v < 0:
    +        raise ValueError("negative")
    +    w = (v, v * 2.0)
    +    if v > 3:
    +        v += 1
    +    return w
    +
    +
    +@pytest.mark.parametrize("debug", [False, True])
    +def test_raise_in_value_returning_device_function(debug):
    +    """A device function that raises returns from the raise site, for scalar and tuple results."""
    +
    +    @cuda.jit(debug=debug, opt=not debug)
    +    def k(out, x):
    +        out[0] = _checked_scale(x[0], x[1] > 0)
    +        p = _checked_pair(x[0])
    +        out[1] = p[0] + int(p[1])
    +
    +    assert _launch(k, debug, 3, 1) == [6, 9]
    +    _launch(k, debug, -1, 1)

    This negative-input launch checks exception reporting through _launch, but discards the scalar and tuple results produced by the new raise-site return. Assert _launch(k, debug, -1, 1) == [0, 0] so both debug variants also protect the zero-result behavior.

    atmnp atmnp approved these changes on Oct 27, 2026 15:14 UTC
    Approved Reviewer

    Approved these changes.

    atmnp atmnp commented on Nov 10, 2026 15:54 UTC
    Contributor

    /ok to test 1aa8937331c9fd47f207d7f0ae31002e3a45b9dc

    coderabbitai[bot] coderabbitai[bot] commented on Nov 10, 2026 16:05 UTC
    Reviewer

    <!-- coderabbit-ai-generated:v1 -->

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning.svg" width="16" height="16" align="absmiddle" alt=""></picture> Nitpick comments: 1</summary><blockquote>
    <dl>
    <dd>
    <br>

    <details>
    <summary>src/numba_cuda_mlir/mlir_lowering.py: 1</summary><blockquote>
    <dl>
    <dd>
    <br>

    2619-2621: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial · Stability & Availability · Low value

    suggestion: Check the strided descriptor on the raise path.

    The existing sliced-view tests cover compilation, but they do not check the returned descriptor. Add an assertion that the raise path returns a zeroed descriptor for a strided view.

    <!-- cr-comment:v1:300fd59acf59b2faca871b8e -->

    _Source: Path instructions_

    </dd>
    </dl>
    </blockquote></details>

    </dd>
    </dl>
    </blockquote></details>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off.svg" width="16" height="16" align="absmiddle" alt=""></picture> Additional comments: 1</summary><blockquote>
    <dl>
    <dd>
    <br>

    <details>
    <summary>tests/test_kernel_exceptions.py: 1</summary><blockquote>
    <dl>
    <dd>
    <br>

    297-298: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial · Functional Correctness · Low value

    <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg" width="20" height="20" align="absmiddle" alt=""></picture> Unverified finding
    Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

    suggestion: test_raise_in_array_returning_device_function checks only that the PTX contains ret;. Any compiled function passes this check. It does not verify that a raise returns from the raise site.

    Impact: A regression back to the old branch-to-Return lowering that still verifies would pass this test. The test does guard against the verification failure and the hang that the PR names.

    Smallest fix: Keep the test as a compile-only regression. Rename it or its docstring to say so. Alternatively, assert a property that the old lowering did not have.

    _Source: Path instructions_

    </dd>
    </dl>
    </blockquote></details>

    </dd>
    </dl>
    </blockquote></details>

    <h6>
    <details>
    <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary>
    <dl>
    <dd>
    <br>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary>
    <dl>
    <dd>
    <br>

  • Source mode: Auto

  • Repository: [NVIDIA/numba-cuda-mlir](<https://github.com/NVIDIA/numba-cuda-mlir>)

  • Branch: [main](<https://github.com/NVIDIA/numba-cuda-mlir/tree/main>)

  • File: [.coderabbit.yaml](<https://github.com/NVIDIA/numba-cuda-mlir/blob/9ac43be9517fd04a7a539f30c95571bf63f9ecc5/.coderabbit.yaml>)

  • Commit: [9ac43be](<https://github.com/NVIDIA/numba-cuda-mlir/commit/9ac43be9517fd04a7a539f30c95571bf63f9ecc5>)

  • Layers: Repository YAML

  • Review profile: CHILL

  • Plan: Enterprise

  • Run ID: 62a6b771-b873-4bd0-9fd4-342582d6c060
  • </dd>
    </dl>
    </details>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary>
    <dl>
    <dd>
    <br>

    Reviewing files that changed from the base of the PR and between 482bccce1314dec0f5a8848604f9b1846ee64bb0 and 8d740f04c1bf7fd9166fc0e33c5ec0e8cda87f63.

    </dd>
    </dl>
    </details>

    <details>
    <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</summary>
    <dl>
    <dd>
    <br>

    src/numba_cuda_mlir/mlir_lowering.py
    tests/test_kernel_exceptions.py

    </dd>
    </dl>
    </details>

    Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

    </dd>
    </dl>
    </details>
    </h6>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    <!-- coderabbit-review-publication v1 publication=232d16bf-44b0-48ee-ac4f-7c9dab835f75 attempt=0540588b-bf25-4d64-88e3-d197eacba917 batch=1/1 -->

    github-actions[bot] github-actions[bot] commented on Nov 10, 2026 16:05 UTC
    Bot

    Doc Preview CI
    :---:
    | <p></p> :rocket: View preview at <br> https://nvidia.github.io/numba-cuda-mlir/pr-preview/pr-407/ <br><br>
    | <h6><br> Preview will be ready when the GitHub Pages deployment is complete. <br><br></h6>
    <!-- Sticky Pull Request Commentpr-preview -->

    github-actions[bot] github-actions[bot] commented on Nov 10, 2026 17:19 UTC
    Bot

    Doc Preview CI
    :---:
    Preview removed because the pull request was closed or merged.
    <!-- Sticky Pull Request Commentpr-preview -->

    Reviewers
    Assignees
    diptorupd diptorupd
    Labels
    risk: low confidence: 85.9% 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: 34.4% (LOW) · Higher = larger blast radius
    34.4%
    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: 85.9% · Lower = rushed or shallow review
    85.9%
    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: 4.9% · Safe to merge
    4.9%