← Back to Pull requests

Shorten enqueue_barrier and queue_empty loops #1260

Open
unknown opened this pull request with 281 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 10, 2026 12:42 UTC
Author

Summary

oneapi_enqueue_barrier and oneapi_queue_empty keep the device busy with single_task loops of 1M/3M and 10M iterations. This change reduces them to 1000/3000 and 10000 iterations in all builds.

Problem

A single_task kernel is one work-group with one work-item. A GPU that supports only work-group (thread-group) preemption can't preempt it until the whole loop has finished. On Windows, when the OS asks the GPU to preempt and it doesn't respond within TdrDelay (2 s by default), the OS resets the device (TDR). The test then fails with device-lost style errors, for example UR_RESULT_ERROR_OUT_OF_RESOURCES / PI_ERROR_DEVICE_NOT_AVAILABLE and unwritten kernel results.

We see this on Intel GPUs whose default preemption mode is thread-group, e.g. Meteor Lake and Arrow Lake (hw_info_mtl.cpp, hw_info_arl.cpp). The O0/debug variants of both tests fail on most runs there, and so does the optimized queue_empty variant (two chained 10M-iteration kernels, ending with UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS). GPUs with mid-thread preemption (e.g. Panther Lake, hw_info_ptl.cpp) pass. In our measurements on a thread-group-preemption configuration, the O0 enqueue_barrier test passed once TdrDelay was raised to 120 s, but it took about 140 s in total (about 6 µs per loop iteration at O0).

Why the change is safe

  • queue_empty checks !ext_oneapi_empty() only while the event is not complete yet, so a shorter kernel can't make it fail. It just exercises the "not empty" branch less often.

  • enqueue_barrier checks ordering through the barrier, which must hold for any kernel duration. Shorter loops make a broken barrier less likely to be caught, which was accepted in review.

  • With the new counts, every kernel takes well under 0.1 s even at O0.
  • Testing

  • Not built locally. Relying on CI.
  • Diff: 281 lines (+210 / -71) across 3 files Reviewer: bader Review duration: 29939m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 281 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.338
    Real PR Conversation Timeline
    1 comments
    "Review active on #1260"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 39.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 21.1% · Safe to merge
    21.1%