← Back to Pull requests

[offload][OpenMP][NFC] Add a default-grid run to the no-loop tests #229677

Open
nicebert opened this pull request with 60 lines diff across 2 files
View on GitHub
nicebert nicebert commented on Oct 07, 2026 07:31 UTC
Author

Add a run without OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT to show the
kernels are promoted with the runtime's default grid as well.

Diff: 60 lines (+58 / -2) across 2 files Reviewer: ro-i Review duration: 84639m
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.36) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 60 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.74 · 5 substantive comment(s)
0.74
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
80%
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.246
Real PR Conversation Timeline
8 items
llvmorg-github-actions[bot] llvmorg-github-actions[bot] commented on Oct 07, 2026 07:32 UTC
Bot

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-offload

Author: Nicole Aschenbrenner (nicebert)

<details>
<summary>Changes</summary>

Add a run without OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT to show the
kernels are promoted with the runtime's default grid as well.

---
Full diff: https://github.com/llvm/llvm-project/pull/229677.diff

2 Files Affected:

  • (modified) offload/test/offloading/fortran/target-no-loop.f90 (+9)

  • (modified) offload/test/offloading/target-no-loop.c (+9)
  • ``````

    diff --git a/offload/test/offloading/fortran/target-no-loop.f90 b/offload/test/offloading/fortran/target-no-loop.f90
    index 99c02acdc2567..c5d9ff1fbf9fe 100644
    --- a/offload/test/offloading/fortran/target-no-loop.f90
    +++ b/offload/test/offloading/fortran/target-no-loop.f90
    @@ -3,6 +3,7 @@
     
     ! RUN: %libomptarget-compile-fortran-generic -O3  -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription
     ! RUN: env LIBOMPTARGET_INFO=16 OMP_NUM_TEAMS=16 OMP_TEAMS_THREAD_LIMIT=16 %libomptarget-run-generic 2>&1 | %fcheck-generic
    +! RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT
     function check_errors(array) result (errors)
        integer, intent(in) :: array(1024)
        integer :: errors
    @@ -95,3 +96,11 @@ end program main
     ! CHECK:  info: #Args: 4 Teams x Thrds:   16x  16 {{.*}}
     ! CHECK:  number of errors: 0
     
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} Generic mode
    +! DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +! DEFAULT:  number of errors: 0
    +
    diff --git a/offload/test/offloading/target-no-loop.c b/offload/test/offloading/target-no-loop.c
    index 8407cffc13020..7b056d004ef71 100644
    --- a/offload/test/offloading/target-no-loop.c
    +++ b/offload/test/offloading/target-no-loop.c
    @@ -3,6 +3,7 @@
     
     // RUN: %libomptarget-compile-generic -O3 -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription
     // RUN: env LIBOMPTARGET_INFO=16 OMP_NUM_TEAMS=16 OMP_TEAMS_THREAD_LIMIT=16 %libomptarget-run-generic 2>&1 | %fcheck-generic
    +// RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT
     // REQUIRES: gpu
     // XFAIL: intelgpu
     
    @@ -89,3 +90,11 @@ int main(void) {
     // CHECK:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
     // CHECK:  info: #Args: 3 Teams x Thrds:   16x  16 {{.*}}
     // CHECK:  number of errors: 0
    +
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} Generic-SPMD mode
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
    +// DEFAULT:  number of errors: 0
    
    
    ``````

    </details>

    ro-i ro-i commented on Oct 08, 2026 09:38 UTC
    Contributor

    can you also add the checklines containing Teams x Thrds for the default case? Otherwise, it's not checked for the num_threads(64) case if it's taking effect correctly (because with OMP_TEAMS_THREAD_LIMIT=16, the 16 takes precedence)

    nicebert nicebert commented on Oct 08, 2026 15:41 UTC
    Author

    can you also add the checklines containing Teams x Thrds for the default case? Otherwise, it's not checked for the num_threads(64) case if it's taking effect correctly (because with OMP_TEAMS_THREAD_LIMIT=16, the 16 takes precedence)

    I added the checks for the cases where specific team or thread counts are expected by the test.

    ro-i ro-i approved these changes on Oct 14, 2026 14:07 UTC
    Approved Reviewer

    Approved these changes.

    dhruvachak dhruvachak commented on code on Oct 14, 2026 18:26 UTC
    Code Review
    offload/test/offloading/target-no-loop.c:1
    @@ -89,3 +90,14 @@ int main(void) {
     // CHECK:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
     // CHECK:  info: #Args: 3 Teams x Thrds:   16x  16 {{.*}}
     // CHECK:  number of errors: 0
    +
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode

    I don't think it is testing everything it should. The execution mode is checked. But whether the correct runtime team/thread selection path is taken is not because this test cannot distinguish between the SPMD and the No-Loop paths in the runtime.

    I suggest a large enough tripcount for the No-Loop case that over-subscribes a device, e.g. 1M. Then extract the team and thread counts from the debug trace and CHECK that their product >= tripcount.

    The existing Fortran test has the same problem.

    nicebert nicebert commented on code on Oct 19, 2026 15:49 UTC
    Code Review
    offload/test/offloading/target-no-loop.c:1
    @@ -89,3 +90,14 @@ int main(void) {
     // CHECK:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD mode
     // CHECK:  info: #Args: 3 Teams x Thrds:   16x  16 {{.*}}
     // CHECK:  number of errors: 0
    +
    +// DEFAULT:  omptarget device {{[0-9]+}} info: Launching kernel {{.*}} SPMD-No-Loop mode

    I added a no-loop kernel with a trip count of 1000000 to both the C and the Fortran test. Both runs now take the team and thread counts from the trace and check that their product covers the trip count, which a plain SPMD launch with the default grid doesn't.

    dhruvachak dhruvachak approved these changes on Oct 21, 2026 03:26 UTC
    Approved Reviewer

    LGTM

    Reviewers
    Assignees
    nicebert nicebert
    Labels
    risk: low confidence: 80.3% 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: 36% (MEDIUM) · Higher = larger blast radius
    36%
    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: 80.3% · Lower = rushed or shallow review
    80.3%
    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: 7.1% · Safe to merge
    7.1%