ADR-1026: R6 SYCL kernel correctness — rd-stride OOB and unchecked graph_wait¶
- Status: Accepted
- Date: 2026-06-04
- Deciders: Lusoris
- Tags:
correctness,sycl
Context¶
Round-6 analysis found two classes of correctness bugs in the SYCL feature extractor paths:
-
VIF rd-downsample stride truncation for odd widths (two locations):
integer_vif_sycl.cpplines 822 and 1313 usee_w / 2as the rd-buffer row stride. Whene_wis odd (e.g. 1279 pixels), integer division truncates:1279 / 2 = 639, but the downsampled row has(1279 + 1) / 2 = 640pixels. The last active thread on that row writes tord_ref[gy/2 * 639 + 639]which is one element into the next row, corrupting the adjacent row's data. The allocation uses the rounded-up formula(w+1)/2 * (h+1)/2; the stride must match. -
Unchecked
vmaf_sycl_graph_wait()return values (three locations):integer_motion_sycl.cpp:610,integer_vif_sycl.cpp:1635, andinteger_adm_sycl.cpp:1559all callvmaf_sycl_graph_wait()(which returnsint) and discard the result. If the SYCL queue throws (device fault or reset), the wait returns a non-zero error code; the extractor then reads stale accumulator memory and emits a wrong score — silently, with no error propagation to the caller.
Decision¶
- Replace
e_w / 2with(e_w + 1u) / 2ufor the rd stride in both VIF SYCL variants (standard SIMD and SIMD-16). - Capture the
vmaf_sycl_graph_wait()return value in all three collect functions and propagate it as an early return.
Alternatives considered¶
| Option | Pros | Cons | Why not chosen |
|---|---|---|---|
Assert e_w % 2 == 0 at launch time | Catches odd widths earlier | Rejects valid odd-width content | VIF must handle arbitrary resolutions |
Consequences¶
- Positive: SYCL VIF scores are correct for odd-width inputs; device-fault errors on the SYCL path are now propagated to the scoring pipeline instead of silently producing stale scores.
- Negative: A device fault now surfaces as a scoring error rather than a stale-but-numeric result. Callers that did not check the
collectreturn value before will now see non-zero returns. - Neutral: No change to the score values for even-width inputs.
References¶
- Round-6 scanner labels:
r6-sycl-kernelx 5 core/src/feature/sycl/integer_vif_sycl.cppcore/src/feature/sycl/integer_motion_sycl.cppcore/src/feature/sycl/integer_adm_sycl.cpp