libxe2: mtp_couple_verify reads a row's candidates staged in local memory

The helper's walk over the 1024-slot candidate row (mostly pads) was a dependent global load
a step; a work-group stages the row first and the helper reads it there, arithmetic unchanged.
Seeded coupled decode 98.3 -> 98.5 tok/s, the same draft trajectory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-11-02 07:55:08 +01:00
1 parent 8f84939aa2
commit b9fdfc0a79
1 file changed
+28 -1
+28 -1
View File
@@ -29,8 +29,35 @@ int mtp_couple_verify(const RadArgs* a, RadStream st) {
if (c.M <= 0) return RAD_OK;
sycl::queue* q = queue_of(st);
if (!q) return RAD_E_DEVICE;
if (c.n_cand > 4096)
return submit([&] {
q->parallel_for(sycl::range<1>{(size_t)c.M}, [=](sycl::id<1> i) { rad_mtp_couple_verify_row(c, (int64_t)i[0]); });
});
/* A row's candidates (n_cand 1024, mostly pads behind top_k) staged in local memory by a
* work-group first: the helper's walk over them from global memory was a dependent load a
* step. The helper then reads the staged row (its row pitch 0), arithmetic unchanged. */
constexpr size_t wg = 256;
const int64_t n = c.n_cand;
return submit([&] {
q->parallel_for(sycl::range<1>{(size_t)c.M}, [=](sycl::id<1> i) { rad_mtp_couple_verify_row(c, (int64_t)i[0]); });
q->submit([&](sycl::handler& h) {
sycl::local_accessor<int32_t, 1> sid(sycl::range<1>((size_t)n), h);
sycl::local_accessor<float, 1> sv(sycl::range<1>((size_t)n), h);
h.parallel_for(sycl::nd_range<1>{(size_t)c.M * wg, wg}, [=](sycl::nd_item<1> it) {
const int64_t row = (int64_t)it.get_group(0);
const int64_t lane = (int64_t)it.get_local_id(0);
for (int64_t i = lane; i < n; i += (int64_t)wg) {
sid[i] = c.idx[row * c.ld[0] + i];
sv[i] = c.val[row * c.ld[1] + i];
}
sycl::group_barrier(it.get_group());
if (lane != 0) return;
RadMtpCoupleVerifyCall cc = c;
cc.idx = sid.template get_multi_ptr<sycl::access::decorated::no>().get();
cc.val = sv.template get_multi_ptr<sycl::access::decorated::no>().get();
cc.ld[0] = cc.ld[1] = 0;
rad_mtp_couple_verify_row(cc, row);
});
});
});
}