← Back to Pull requests

dpnp: split quickstart and migration by size, cover multi-queue placement and dtype parity #100

Merged
antonwolfy merged 6 files (182 lines) on Nov 19, 2026 02:50 UTC
View on GitHub
antonwolfy antonwolfy commented on Nov 12, 2026 22:20 UTC
Author

What this changes

Redraws three boundaries that #94 set, and fills gaps the routing test found. This is dpnp descriptions plus the body text they now promise:

  • dpnp-quickstart: one NumPy script or hot function moved onto a device belongs here again (#94's "new dpnp code" sent those requests to migration). A whole codebase stays with dpnp-migration. The description also covers whether the arrays are large enough for dpnp to pay off, and hands a device that is not visible to dpnp-troubleshooting. ONEAPI_DEVICE_SELECTOR (pin the CPU or one device without changing code) moves into the body, so the skill that now owns device choice also has the no-code-change answer. Until now only troubleshooting had it.

  • dpnp-memory: arrays on several devices or queues, and where an operation on them runs. The body names the error each kind of operation raises when queues differ: ExecutionPlacementError for element-wise, ValueError for matmul/dot/linalg.solve and for concatenate. It also gives the fixes (sycl_queue=, *_like, to_device()) and what to_device() costs, by SYCL context. No skill covered this before.

  • dpnp-migration: whether a device's default dtype matches NumPy's, probed with has_aspect_fp64 and dpnp.default_float_type(). That includes integer inputs that mean, division or sqrt promote to float32 on devices without fp64. Roundoff in linalg or FFT results is handed to dpnp-linalg-fft.

  • dpnp-linalg-fft: a solve, decomposition or FFT result that differs from NumPy's in the last digits (was: FFT only).

  • dpnp-io: telling whether reading the files, rather than the device compute, limits a job (was in the body only).
  • #94's other boundaries are kept: planning a port is migration, while a call that already failed is troubleshooting; choosing a device, including forcing the CPU, is quickstart. The descriptions are 519–622 characters.

    How it was measured

    90 requests: 10 for each of the 8 dpnp skills, plus 10 near-miss requests whose right answer is xpu-port, cuda-to-xpu-migration or mkl-extension-advisor. They were written without reading the skills. Each dpnp skill has 6 tuning (dev) and 4 held-out (test) requests, and descriptions were tuned on dev only. I reviewed the gold labels as dpnp maintainer. Then I moved three dev labels to the #94 boundaries I accept above; no test label changed.

    Each request went through the full 35-skill catalog (names and descriptions only), 3 repeats, with Claude Sonnet 5.5 and Claude Haiku 5.5. That's dokimi's all-vs-all routing.

    Share of picks that chose the gold skill:

    | | before #94 (e7f1757) | main (7a7dc38) | this PR |
    |---|---|---|---|
    | Sonnet, test | 0.89 | 0.86 | 0.95 |
    | Sonnet, all 90 | 0.87 | 0.88 | 0.94 |
    | Haiku, test | 0.87 | 0.84 | 0.89 |
    | Haiku, all 90 | 0.89 | 0.86 | 0.89 |

    The overall change against main is not significant: per request, Sonnet has 7 better and 1 worse (sign test p = 0.07), Haiku 10 better and 6 worse (p = 0.45). Gold or an acceptable alternative stays at 0.96–1.00 in every version. So this PR's claim is the requests below, not a percentage gain.

    Fixed, in all repeats of both models:

    | Request | Split | main picks | this PR |
    |---|---|---|---|
    | Smallest change to make my existing NumPy script run on my Intel Arc GPU | dev | migration | quickstart |
    | One NumPy function on the GPU, checked against NumPy | test | migration | quickstart |
    | Two GPUs: an array on each, each operation where its data is | dev | quickstart | memory |
    | An element-wise operation fails with a placement error on one GPU | test | troubleshooting | memory |

    Kept: forcing the CPU without code changes goes to quickstart, and same values and dtypes as NumPy goes to migration.

    Held-out checks that the new wording doesn't over-reach (test requests, none of their words in any description; the test requests are not quoted here, so they stay held out):

  • a float32 matmul tolerance question stays on linalg-fft;

  • listing the SYCL devices stays on quickstart;

  • two slowness questions stay on troubleshooting.
  • Known misses, not fixed here:

  • Which hardware dpnp runs on (test, a non-Intel GPU): no description says it. Reported as a held-out miss; no dev request covers it.

  • Translating CuPy's current-device idiom (test, gold migration): Haiku sends it to quickstart, whose body gives the same answer (no ambient device, pass device=). Acceptable on the merits; I didn't change its alternative after seeing the picks.

  • Haiku only, 1–3 repeats each: a masked-array/datetime64 port question goes to dpnp-random, and a fallback-wrapper timing question goes to quickstart. Haiku's repeats agree on 0.98 of picks.
  • Caveats:

  • The labels were set after reading the pre-#94 skills, so "before #94" starts with an advantage.

  • No test request covers dtype parity or read-versus-compute timing, so those two changes rest on dev requests only.

  • The ONEAPI_DEVICE_SELECTOR renumbering and the two-GPU to_device() view (peer access) are not checked on a two-GPU machine. The text hedges the first and states the second from the dpnp source.
  • Checklist

  • I checked description against requests a user would really type — see CONTRIBUTING.md.

  • python3 tools/validate_skills.py passes locally.
  • Diff: 182 lines (+144 / -38) across 6 files Reviewer: vchamarthi Review duration: 8910m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.65) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.65 · 182 lines diff across 6 files
    0.65
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.96 · 1 substantive comment(s)
    0.96
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    89%
    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.312
    Sensitive Paths sensitive_paths
    0.065
    Real PR Conversation Timeline
    5 items
    xaleryb xaleryb commented on Nov 12, 2026 23:51 UTC
    Reviewer

    Ran the new claims on dpnp 0.21.0 / dpctl 0.23.0 from PyPI on a CPU SYCL device. The six queue-mismatch errors match the text word for word, device= sharing one cached queue, _like and sycl_queue=x.sycl_queue inheriting it, the reduce-then-move example, to_device returning a view inside one context, the fp64 probe, and SYCL_DEVICE_FILTER having no effect all hold.

    One command does not: after pip install dpnp in a venv, ONEAPI_DEVICE_SELECTOR=opencl:cpu python my_script.py leaves no device at all, and the first array raises SyclDeviceCreationError: Default device is unavailable; ONEAPI_DEVICE_SELECTOR=':cpu' keeps opencl:cpu:0. With a backend named, the UR loader opens libOpenCL.so.1 from intel-opencl-rt, which has no RUNPATH, so libsvml.so beside it is not found (UR_LOG_LOADER=level:debug;output:stderr shows it). Not checked on a conda install. Either *:cpu in the example or a line saying so would fix it; dpnp-troubleshooting already has the same line on main, so the same change there would keep them aligned.

    vchamarthi vchamarthi approved these changes on Nov 18, 2026 00:51 UTC
    Approved Reviewer

    🟢 Approved · reviewed d92a448

    Next: nothing required from @antonwolfy.

    Verified on d92a448: ✅ full suite with main merged in: 101 passed · ✅ merges onto main
    <details><summary>3 checks behind it, each with its evidence</summary>

    | Area | What holds | How |
    |---|---|---|
    | Description length | The five changed descriptions are 519 (io), 562 (linalg-fft), 561 (memory), 622 (migration) and 611 (quickstart) characters, under the 1024 limit in CONTRIBUTING.md | full suite, main merged in |
    | Repository checks | validate_skills.py, run_evals.py --validate and tools/tests exit 0 with the PR merged onto main | full suite, main merged in |
    | Merge | The branch merges onto current main without conflict | merge onto main |

    </details>

    antonwolfy antonwolfy commented on Nov 19, 2026 00:14 UTC
    Author

    Confirmed, thanks. With dpnp 0.21.0 / dpctl 0.23.0 from PyPI (runtime wheels 2026.2.0), any selector that names only the opencl backend finds no device. libsycl.so.9 opens the wheel's libOpenCL.so.1, which needs libsvml.so but has no RUNPATH. Only the Level Zero adapter loads libsvml.so first, and such a selector skips it. Conda installs work with every selector.

    Both quickstart lines and the dpnp-troubleshooting one now use '*:cpu', with one sentence on both conditions. The selector bug is reported to the compiler runtime team.

    xaleryb xaleryb approved these changes on Nov 19, 2026 02:50 UTC
    Approved Reviewer

    Approving at 7951437: the quickstart and troubleshooting selector examples now use ONEAPI_DEVICE_SELECTOR=':cpu'. I reproduced the change on dpnp 0.21.0 from PyPI in a CPU SYCL image: opencl:cpu finds no device, :cpu finds opencl:cpu:0. Earlier review points are resolved.

    Reviewers
    Assignees
    antonwolfy antonwolfy
    Labels
    risk: low confidence: 89.6% reviewed sensitive_module
    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: 64.7% (MEDIUM) · Higher = larger blast radius
    64.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: 89.6% · Lower = rushed or shallow review
    89.6%
    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: 6.7% · Safe to merge
    6.7%
    Repository