Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

sycl: parity tests wait like cudaMemcpy; drain the refill ring in long prompts

maxfridbe5b1acc00e472
diff --git a/sycl/src/kernels/bf16_gemv_parity.cpp b/sycl/src/kernels/bf16_gemv_parity.cpp
index 519c7618c..0ac26df4c 100644
--- a/sycl/src/kernels/bf16_gemv_parity.cpp
+++ b/sycl/src/kernels/bf16_gemv_parity.cpp
@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_x, x.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(),
x.size() * 2).wait()),
"cx");
/*
@@ -117,23 +117,23 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_w, w.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_w, w.data(),
w.size() * 2).wait()),
"cw");
std::vector<float> naive((size_t) s.n_out), warp((size_t) s.n_out), split((size_t) s.n_out);
strata::kernels::bf16_gemv(d_x, d_w, d_y, s.n_in, s.n_out, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(naive.data(), d_y, naive.size() * 4)
.wait()),
"cy1");
strata::kernels::bf16_gemv_split(d_x, d_w, d_y, s.n_in, s.n_out, 32, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(warp.data(), d_y, warp.size() * 4)
.wait()),
"cy2");
strata::kernels::bf16_gemv_split(d_x, d_w, d_y, s.n_in, s.n_out, 256, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(split.data(), d_y, split.size() * 4)
.wait()),
"cy3");
@@ -163,13 +163,13 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * 2).wait()),
"cx2");
std::vector<float> rival((size_t) s.n_out);
strata::kernels::bf16_gemv(d_x, d_w, d_y, s.n_in, s.n_out, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(rival.data(), d_y, rival.size() * 4)
.wait()),
"cy4");
diff --git a/sycl/src/kernels/cvec_parity.cpp b/sycl/src/kernels/cvec_parity.cpp
index c94491380..189d8e8b4 100644
--- a/sycl/src/kernels/cvec_parity.cpp
+++ b/sycl/src/kernels/cvec_parity.cpp
@@ -44,14 +44,14 @@ pageable, call wait() on event return by memcpy API to ensure synchronization
behavior.
*/
void up(T *d, const std::vector<T> &h) {
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d, h.data(), h.size() * sizeof(T)).wait()),
"up");
}
template <typename T>
std::vector<T> down(const T* d, size_t n) {
std::vector<T> h(n);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h.data(), d, n * sizeof(T))
.wait()),
"down");
diff --git a/sycl/src/kernels/dequant_s2_parity.cpp b/sycl/src/kernels/dequant_s2_parity.cpp
index 0d43eaa07..442f62ba0 100644
--- a/sycl/src/kernels/dequant_s2_parity.cpp
+++ b/sycl/src/kernels/dequant_s2_parity.cpp
@@ -92,7 +92,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"copy codes");
/*
@@ -101,7 +101,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"copy scales");
@@ -109,7 +109,7 @@ int main(int argc, char** argv) {
std::vector<float> gpu(cpu.size());
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gpu.data(), d_out, gpu.size() * sizeof(float))
.wait()),
"copy back");
diff --git a/sycl/src/kernels/elementwise_parity.cpp b/sycl/src/kernels/elementwise_parity.cpp
index 85f7493d4..54f07ca31 100644
--- a/sycl/src/kernels/elementwise_parity.cpp
+++ b/sycl/src/kernels/elementwise_parity.cpp
@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_a, alpha.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_a, alpha.data(), n * 4).wait()),
"ca");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_dt, dt.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_dt, dt.data(), n * 4).wait()),
"cd");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -133,11 +133,11 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_sa, a.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_sa, a.data(), n * 4).wait()),
"cs");
strata::kernels::gdn_gate(d_a, d_dt, d_sa, d_g, 1, H_V, nullptr);
std::vector<float> got((size_t) n);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_g, n * 4)
.wait()),
"cg");
@@ -212,11 +212,11 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_x, x.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(), n * 4).wait()),
"csx");
strata::kernels::silu_inplace(d_x, n, nullptr);
std::vector<float> got((size_t) n);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_x, n * 4)
.wait()),
"csg");
@@ -249,11 +249,11 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_x, x.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(), n * 4).wait()),
"cex");
strata::kernels::scale_inplace(d_x, n, s, nullptr);
std::vector<float> got((size_t) n);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_x, n * 4)
.wait()),
"ceg");
@@ -266,7 +266,7 @@ int main(int argc, char** argv) {
std::vector<uint16_t> h((size_t) n);
check(
DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(h.data(), d_h, n * 2).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(h.data(), d_h, n * 2).wait()),
"ceh");
int hbad = 0;
for (int i = 0; i < n; ++i)
@@ -344,7 +344,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_x, x.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(),
x.size() * 4).wait()),
"c rmsx");
/*
@@ -353,12 +353,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_w, w.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_w, w.data(),
w.size() * 4).wait()),
"c rmsw");
strata::kernels::rms_norm_weighted(d_x, d_w, rows, cols, eps, nullptr);
std::vector<float> got((size_t) (rows * cols));
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_x, got.size() * 4)
.wait()),
"c rmsg");
@@ -392,11 +392,11 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_x, x.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(),
x.size() * 4).wait()),
"c rmsx2");
strata::kernels::rms_norm_weighted(d_x, nullptr, rows, cols, eps, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_x, got.size() * 4)
.wait()),
"c rmsn");
@@ -647,11 +647,11 @@ int main(int argc, char** argv) {
to ensure synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dx, bits.data(), n * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dx, bits.data(), n * 4).wait()),
"bf16 cx");
strata::kernels::f32_to_bf16_bulk(dx, dy, (int64_t) n, nullptr);
std::vector<uint16_t> got(n);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), dy, n * 2)
.wait()),
"bf16 cy");
@@ -681,7 +681,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(db, blk.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(db, blk.data(),
blk.size()).wait()),
"q8 cblk");
strata::kernels::dequant_bf16(8, db, 0, 2, 32, dq, nullptr);
@@ -691,7 +691,7 @@ int main(int argc, char** argv) {
std::vector<uint16_t> q(64);
check(
DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(q.data(), dq, 64 * 2).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(q.data(), dq, 64 * 2).wait()),
"q8 cout");
int dq_wrong = 0;
for (int j = 0; j < 32; ++j) {
diff --git a/sycl/src/kernels/gdn_parity.cpp b/sycl/src/kernels/gdn_parity.cpp
index c749c07f1..16f482287 100644
--- a/sycl/src/kernels/gdn_parity.cpp
+++ b/sycl/src/kernels/gdn_parity.cpp
@@ -188,7 +188,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_st, st_dev.data(), st_dev.size() * 4).wait()),
"cst");
/*
@@ -197,7 +197,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_q, q.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_q, q.data(),
q.size() * 4).wait()),
"cq");
/*
@@ -206,7 +206,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_k, k.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_k, k.data(),
k.size() * 4).wait()),
"ck");
/*
@@ -215,7 +215,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_v, v.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_v, v.data(),
v.size() * 4).wait()),
"cv");
/*
@@ -224,7 +224,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_g, gate.data(), gate.size() * 4).wait()),
"cg");
/*
@@ -233,7 +233,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_b, beta.data(), beta.size() * 4).wait()),
"cb");
@@ -241,12 +241,12 @@ int main(int argc, char** argv) {
strata::kernels::gdn_step(d_st, d_q, d_k, d_v, d_g, d_b, d_o, sh, nullptr);
std::vector<float> got_o((size_t) h_v * S), got_st(st_dev.size());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_o.data(), d_o, got_o.size() * 4)
.wait()),
"cgo");
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_st.data(), d_st, got_st.size() * 4)
.wait()),
"cgst");
@@ -280,7 +280,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_st, zero.data(), zero.size() * 4).wait()),
"z0");
/*
@@ -289,7 +289,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_g, zg.data(), zg.size() * 4).wait()),
"z1");
/*
@@ -298,12 +298,12 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_b, zb.data(), zb.size() * 4).wait()),
"z2");
strata::kernels::gdn_step(d_st, d_q, d_k, d_v, d_g, d_b, d_o, sh, nullptr);
std::vector<float> zz(zero.size());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(zz.data(), d_st, zz.size() * 4)
.wait()),
"z3");
@@ -401,7 +401,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_cs, cs.data(), cs.size() * 4).wait()),
"ccs");
/*
@@ -410,7 +410,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_x, x.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(),
x.size() * 4).wait()),
"ccx");
/*
@@ -419,17 +419,17 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_w, kW.data(), kW.size() * 4).wait()),
"ccw");
strata::kernels::gdn_conv_step(d_cs, d_x, d_w, d_o, C, dc, nullptr);
std::vector<float> got((size_t) C), got_cs(cs.size());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_o, got.size() * 4)
.wait()),
"cgo");
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_cs.data(), d_cs, got_cs.size() * 4)
.wait()),
"cgs");
@@ -483,12 +483,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_x, x.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x, x.data(),
x.size() * 4).wait()),
"lcx");
strata::kernels::gdn_l2_norm(d_x, rows, cols, eps, nullptr);
std::vector<float> got(x.size());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_x, got.size() * 4)
.wait()),
"lcg");
@@ -534,7 +534,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_o, o.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_o, o.data(),
o.size() * 4).wait()),
"nco");
/*
@@ -543,7 +543,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_z, z.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_z, z.data(),
z.size() * 4).wait()),
"ncz");
/*
@@ -552,12 +552,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_sn, sn.data(), sn.size() * 4).wait()),
"ncs");
strata::kernels::gdn_out_norm(d_o, d_z, d_sn, d_y, hv2, S2, eps, nullptr);
std::vector<float> got(y_ref.size());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * 4)
.wait()),
"ncy");
diff --git a/sycl/src/kernels/gr_parity.cpp b/sycl/src/kernels/gr_parity.cpp
index 3df9764c7..b1ff5d5b6 100644
--- a/sycl/src/kernels/gr_parity.cpp
+++ b/sycl/src/kernels/gr_parity.cpp
@@ -203,7 +203,7 @@ int scalar_activation_contract() {
synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_R, ones, sizeof(ones)).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_R, ones, sizeof(ones)).wait()),
"scalar upload R");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
@@ -211,7 +211,7 @@ int scalar_activation_contract() {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_weights, weights,
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_weights, weights,
sizeof(weights)).wait()),
"scalar upload weights");
dpct::queue_ptr stream;
@@ -231,7 +231,7 @@ int scalar_activation_contract() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_norm, gammas, sizeof(gammas)).wait()),
"scalar upload norm");
float mixed_by_mode[3][2] = {}, inject_by_mode[3] = {};
@@ -270,12 +270,12 @@ int scalar_activation_contract() {
check(DPCT_CHECK_ERROR(stream->ext_oneapi_graph(*executable)),
"scalar replay");
check(DPCT_CHECK_ERROR(stream->wait()), "scalar replay sync");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(mixed_by_mode[mode], d_mixed,
2 * sizeof(float))
.wait()),
"scalar mixed copy");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(&inject_by_mode[mode], d_inject,
sizeof(float))
.wait()),
@@ -304,7 +304,7 @@ int scalar_activation_contract() {
const float sentinel = -73.25f;
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(d_inject, &sentinel, sizeof(float))
.wait()),
"scalar sentinel");
@@ -314,12 +314,12 @@ int scalar_activation_contract() {
check(DPCT_CHECK_ERROR(stream->wait()), "scalar final mixer sync");
float final_mixed[2] = {}, untouched = 0.0f;
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(final_mixed, d_mixed, sizeof(final_mixed))
.wait()),
"scalar final mixed");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(&untouched, d_inject, sizeof(float))
.wait()),
"scalar sentinel copy");
@@ -395,7 +395,7 @@ int fused_multi_lds_parity(const float* d_norm, const uint16_t* d_down, const ui
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_r, r.data(), r.size() * sizeof(float)).wait()),
"multi copy R");
/*
@@ -404,7 +404,7 @@ int fused_multi_lds_parity(const float* d_norm, const uint16_t* d_down, const ui
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_bo, bo.data(), bo.size() * sizeof(float)).wait()),
"multi copy bo");
/*
@@ -413,7 +413,7 @@ int fused_multi_lds_parity(const float* d_norm, const uint16_t* d_down, const ui
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_inj, inj.data(), inj.size() * sizeof(float)).wait()),
"multi copy inj");
@@ -447,27 +447,27 @@ int fused_multi_lds_parity(const float* d_norm, const uint16_t* d_down, const ui
s.rs.resize((size_t) T * HC);
s.inject.resize((size_t) T * HC);
s.mixed.resize((size_t) T * N);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(s.r_out.data(), d_r_out,
s.r_out.size() * sizeof(float))
.wait()),
"multi read R_out");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(s.lo.data(), d_lo, s.lo.size() * sizeof(float))
.wait()),
"multi read lo");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(s.rs.data(), d_rs, s.rs.size() * sizeof(float))
.wait()),
"multi read rs");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(s.inject.data(), d_inj_out,
s.inject.size() * sizeof(float))
.wait()),
"multi read inject");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(s.mixed.data(), d_mixed,
s.mixed.size() * sizeof(float))
.wait()),
@@ -682,7 +682,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_R, R.data(), R.size() * sizeof(float)).wait()),
"c R");
/*
@@ -691,7 +691,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_norm, w_norm.data(), w_norm.size() * sizeof(float)).wait()),
"c norm");
/*
@@ -700,7 +700,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_down, q_down.data(), q_down.size() * sizeof(uint16_t)).wait()),
"c down");
/*
@@ -709,7 +709,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_up, q_up.data(), q_up.size() * sizeof(uint16_t)).wait()),
"c up");
/*
@@ -718,7 +718,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_inj, q_inject.data(), q_inject.size() * sizeof(uint16_t)).wait()),
"c inj");
@@ -733,12 +733,12 @@ int main(int argc, char** argv) {
strata::kernels::gr_workspace_init(sh, d_ws_raw, ws);
strata::kernels::gr_read(d_R, d_norm, d_down, d_up, d_inj, eps, sh, ws, d_mixed, d_inject, nullptr);
std::vector<float> got_mixed((size_t) n_embd), got_inject((size_t) hc);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_mixed.data(), d_mixed,
got_mixed.size() * sizeof(float))
.wait()),
"c mixed");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_inject.data(), d_inject,
got_inject.size() * sizeof(float))
.wait()),
@@ -808,12 +808,12 @@ int main(int argc, char** argv) {
strata::kernels::gr_set_fp32_activations(true);
strata::kernels::gr_read(d_R, d_norm, d_down, d_up, d_inj, eps, sh, ws, d_mixed, d_inject, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gm.data(), d_mixed, gm.size() * sizeof(float))
.wait()),
"FP32 mixed");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gi.data(), d_inject, gi.size() * sizeof(float))
.wait()),
"FP32 inject");
@@ -825,12 +825,12 @@ int main(int argc, char** argv) {
if (!ok) ++bad;
strata::kernels::gr_read(d_R, d_norm, d_down, d_up, d_inj, eps, sh, ws, d_mixed, d_inject, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gm.data(), d_mixed, gm.size() * sizeof(float))
.wait()),
"restored mixed");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gi.data(), d_inject, gi.size() * sizeof(float))
.wait()),
"restored inject");
@@ -865,7 +865,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_down_bad, tr_down.data(), tr_down.size() * 2).wait()),
"cb d");
/*
@@ -874,7 +874,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_up_bad, tr_up.data(), tr_up.size() * 2).wait()),
"cb u");
std::vector<float> bad_mixed((size_t) n_embd);
@@ -885,7 +885,7 @@ int main(int argc, char** argv) {
"m bad");
strata::kernels::gr_read(d_R, d_norm, d_down_bad, d_up_bad, d_inj, eps, sh, ws, d_bad, d_inject,
nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(bad_mixed.data(), d_bad,
bad_mixed.size() * sizeof(float))
.wait()),
@@ -902,13 +902,13 @@ int main(int argc, char** argv) {
// ---- the FINAL mixer passes w_inject = nullptr, and then nothing may be written
float sentinel = -12345.0f;
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(d_inject, &sentinel, sizeof(float))
.wait()),
"c sentinel");
strata::kernels::gr_read(d_R, d_norm, d_down, d_up, nullptr, eps, sh, ws, d_mixed, d_inject, nullptr);
float after = 0.0f;
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(&after, d_inject, sizeof(float))
.wait()),
"c after");
@@ -939,7 +939,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_Rw, R.data(), R.size() * sizeof(float)).wait()),
"c Rw");
/*
@@ -948,7 +948,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_bo, block_out.data(), block_out.size() * sizeof(float)).wait()),
"c bo");
/*
@@ -957,13 +957,13 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_zi, zero_inj.data(), zero_inj.size() * sizeof(float)).wait()),
"c zi");
strata::kernels::gr_write(d_Rw, d_bo, d_zi, sh, d_outw, nullptr);
std::vector<float> got_write((size_t) hc_dim);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_write.data(), d_outw,
got_write.size() * sizeof(float))
.wait()),
@@ -1014,11 +1014,11 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_zi, inj.data(), inj.size() * sizeof(float)).wait()),
"c inj2");
strata::kernels::gr_write(d_Rw, d_bo, d_zi, sh, d_outw, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_write.data(), d_outw,
got_write.size() * sizeof(float))
.wait()),
@@ -1095,7 +1095,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dR, rR.data(), rR.size() * 4).wait()),
"crR");
/*
@@ -1104,7 +1104,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dN, rnorm.data(), rnorm.size() * 4).wait()),
"crN");
/*
@@ -1113,7 +1113,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dD, qd.data(), qd.size() * 2).wait()),
"crD");
/*
@@ -1122,7 +1122,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dU, qu.data(), qu.size() * 2).wait()),
"crU");
/*
@@ -1131,7 +1131,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dJ, qi.data(), qi.size() * 2).wait()),
"crJ");
@@ -1147,11 +1147,11 @@ int main(int argc, char** argv) {
select_activation_mode(mode);
strata::kernels::gr_read(dR, dN, dD, dU, dJ, eps, rsh, rws, dM, dI, nullptr);
std::vector<float> gm((size_t) rn), gi((size_t) rhc);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gm.data(), dM, gm.size() * 4)
.wait()),
"cgm");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gi.data(), dI, gi.size() * 4)
.wait()),
"cgi");
diff --git a/sycl/src/kernels/iq_multi_parity.cpp b/sycl/src/kernels/iq_multi_parity.cpp
index 0e9e4426b..8707d4de5 100644
--- a/sycl/src/kernels/iq_multi_parity.cpp
+++ b/sycl/src/kernels/iq_multi_parity.cpp
@@ -46,7 +46,7 @@ T* dalloc(size_t n) {
n * sizeof(T) + 256, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 256).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 256).wait()),
"memset");
return p;
}
@@ -118,13 +118,13 @@ void check_mmvq(int t, int n_in, int n_out, dpct::queue_ptr s,
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dw, w.data(), w.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dw, w.data(), w.size()).wait()),
"w");
// the double reference's weights: the GPU dequantizer (iq_parity checks it against gguf-py)
float* dwf = dalloc<float>((size_t) n_out * n_in);
k::iq_dequant_f32(t, dw, (int64_t) n_out * n_in, dwf, s);
std::vector<float> wf((size_t) n_out * n_in);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(wf.data(), dwf, wf.size() * 4)
.wait()),
"wf");
@@ -138,14 +138,14 @@ void check_mmvq(int t, int n_in, int n_out, dpct::queue_ptr s,
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dx, x.data(), x.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dx, x.data(), x.size() * 4).wait()),
"x");
const size_t xq_bytes = (size_t) max_cols * (n_in / 32) * 36;
uint8_t* dxq = dalloc<uint8_t>(xq_bytes);
k::quantize_q8_1_rows(dx, max_cols, n_in, dxq, s);
std::vector<uint8_t> xq(xq_bytes);
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(xq.data(), dxq, xq_bytes).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(xq.data(), dxq, xq_bytes).wait()),
"xq");
const auto xd = dequant_q8_1(xq, (size_t) max_cols * n_in);
float* dy_old = dalloc<float>((size_t) max_cols * n_out);
@@ -155,11 +155,11 @@ void check_mmvq(int t, int n_in, int n_out, dpct::queue_ptr s,
int bad = 0;
double worst = 0.0;
for (int nc : cols) {
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dy_old, 0xFF, y_old.size() * 4)
.wait()),
"memset");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dy_new, 0xFF, y_new.size() * 4)
.wait()),
"memset");
@@ -168,11 +168,11 @@ void check_mmvq(int t, int n_in, int n_out, dpct::queue_ptr s,
k::iq_set_old_kernels(false);
k::iq_mmvq(t, dw, dxq, dy_new, n_in, n_out, nc, s);
ck(DPCT_CHECK_ERROR(s->wait()), "sync");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(y_old.data(), dy_old, y_old.size() * 4)
.wait()),
"y_old");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(y_new.data(), dy_new, y_new.size() * 4)
.wait()),
"y_new");
@@ -249,7 +249,7 @@ struct Grouped {
by memcpy API to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(db, b.data(), b.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(db, b.data(), b.size()).wait()),
"blob");
blobs.push_back(db);
ptr.push_back((unsigned long long) db);
@@ -265,7 +265,7 @@ struct Grouped {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(dptr, ptr.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dptr, ptr.data(),
ptr.size() * 8).wait()),
"ptr");
/*
@@ -274,11 +274,11 @@ struct Grouped {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dstart, start.data(), start.size() * 4).wait()),
"start");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dn, &n_groups, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dn, &n_groups, 4).wait()),
"n");
if (n_ent) {
/*
@@ -287,7 +287,7 @@ struct Grouped {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
ddst, dst.data(), dst.size() * 4).wait()),
"dst");
/*
@@ -296,7 +296,7 @@ struct Grouped {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
dtok, tok.data(), tok.size() * 4).wait()),
"tok");
}
@@ -309,7 +309,7 @@ struct Grouped {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dx, x.data(), x.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dx, x.data(), x.size() * 4).wait()),
"x");
dxq = dalloc<uint8_t>((size_t) tokens * (H / 32) * 36);
dscr = dalloc<uint8_t>(k::native_expert_scratch_bytes(cap_ent, FF));
@@ -336,12 +336,12 @@ struct Grouped {
k::iq_set_old_kernels(false);
}
std::vector<float> result(bool old, dpct::queue_ptr s) {
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dout, 0xFF, out_floats * 4)
.wait()),
"memset"); // NaN rows: must stay NaN where nothing writes
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dscr, 0,
k::native_expert_scratch_bytes(cap_ent, L.n_ff))
.wait()),
@@ -349,7 +349,7 @@ struct Grouped {
run(old, s);
ck(DPCT_CHECK_ERROR(s->wait()), "sync");
std::vector<float> o(out_floats);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(o.data(), dout, o.size() * 4)
.wait()),
"out");
@@ -411,7 +411,7 @@ void bench(dpct::queue_ptr s, std::mt19937 &rng) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dw, w.data(), w.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dw, w.data(), w.size()).wait()),
"w");
const auto x = random_x((size_t) 8 * n_in, rng);
float* dx = dalloc<float>(x.size());
@@ -422,7 +422,7 @@ void bench(dpct::queue_ptr s, std::mt19937 &rng) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dx, x.data(), x.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dx, x.data(), x.size() * 4).wait()),
"x");
uint8_t* dxq = dalloc<uint8_t>((size_t) 8 * (n_in / 32) * 36);
k::quantize_q8_1_rows(dx, 8, n_in, dxq, s);
diff --git a/sycl/src/kernels/iq_parity.cpp b/sycl/src/kernels/iq_parity.cpp
index 25c83b3c1..1405d9ed5 100644
--- a/sycl/src/kernels/iq_parity.cpp
+++ b/sycl/src/kernels/iq_parity.cpp
@@ -65,12 +65,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- dpct::get_in_order_queue().memcpy(dw, raw.data(), raw.size()).wait();
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dw, raw.data(), raw.size()).wait();
double dq_err = 0.0;
if (strata::kernels::iq_supported(type) && ((size_t) rows * cols) % 256 == 0) {
strata::kernels::iq_dequant_f32(type, dw, (int64_t) rows * cols, dq, s);
std::vector<float> got(ref.size());
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), dq, got.size() * 4)
.wait();
double num = 0, den = 0;
@@ -99,7 +99,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- dpct::get_in_order_queue().memcpy(dx, x.data(), x.size() * 4).wait();
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dx, x.data(), x.size() * 4).wait();
strata::kernels::quantize_q8_1_rows(dx, MC, cols, xq, s);
std::vector<float> y((size_t) MC * rows), yn(y.size());
int multi_bad = 0;
@@ -108,13 +108,13 @@ int main(int argc, char** argv) {
strata::kernels::native_mmvq(type, dw, (const uint8_t*) xq + (size_t) c * cols / 32 * 36,
dy + (size_t) c * rows, cols, rows, 1, s);
s->wait();
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(y.data(), dy, y.size() * 4)
.wait();
for (int nc = 2; nc <= MC; ++nc) {
strata::kernels::native_mmvq(type, dw, xq, dy, cols, rows, nc, s);
s->wait();
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(yn.data(), dy, yn.size() * 4)
.wait();
if (strata::kernels::native_mmvq_multi_exact() &&
diff --git a/sycl/src/kernels/kv_hybrid_parity.cpp b/sycl/src/kernels/kv_hybrid_parity.cpp
index 73ea80caa..cfcde58c0 100644
--- a/sycl/src/kernels/kv_hybrid_parity.cpp
+++ b/sycl/src/kernels/kv_hybrid_parity.cpp
@@ -43,7 +43,7 @@ template <typename T> T* dalloc(size_t n) {
n * sizeof(T) + 64, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 64).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 64).wait()),
"memset");
return p;
}
@@ -84,6 +84,10 @@ void quantize_block_q4_0_host(const float* x, k::block_q4_0& blk) {
} // namespace
int main() {
+ // SYCL port: qsa_prompt_attn's tensor-core (mma.sync PTX) kernel is not ported; on SYCL the prompt attention this
+ // test's last step checks exists as the XMX kernel (opt-in in the engine, where the FP32 fallback is faster).
+ // Test the kernel the port has, unless the caller chose (STRATA_PROMPT_ATTN_XMX=0 shows the refusal).
+ setenv("STRATA_PROMPT_ATTN_XMX", "1", 0);
std::printf("=== Running kv_hybrid_parity test ===\n");
k::QsaShapes s = k::qsa_real_shapes();
s.page_size = 64;
@@ -103,7 +107,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_table, table.data(), pages * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_table, table.data(), pages * 4).wait()),
"table");
std::vector<float> K((size_t) cells * H * D), V((size_t) cells * H * D);
@@ -152,12 +156,12 @@ int main() {
int append_bad = 0, gather_bad = 0;
for (int c = 0; c < cells; ++c) {
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(d_kcur, &K[(size_t)c * H * D], (size_t)H * D * 4)
.wait()),
"kcur");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(d_vcur, &V[(size_t)c * H * D], (size_t)H * D * 4)
.wait()),
"vcur");
@@ -170,7 +174,7 @@ int main() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_step, step, sizeof step).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_step, step, sizeof step).wait()),
"step");
// exactly what qsa_layer's hybrid branch does
k::fwht256_inplace_cuda(d_vcur, H, nullptr);
@@ -189,15 +193,15 @@ int main() {
std::vector<int8_t> hk((size_t) cells * H * D);
std::vector<uint16_t> hks((size_t) cells * H * G);
std::vector<uint8_t> hv4((size_t) cells * H * q4_row);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hk.data(), d_kq, hk.size())
.wait()),
"kq");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hks.data(), d_ks, hks.size() * 2)
.wait()),
"ks");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hv4.data(), d_v4, hv4.size())
.wait()),
"v4");
@@ -232,7 +236,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_ids, ids.data(), cells * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_ids, ids.data(), cells * 4).wait()),
"ids");
int32_t step[k::kStepCount];
k::qsa_step_fill(step, cells - 1, s);
@@ -244,7 +248,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_step, step, sizeof step).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_step, step, sizeof step).wait()),
"step2");
uint16_t *d_ksc = dalloc<uint16_t>((size_t) cells * H * D), *d_vsc = dalloc<uint16_t>((size_t) cells * H * D);
k::kv_gather_q8_step(d_kq, d_kq, d_ks, d_ks, d_table, d_ids, d_step, cells, s, d_ksc, d_ksc, nullptr);
@@ -252,11 +256,11 @@ int main() {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"gather sync");
std::vector<uint16_t> h_ksc((size_t) cells * H * D), h_vsc((size_t) cells * H * D);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_ksc.data(), d_ksc, h_ksc.size() * 2)
.wait()),
"ksc");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_vsc.data(), d_vsc, h_vsc.size() * 2)
.wait()),
"vsc");
@@ -285,7 +289,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_q, q.data(), q.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_q, q.data(), q.size() * 4).wait()),
"q");
k::QsaAttnPools pools;
pools.k_q = d_kq; pools.k_scale = d_ks; pools.v_q4 = d_v4; pools.page_table = d_table;
@@ -296,7 +300,7 @@ int main() {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"attn sync");
std::vector<float> h_attn((size_t) QH * D);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_attn.data(), d_attn, h_attn.size() * 4)
.wait()),
"attn");
@@ -349,7 +353,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_q2, q2.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_q2, q2.data(),
q2.size() * 4).wait()),
"q2");
// the batched kernel indexes ids[z * cap + ...]: one FULL selection per query
@@ -362,7 +366,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ids2, ids2.data(), ids2.size() * 4).wait()),
"ids2");
int32_t* d_steps2 = dalloc<int32_t>(nq * k::kStepCount);
@@ -376,7 +380,7 @@ int main() {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_steps2 + i * k::kStepCount, st2, sizeof st2).wait()),
"steps2");
}
@@ -387,7 +391,7 @@ int main() {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"attn2 sync");
std::vector<float> h_at2((size_t) nq * QH * D);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_at2.data(), d_at2, h_at2.size() * 4)
.wait()),
"at2");
@@ -454,7 +458,7 @@ int main() {
"at4 sync");
std::vector<float> h_at4((size_t) QH * D);
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_at4.data(), d_at4, h_at4.size() * 4)
.wait()),
"at4");
diff --git a/sycl/src/kernels/kv_q4_parity.cpp b/sycl/src/kernels/kv_q4_parity.cpp
index 13d823f15..61d43df4a 100644
--- a/sycl/src/kernels/kv_q4_parity.cpp
+++ b/sycl/src/kernels/kv_q4_parity.cpp
@@ -37,7 +37,7 @@ T* dalloc(size_t n) {
n * sizeof(T) + 64, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 64).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 64).wait()),
"memset");
return p;
}
@@ -121,7 +121,7 @@ int main() {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_src, h_in.data(), h_in.size() * sizeof(float)).wait()),
"memcpy H2D");
@@ -131,7 +131,7 @@ int main() {
std::vector<float> h_out(n_vectors * 256);
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_out.data(), d_dst, h_out.size() * sizeof(float))
.wait()),
"memcpy D2H");
@@ -153,7 +153,7 @@ int main() {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"fwht256_inplace_cuda");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_out.data(), d_dst, h_out.size() * sizeof(float))
.wait()),
"memcpy D2H");
@@ -218,7 +218,7 @@ int main() {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_table, table.data(), pages * sizeof(int32_t)).wait()),
"memcpy table");
@@ -257,7 +257,7 @@ int main() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_step, hstep, sizeof(hstep)).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_step, hstep, sizeof(hstep)).wait()),
"memcpy step");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -265,7 +265,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_kcur, kv.data(), kv.size() * sizeof(float)).wait()),
"memcpy k");
/*
@@ -274,7 +274,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_vcur, vv.data(), vv.size() * sizeof(float)).wait()),
"memcpy v");
@@ -285,11 +285,11 @@ int main() {
// Verify written Q4_0 blocks bitwise against host quantizer
std::vector<uint8_t> h_k_q4(pool_bytes), h_v_q4(pool_bytes);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_k_q4.data(), d_k_q4, pool_bytes)
.wait()),
"memcpy d2h k_q4");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_v_q4.data(), d_v_q4, pool_bytes)
.wait()),
"memcpy d2h v_q4");
@@ -356,7 +356,7 @@ int main() {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ids, ids.data(), max_ids * sizeof(int32_t)).wait()),
"memcpy ids");
@@ -368,7 +368,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_step, hstep, sizeof(hstep)).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_step, hstep, sizeof(hstep)).wait()),
"memcpy step");
k::kv_gather_q4_step(d_k_q4, d_v_q4, d_table, d_ids, d_step, max_ids, s, d_k_scratch, d_v_scratch, nullptr);
@@ -377,12 +377,12 @@ int main() {
std::vector<uint16_t> h_k_scratch((size_t) max_ids * H * D);
std::vector<uint16_t> h_v_scratch((size_t) max_ids * H * D);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_k_scratch.data(), d_k_scratch,
h_k_scratch.size() * sizeof(uint16_t))
.wait()),
"memcpy d2h k_scratch");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_v_scratch.data(), d_v_scratch,
h_v_scratch.size() * sizeof(uint16_t))
.wait()),
diff --git a/sycl/src/kernels/kv_q8_parity.cpp b/sycl/src/kernels/kv_q8_parity.cpp
index 2655b6df4..fbc86113c 100644
--- a/sycl/src/kernels/kv_q8_parity.cpp
+++ b/sycl/src/kernels/kv_q8_parity.cpp
@@ -38,7 +38,7 @@ T *dalloc(size_t n) {
n * sizeof(T) + 64, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 64).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 64).wait()),
"memset");
return p;
}
@@ -60,7 +60,7 @@ int main() {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_table, table.data(), pages * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_table, table.data(), pages * 4).wait()),
"table");
int8_t *kq = dalloc<int8_t>((size_t) cells * H * D), *vq = dalloc<int8_t>((size_t) cells * H * D);
uint16_t *ks = dalloc<uint16_t>((size_t) cells * H * G), *vs = dalloc<uint16_t>((size_t) cells * H * G);
@@ -89,7 +89,7 @@ int main() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(step, hstep, sizeof hstep).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(step, hstep, sizeof hstep).wait()),
"step");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -97,7 +97,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(kcur, kv.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(kcur, kv.data(),
kv.size() * 4).wait()),
"k");
/*
@@ -106,7 +106,7 @@ int main() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(vcur, vv.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(vcur, vv.data(),
vv.size() * 4).wait()),
"v");
k::kv_append_q8_step(kq, vq, ks, vs, d_table, step, kcur, vcur, s, nullptr);
@@ -117,19 +117,19 @@ int main() {
// 1. codes and scales bitwise vs the host reference
std::vector<int8_t> hkq((size_t) cells * H * D), hvq(hkq.size());
std::vector<uint16_t> hks((size_t) cells * H * G), hvs(hks.size());
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hkq.data(), kq, hkq.size())
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hvq.data(), vq, hvq.size())
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hks.data(), ks, hks.size() * 2)
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hvs.data(), vs, hvs.size() * 2)
.wait()),
"d2h");
@@ -171,7 +171,7 @@ int main() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_ids, ids.data(), n_ids * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_ids, ids.data(), n_ids * 4).wait()),
"ids");
int32_t hstep[k::kStepCount] = {0, 0, 0, n_ids};
/*
@@ -181,26 +181,26 @@ int main() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(step, hstep, sizeof hstep).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(step, hstep, sizeof hstep).wait()),
"step");
k::kv_gather_q8_step(kq, vq, ks, vs, d_table, d_ids, step, max_ids, s, k8, v8, nullptr);
k::kv_gather_step(kp, vp, d_table, d_ids, step, max_ids, s, k16, v16, nullptr);
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"gather");
std::vector<uint16_t> a8((size_t) n_ids * H * D), b8(a8.size()), a16(a8.size()), b16(a8.size());
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(a8.data(), k8, a8.size() * 2)
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(b8.data(), v8, b8.size() * 2)
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(a16.data(), k16, a16.size() * 2)
.wait()),
"d2h");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(b16.data(), v16, b16.size() * 2)
.wait()),
"d2h");
diff --git a/sycl/src/kernels/kv_stream_parity.cpp b/sycl/src/kernels/kv_stream_parity.cpp
index 1c5e087b0..9ab9c99a5 100644
--- a/sycl/src/kernels/kv_stream_parity.cpp
+++ b/sycl/src/kernels/kv_stream_parity.cpp
@@ -43,7 +43,7 @@ template <typename T> T* dalloc(size_t n) {
n * sizeof(T) + 64, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 64).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 64).wait()),
"memset");
return p;
}
@@ -141,7 +141,7 @@ bool run(int fmt) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(ident, t.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(ident, t.data(),
n_blocks * 4).wait()),
"ident");
}
@@ -178,7 +178,7 @@ bool run(int fmt) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(kc, hk.data(), hk.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(kc, hk.data(), hk.size() * 4).wait()),
"k");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -187,7 +187,7 @@ bool run(int fmt) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(vc, hv.data(), hv.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(vc, hv.data(), hv.size() * 4).wait()),
"v");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
@@ -196,7 +196,7 @@ bool run(int fmt) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(step, st, sizeof(st)).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(step, st, sizeof(st)).wait()),
"step");
append(ref, ident, step, kc, vc, s, fmt, nullptr);
append(slots, m.page_table, step, kc, vc, s, fmt, &host.p);
@@ -220,7 +220,7 @@ bool run(int fmt) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(ids, hids.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(ids, hids.data(),
hids.size() * 4).wait()),
"ids");
/*
@@ -229,7 +229,7 @@ bool run(int fmt) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(steps, hst.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(steps, hst.data(),
hst.size() * 4).wait()),
"steps");
/*
@@ -239,7 +239,7 @@ bool run(int fmt) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(q, hq.data(), hq.size() * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(q, hq.data(), hq.size() * 4).wait()),
"q");
k::qsa_decode_attn_batch(q, ref.attn(ident), ids, steps, cap, s, scratch, out_ref, n_q, nullptr);
k::kv_stream_resolve(m, slots.attn(m.page_table), host.p, fmt, ids, steps, n_q, cap, s, nullptr);
@@ -247,12 +247,12 @@ bool run(int fmt) {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"batch");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(a.data(), out_ref, (size_t)n_q * NH * D * 4)
.wait()),
"a");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(b2.data(), out_str, (size_t)n_q * NH * D * 4)
.wait()),
"b");
@@ -260,11 +260,11 @@ bool run(int fmt) {
if (bad++ < 5) std::fprintf(stderr, " %s pos %lld n_q %d: streamed attention differs\n", name, (long long) pos, n_q);
}
// the map inverts itself
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(pt.data(), m.page_table, n_blocks * 4)
.wait()),
"pt");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(sb.data(), m.slot_block, n_slots * 4)
.wait()),
"sb");
@@ -303,7 +303,7 @@ bool run(int fmt) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(ids, hids.data(),
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(ids, hids.data(),
hids.size() * 4).wait()),
"ids");
/*
@@ -313,17 +313,17 @@ bool run(int fmt) {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(steps, hst.data(), 16).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(steps, hst.data(), 16).wait()),
"steps");
k::qsa_decode_attn_batch(q, ref.attn(ident), ids, steps, cap, s, scratch, out_ref, 1, nullptr);
k::qsa_decode_attn_batch(q, ring.attn(rt), ids, steps, cap, s, scratch, out_str, 1, nullptr);
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"ring");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(a.data(), out_ref, (size_t)NH * D * 4)
.wait()),
"a");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(b2.data(), out_str, (size_t)NH * D * 4)
.wait()),
"b");
diff --git a/sycl/src/kernels/ple_parity.cpp b/sycl/src/kernels/ple_parity.cpp
index 10cfefaf3..66997602c 100644
--- a/sycl/src/kernels/ple_parity.cpp
+++ b/sycl/src/kernels/ple_parity.cpp
@@ -196,12 +196,12 @@ int history_advance_regression() {
norm_storage = sycl::malloc_device<float>(
(channels + 2 * guard), dpct::get_in_order_queue())),
"history norm allocation");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(history_storage, 0xa5,
(count + 2 * guard) * sizeof(float))
.wait()),
"history guard init");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(norm_storage, 0xa5,
(channels + 2 * guard) * sizeof(float))
.wait()),
@@ -214,7 +214,7 @@ int history_advance_regression() {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
history, expected.data(), count * sizeof(float)).wait()),
"history initial values");
dpct::queue_ptr stream;
@@ -256,7 +256,7 @@ int history_advance_regression() {
"history captured advance");
ck(DPCT_CHECK_ERROR(stream->wait()), "history captured advance sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(actual.data(), history, count * sizeof(float))
.wait()),
"history readback");
@@ -273,12 +273,12 @@ int history_advance_regression() {
if (!overlap_refused || !null_refused) ++bad;
auto guard_ok = [&](float* storage, size_t payload) {
uint8_t before[64], after[64];
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(before, storage, sizeof(before))
.wait()),
"history prefix guard");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(after, storage + guard + payload, sizeof(after))
.wait()),
"history suffix guard");
@@ -770,7 +770,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_nk, cap.w_nk.data(), hcd * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_nk, cap.w_nk.data(), hcd * 4).wait()),
"cnk");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming
@@ -779,7 +779,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_nq, cap.w_nq.data(), hcd * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_nq, cap.w_nq.data(), hcd * 4).wait()),
"cnq");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming
@@ -788,7 +788,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_nc, cap.w_nc.data(), hcd * 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_nc, cap.w_nc.data(), hcd * 4).wait()),
"cnc");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming
@@ -796,7 +796,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_kc, key_codes.data(), key_codes.size()).wait()),
"ckc");
/*
@@ -805,7 +805,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_vb, value_bf16.data(), value_bf16.size() * 2).wait()),
"cvb");
/*
@@ -814,7 +814,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_c1, conv1d_f16.data(), conv1d_f16.size() * 2).wait()),
"cc1");
@@ -836,7 +836,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ks, key_scales.data(), key_scales.size() * 4).wait()),
"cks");
w.key_scales = d_ks;
@@ -866,7 +866,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_emb, cap.emb.data() + (size_t)t * nd, nd * 4).wait()),
"cemb");
/*
@@ -875,7 +875,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_hid, cap.hidden.data() + (size_t)t * hcd, hcd * 4).wait()),
"chid");
/*
@@ -884,7 +884,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_hist, hist_state.data(), (size_t)k::NG_HIST * hcd * 4).wait()),
"chist");
k::PleOut out{};
@@ -899,7 +899,7 @@ int main(int argc, char** argv) {
if (t == 0) {
const size_t bytes = (size_t) k::ple_block_scratch_bytes();
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(ple_ws, 0xa5, bytes).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(ple_ws, 0xa5, bytes).wait()),
"PLE prelaunch guard sentinel");
const struct AliasCase { float* k::PleOut::* field; size_t offset; } cases[] = {
{&k::PleOut::key, 0}, {&k::PleOut::value, hcd}, {&k::PleOut::gate, hcd + nd},
@@ -917,7 +917,7 @@ int main(int argc, char** argv) {
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"PLE guard no-launch sync");
std::vector<uint8_t> sentinel(bytes);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(sentinel.data(), ple_ws, bytes)
.wait()),
"PLE guard sentinel readback");
@@ -930,31 +930,31 @@ int main(int argc, char** argv) {
k::ple_block(d_emb, d_hid, d_hist, w, out, ple_ws, nullptr);
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"ple_block sync");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_key.data(), d_ck, hcd * 4)
.wait()),
"rck");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_value.data(), d_cv, nd * 4)
.wait()),
"rcv");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_gate.data(), d_g, k::NG_HC * 4)
.wait()),
"rg");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_gated.data(), d_gd, hcd * 4)
.wait()),
"rgd");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_norm.data(), d_nm, hcd * 4)
.wait()),
"rnm");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_conv.data(), d_co, hcd * 4)
.wait()),
"rco");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dev_res.data(), d_cr, hcd * 4)
.wait()),
"rcr");
@@ -1015,7 +1015,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_emb, witness.data(), nd * sizeof(float)).wait()),
"native PLE witness");
k::ple_block(d_emb, d_hid, d_hist, w, out, ple_ws, nullptr);
@@ -1024,7 +1024,7 @@ int main(int argc, char** argv) {
"legacy PLE witness sync");
std::vector<float> legacy_value(nd);
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(legacy_value.data(), d_cv, nd * sizeof(float))
.wait()),
"legacy PLE witness value");
@@ -1040,12 +1040,12 @@ int main(int argc, char** argv) {
k::ple_block(d_emb, d_hid, d_hist, w, out, ple_ws, stream);
ck(DPCT_CHECK_ERROR(stream->wait()), "native PLE sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(native_value.data(), d_cv, nd * sizeof(float))
.wait()),
"native PLE value");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(native_result.data(), d_cr, hcd * sizeof(float))
.wait()),
"native PLE result");
@@ -1075,7 +1075,7 @@ int main(int argc, char** argv) {
"native PLE replay");
ck(DPCT_CHECK_ERROR(stream->wait()), "native PLE replay sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_cr, hcd * sizeof(float))
.wait()),
"native PLE replay result");
@@ -1094,7 +1094,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_emb, cap.emb.data(), nd * sizeof(float)).wait()),
"restore PLE embedding");
k::ple_block(d_emb, d_hid, d_hist, w, out, ple_ws, nullptr);
@@ -1102,7 +1102,7 @@ int main(int argc, char** argv) {
dpct::get_current_device().queues_wait_and_throw()),
"restored PLE sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_cr, hcd * sizeof(float))
.wait()),
"restored PLE result");
@@ -1136,11 +1136,11 @@ int main(int argc, char** argv) {
hcd * 4, dpct::get_in_order_queue())),
"native PLE raw projection");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(native_storage, 0xa5, native_bytes + 2 * guard)
.wait()),
"native PLE weight guards");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(q_storage, 0xa5, qbytes + 2 * guard)
.wait()),
"native PLE q8 guards");
@@ -1152,7 +1152,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
native_data, native_key.data(), native_bytes).wait()),
"native PLE weights upload");
k::PleWeights nw = w;
@@ -1166,7 +1166,7 @@ int main(int argc, char** argv) {
stream = dpct::get_current_device().create_queue(true)),
"native PLE key stream");
const size_t workspace_bytes = (size_t) k::ple_block_scratch_bytes();
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(ple_ws, 0xa5, workspace_bytes)
.wait()),
"native PLE no-launch sentinel");
@@ -1190,7 +1190,7 @@ int main(int argc, char** argv) {
ck(DPCT_CHECK_ERROR(stream->wait()), "native PLE refusal sync");
std::vector<uint8_t> sentinel(workspace_bytes);
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(sentinel.data(), ple_ws, workspace_bytes)
.wait()),
"native PLE refusal sentinel");
@@ -1208,13 +1208,13 @@ int main(int argc, char** argv) {
pageable memory. If the memory is not pageable, call wait() on
event return by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_emb, cap.emb.data() + (size_t)p * nd, nd * 4).wait()),
"native PLE key input");
k::native_q2_0_f32(native_data, d_emb, native_q, raw_projection, k::NG_N_EMBD, k::NG_HC_DIM, 1, stream);
ck(DPCT_CHECK_ERROR(stream->wait()), "native PLE raw key sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(projected.data(), raw_projection, hcd * 4)
.wait()),
"native PLE raw key read");
@@ -1228,12 +1228,12 @@ int main(int argc, char** argv) {
ck(DPCT_CHECK_ERROR(stream->wait()),
"native PLE key direct sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(actual_key.data(), d_ck, hcd * 4)
.wait()),
"native PLE key read");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(actual_result.data(), d_cr, hcd * 4)
.wait()),
"native PLE result read");
@@ -1263,7 +1263,7 @@ int main(int argc, char** argv) {
ck(DPCT_CHECK_ERROR(stream->wait()),
"native PLE key replay sync");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_cr, hcd * 4)
.wait()),
"native PLE key replay read");
@@ -1279,12 +1279,12 @@ int main(int argc, char** argv) {
const void* storage = b == 0 ? native_storage : q_storage;
const size_t payload = b == 0 ? native_bytes : qbytes;
std::vector<uint8_t> ends(2 * guard);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(ends.data(), storage, guard)
.wait()),
"native PLE prefix guard");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(ends.data() + guard,
static_cast<const uint8_t *>(storage) +
guard + payload,
@@ -1305,14 +1305,14 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_emb, cap.emb.data(), nd * 4).wait()),
"native PLE restore input");
k::ple_block(d_emb, d_hid, d_hist, w, out, ple_ws, nullptr);
ck(DPCT_CHECK_ERROR(
dpct::get_current_device().queues_wait_and_throw()),
"native PLE default restore sync");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_cr, hcd * 4)
.wait()),
"native PLE default restore read");
@@ -1338,13 +1338,13 @@ int main(int argc, char** argv) {
dpct::get_current_device().queues_wait_and_throw()),
"compact PLE sync");
std::vector<float> compact_norm(hcd), compact_result(hcd);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(compact_norm.data(),
compact.normalized,
hcd * sizeof(float))
.wait()),
"compact PLE normalized");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(compact_result.data(), d_hid,
hcd * sizeof(float))
.wait()),
@@ -1359,7 +1359,7 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_hid, cap.hidden.data(), hcd * sizeof(float)).wait()),
"restore PLE hidden input");
sycl::free(compact_workspace, dpct::get_in_order_queue());
diff --git a/sycl/src/kernels/qsa_parity.cpp b/sycl/src/kernels/qsa_parity.cpp
index 9aaf02cbd..0da7ce0d1 100644
--- a/sycl/src/kernels/qsa_parity.cpp
+++ b/sycl/src/kernels/qsa_parity.cpp
@@ -98,13 +98,13 @@ struct Dev {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
p, v.data(), v.size() * sizeof(T)).wait()),
"H2D");
}
std::vector<T> get(size_t n) const {
std::vector<T> v(n);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(v.data(), p, n * sizeof(T))
.wait()),
"D2H");
@@ -585,7 +585,7 @@ int main(int argc, char** argv) {
strata::kernels::QsaIndexerBuffers bufs{dtail.p, ddead.p, dpooled.p, dblockpos.p};
Dev<float> draw((size_t) IDXD);
for (int64_t t = 0; t < NT; ++t) { // one cell at a time: the tail is a ring and the spare row MOVES
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(draw.p,
&raw_flat[(size_t)t * IDXD],
(size_t)IDXD * 4)
@@ -594,7 +594,7 @@ int main(int argc, char** argv) {
const int32_t tpos = (int32_t) t;
check(
DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dpos.p, &tpos, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dpos.p, &tpos, 4).wait()),
"pos");
strata::kernels::indexer_key_append(draw.p, dpos.p, POS_BASE, dw_kn.p, EPS, bufs, S, dcos.p, dsin.p,
nullptr);
@@ -1059,13 +1059,13 @@ int main(int argc, char** argv) {
Dev<float> draw((size_t) IDXD);
strata::kernels::QsaIndexerBuffers bufs{dptail.p, dpdead.p, dpp.p, dblockpos2.p};
for (int64_t t = 0; t < T; ++t) {
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(draw.p, &praw[(size_t)t * IDXD],
(size_t)IDXD * 4)
.wait()),
"raw");
const int32_t tpos = (int32_t) t;
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dpos2.p, &tpos, 4)
.wait()),
"pos2");
@@ -1389,13 +1389,13 @@ int main(int argc, char** argv) {
// replay A: cells 0..3, which completes block 0
for (int t = 0; t < 4; ++t) {
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(raw2d.p, &raw2[(size_t)t * IDXD2], IDXD2 * 4)
.wait()),
"r2");
const int32_t tp = t;
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(pos2.p, &tp, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(pos2.p, &tp, 4).wait()),
"p2");
check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().ext_oneapi_graph(*ex2)),
"launchA");
@@ -1405,13 +1405,13 @@ int main(int argc, char** argv) {
// replay B: cells 4..7 through the SAME graph, which completes block 1
for (int t = 4; t < 8; ++t) {
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(raw2d.p, &raw2[(size_t)t * IDXD2], IDXD2 * 4)
.wait()),
"r3");
const int32_t tp = t;
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(pos2.p, &tp, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(pos2.p, &tp, 4).wait()),
"p3");
check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().ext_oneapi_graph(*ex2)),
"launchB");
@@ -1494,7 +1494,7 @@ int main(int argc, char** argv) {
for (Dev<float>* dp : {&pooledA, &deadA, &tailA, &pooledB, &deadB, &tailB})
check(
DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dp->p, 0,
dp == &pooledA || dp == &pooledB ? prows * 4
: dp == &deadA || dp == &deadB ? IDXD * 4
@@ -1502,9 +1502,9 @@ int main(int argc, char** argv) {
.wait()),
"zero");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(bposA.p, 0, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(bposA.p, 0, 4).wait()),
"zero");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(bposB.p, 0, 4)
.wait()),
"zero");
@@ -1513,14 +1513,14 @@ int main(int argc, char** argv) {
strata::kernels::QsaIndexerBuffers bufsA{tailA.p, deadA.p, pooledA.p, bposA.p};
strata::kernels::QsaIndexerBuffers bufsB{tailB.p, deadB.p, pooledB.p, bposB.p};
for (int64_t t = 0; t < NB; ++t) { // the sequential side: one cell, its device position
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(draw.p,
&raws[(size_t)t * IDXD],
(size_t)IDXD * 4)
.wait()),
"raw");
const int32_t tp = (int32_t) t;
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(dpos.p, &tp, 4)
.wait()),
"pos");
@@ -1582,7 +1582,7 @@ int main(int argc, char** argv) {
Dev<int32_t> dpos0(1);
const int32_t zero = 0;
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(dpos0.p, &zero, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(dpos0.p, &zero, 4).wait()),
"pos0");
dpct::queue_ptr cs = &dpct::get_in_order_queue();
check(DPCT_CHECK_ERROR(
@@ -1596,20 +1596,20 @@ int main(int argc, char** argv) {
try {
Dev<float> pooled(prows), dd((size_t)IDXD), tail(trows);
Dev<int32_t> bpos(1);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(pooled.p, 0, prows * 4)
.wait()),
"zero");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(dd.p, 0, (size_t)IDXD * 4)
.wait()),
"zero");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(tail.p, 0, trows * 4)
.wait()),
"zero");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(bpos.p, 0, 4).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(bpos.p, 0, 4).wait()),
"zero");
strata::kernels::QsaIndexerBuffers bufs{tail.p, dd.p, pooled.p, bpos.p};
if (native) {
diff --git a/sycl/src/kernels/qsa_prompt_attn_parity.cpp b/sycl/src/kernels/qsa_prompt_attn_parity.cpp
index 42d634d93..f358a4b7c 100644
--- a/sycl/src/kernels/qsa_prompt_attn_parity.cpp
+++ b/sycl/src/kernels/qsa_prompt_attn_parity.cpp
@@ -44,7 +44,7 @@ template <typename T> T* up(const std::vector<T>& h) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d, h.data(), h.size() * sizeof(T)).wait()),
"upload");
return d;
@@ -155,11 +155,11 @@ int run(int fmt, int64_t ctx, int64_t nq, int reps) { // fmt 1 int8, 0 fp16
ck(DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw()),
"run");
std::vector<float> o((size_t) (nq * NH * HD)), nw(o.size());
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(o.data(), d_old, o.size() * 4)
.wait()),
"down");
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(nw.data(), d_new, nw.size() * 4)
.wait()),
"down");
diff --git a/sycl/src/kernels/quantize_act_parity.cpp b/sycl/src/kernels/quantize_act_parity.cpp
index bc11b8540..5b69645b7 100644
--- a/sycl/src/kernels/quantize_act_parity.cpp
+++ b/sycl/src/kernels/quantize_act_parity.cpp
@@ -89,7 +89,7 @@ int run_case(const char* name, const std::vector<float>& x, bool check_bytes) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), (size_t)n * sizeof(float)).wait()),
"copy x");
// PROBE: does the DEVICE hold what the host thinks it sent? The scale byte differs with the SAME
@@ -98,7 +98,7 @@ int run_case(const char* name, const std::vector<float>& x, bool check_bytes) {
{
std::vector<float> rt((size_t) n);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(rt.data(), d_x, (size_t)n * sizeof(float))
.wait()),
"probe copy back");
@@ -108,12 +108,12 @@ int run_case(const char* name, const std::vector<float>& x, bool check_bytes) {
}
strata::kernels::quantize_q8_0(d_x, d_b, n, nullptr);
strata::kernels::dequant_q8_0(d_b, d_back, n, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(g_blocks.data(), d_b, g_blocks.size())
.wait()),
"back blocks");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(g_back.data(), d_back, (size_t)n * sizeof(float))
.wait()),
"back vals");
@@ -221,17 +221,17 @@ int run_case_k(const char* name, const std::vector<float>& x, bool check_bytes,
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), (size_t)n * sizeof(float)).wait()),
"copy x");
strata::kernels::quantize_q8_K(d_x, d_b, n, nullptr);
strata::kernels::dequant_q8_K(d_b, d_back, n, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(g_blocks.data(), d_b, g_blocks.size())
.wait()),
"back blocks");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(g_back.data(), d_back, (size_t)n * sizeof(float))
.wait()),
"back vals");
diff --git a/sycl/src/kernels/rope_parity.cpp b/sycl/src/kernels/rope_parity.cpp
index bec5af5a6..75fb1dc1c 100644
--- a/sycl/src/kernels/rope_parity.cpp
+++ b/sycl/src/kernels/rope_parity.cpp
@@ -125,7 +125,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(float)).wait()),
"copy x");
/*
@@ -134,7 +134,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_cos, hcos.data(), hcos.size() * sizeof(float)).wait()),
"copy cos");
/*
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_sin, hsin.data(), hsin.size() * sizeof(float)).wait()),
"copy sin");
/*
@@ -152,13 +152,13 @@ int main(int argc, char** argv) {
memory is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_pos, pos.data(), pos.size() * sizeof(int)).wait()),
"copy pos");
strata::kernels::rope_neox_apply(d_x, d_out, rows, head_dim, n_rot, d_cos, d_sin, d_pos, nullptr);
std::vector<float> got(ref.size());
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_out, got.size() * sizeof(float))
.wait()),
"back");
@@ -207,19 +207,19 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, e.data(), e.size() * sizeof(float)).wait()),
"copy e");
// position 7, NOT position 0: at pos 0 sin is exactly 0, so dim half legitimately does not move and
// the check would report the correct kernel as wrong. The first version made exactly that mistake.
int p7 = 7;
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(d_pos, &p7, sizeof(int))
.wait()),
"copy p7");
strata::kernels::rope_neox_apply(d_x, d_out, 1, head_dim, n_rot, d_cos, d_sin, d_pos, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(o.data(), d_out, o.size() * sizeof(float))
.wait()),
"back e");
@@ -388,7 +388,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(float)).wait()),
"copy x");
/*
@@ -397,7 +397,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_cos, yc.data(), yc.size() * sizeof(float)).wait()),
"copy ycos");
/*
@@ -406,7 +406,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_sin, ys.data(), ys.size() * sizeof(float)).wait()),
"copy ysin");
/*
@@ -415,13 +415,13 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_pos, pos.data(), pos.size() * sizeof(int)).wait()),
"copy pos");
strata::kernels::rope_neox_apply(d_x, d_out, rows, head_dim, n_rot, d_cos, d_sin, d_pos, nullptr);
std::vector<float> got2(ref2.size());
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got2.data(), d_out, got2.size() * sizeof(float))
.wait()),
"back");
@@ -487,7 +487,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x2, x2.data(), x2.size() * sizeof(float)).wait()),
"copy x2");
/*
@@ -496,7 +496,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_c2, sc.data(), sc.size() * sizeof(float)).wait()),
"copy c2");
/*
@@ -505,7 +505,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_s2, ss.data(), ss.size() * sizeof(float)).wait()),
"copy s2");
/*
@@ -514,7 +514,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_p2, pos2.data(), pos2.size() * sizeof(int)).wait()),
"copy p2");
// The native path demands an explicit stream - a null one is refused by validation, not defaulted.
@@ -527,12 +527,12 @@ int main(int argc, char** argv) {
check(DPCT_CHECK_ERROR(cs5->wait()), "sync5");
std::vector<float> got_t(x2.size()), got_n(x2.size());
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_t.data(), d_t2, got_t.size() * sizeof(float))
.wait()),
"back t2");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_n.data(), d_n2, got_n.size() * sizeof(float))
.wait()),
"back n2");
@@ -559,7 +559,7 @@ int main(int argc, char** argv) {
strata::kernels::native_rope_apply(d_x2, d_n2, nrows, head_dim, n_rot, none5, d_p2, cs5);
check(DPCT_CHECK_ERROR(cs5->wait()), "sync5b");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_n.data(), d_n2, got_n.size() * sizeof(float))
.wait()),
"back n2b");
@@ -571,7 +571,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_c2, nc5.data(), nc5.size() * sizeof(float)).wait()),
"copy c2b");
/*
@@ -580,12 +580,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_s2, ns5.data(), ns5.size() * sizeof(float)).wait()),
"copy s2b");
strata::kernels::rope_neox_apply(d_x2, d_t2, nrows, head_dim, n_rot, d_c2, d_s2, d_p2, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_t.data(), d_t2, got_t.size() * sizeof(float))
.wait()),
"back t2b");
diff --git a/sycl/src/kernels/router_top10_parity.cpp b/sycl/src/kernels/router_top10_parity.cpp
index b94e243a1..d30a47700 100644
--- a/sycl/src/kernels/router_top10_parity.cpp
+++ b/sycl/src/kernels/router_top10_parity.cpp
@@ -84,17 +84,17 @@ int run_case(const char* name, const std::vector<float>& logits, int n_tokens, i
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_l, logits.data(), logits.size() * sizeof(float)).wait()),
"copy");
strata::kernels::router_top10(d_l, n_tokens, n_expert, k, d_ids, d_w, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_ids.data(), d_ids, h_ids.size() * sizeof(int))
.wait()),
"back ids");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_w.data(), d_w, h_w.size() * sizeof(float))
.wait()),
"back w");
diff --git a/sycl/src/kernels/s2_expert_grouped_parity.cpp b/sycl/src/kernels/s2_expert_grouped_parity.cpp
index 2d53dcfc3..e19261cbf 100644
--- a/sycl/src/kernels/s2_expert_grouped_parity.cpp
+++ b/sycl/src/kernels/s2_expert_grouped_parity.cpp
@@ -69,7 +69,7 @@ template <typename T> T* dalloc(size_t n) {
n * sizeof(T) + 256, dpct::get_in_order_queue())),
"malloc");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(p, 0, n * sizeof(T) + 256).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(p, 0, n * sizeof(T) + 256).wait()),
"memset");
return p;
}
@@ -80,13 +80,13 @@ template <typename T> void up(T* d, const std::vector<T>& h) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d, h.data(), h.size() * sizeof(T)).wait()),
"h2d");
}
template <typename T> std::vector<T> down(const T* d, size_t n) {
std::vector<T> h(n);
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h.data(), d, n * sizeof(T))
.wait()),
"d2h");
@@ -170,12 +170,12 @@ bool twice(const char* name, float* d_out, size_t out_floats, const Scratch& s,
const std::function<void()>& call, Run* keep, bool expect_new = true) {
Run r[2];
for (int old = 1; old >= 0; --old) {
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(d_out, 0xA5, out_floats * 4)
.wait()),
"sentinel out");
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memset(s.p, 0x5A, s.bytes).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memset(s.p, 0x5A, s.bytes).wait()),
"sentinel scratch");
k::moe_grouped_select_old(old);
(void) k::moe_grouped_last_path(); // clear
@@ -510,7 +510,7 @@ void check_all() {
to ensure synchronization behavior.
*/
ck(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_x2 + 2, x.data(), XROW).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_x2 + 2, x.data(), XROW).wait()),
"x2");
const int n_hits = 3;
std::vector<int32_t> slot{2, 5, 7}, dst{4, 0, 9};
@@ -554,7 +554,7 @@ void check_all() {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_arena + (size_t)i * STRIDE, fx.hb(i), BLOB).wait()),
"arena");
{
@@ -572,7 +572,7 @@ void check_all() {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_arena + 4 + (size_t)i * BLOB, fx.hb(i), BLOB).wait()),
"arena");
{
@@ -625,7 +625,7 @@ void bench() {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- ck(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ ck(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
fx.d + (size_t)i * BLOB, b.data(), BLOB).wait()),
"blob");
}
diff --git a/sycl/src/kernels/s2_gemv_parity.cpp b/sycl/src/kernels/s2_gemv_parity.cpp
index 2f60eb513..4b6b1fdfd 100644
--- a/sycl/src/kernels/s2_gemv_parity.cpp
+++ b/sycl/src/kernels/s2_gemv_parity.cpp
@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(uint16_t)).wait()),
"copy x");
/*
@@ -139,7 +139,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"copy codes");
/*
@@ -148,7 +148,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"copy scales");
@@ -156,7 +156,7 @@ int main(int argc, char** argv) {
std::vector<float> got((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * sizeof(float))
.wait()),
"copy back");
diff --git a/sycl/src/kernels/s2_gemv_q8_parity.cpp b/sycl/src/kernels/s2_gemv_q8_parity.cpp
index 4f2f89805..3a578322b 100644
--- a/sycl/src/kernels/s2_gemv_q8_parity.cpp
+++ b/sycl/src/kernels/s2_gemv_q8_parity.cpp
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(float)).wait()),
"c x");
/*
@@ -88,7 +88,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"c codes");
/*
@@ -97,7 +97,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"c scales");
@@ -105,7 +105,7 @@ int main(int argc, char** argv) {
// ---- host reference: quantize the activation with the project's own rule, then dot
std::vector<uint8_t> h_act((size_t) (n_in / 32) * 34);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(h_act.data(), d_act, h_act.size())
.wait()),
"c act back");
@@ -139,7 +139,7 @@ int main(int argc, char** argv) {
strata::kernels::s2_gemv_q8(d_act, d_codes, d_scales, d_y_q8, n_in, n_out, tpr, nullptr);
std::vector<float> got((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y_q8, got.size() * sizeof(float))
.wait()),
"c y2");
@@ -203,14 +203,14 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_hx, hx.data(), hx.size() * sizeof(uint16_t)).wait()),
"c hx");
strata::kernels::SForm form{2, -1, 64, strata::kernels::Codebook::Affine, false};
strata::kernels::s_gemv_split(d_hx, d_codes, d_scales, nullptr, d_y_fp16, n_in, n_out, form, tpr);
std::vector<float> y16((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(y16.data(), d_y_fp16, y16.size() * sizeof(float))
.wait()),
"c y1");
diff --git a/sycl/src/kernels/s_gemv_parity.cpp b/sycl/src/kernels/s_gemv_parity.cpp
index 6ebbb46a7..f2ba1f18c 100644
--- a/sycl/src/kernels/s_gemv_parity.cpp
+++ b/sycl/src/kernels/s_gemv_parity.cpp
@@ -252,7 +252,7 @@ void test_q4k(long long n_in, long long n_out, double tol, int* total_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(uint16_t)).wait()),
"copy x");
/*
@@ -261,7 +261,7 @@ void test_q4k(long long n_in, long long n_out, double tol, int* total_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"copy codes");
/*
@@ -270,7 +270,7 @@ void test_q4k(long long n_in, long long n_out, double tol, int* total_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"copy scales");
/*
@@ -279,13 +279,13 @@ void test_q4k(long long n_in, long long n_out, double tol, int* total_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_offsets, offsets.data(), offsets.size() * sizeof(float)).wait()),
"copy offsets");
strata::kernels::s_gemv(d_x, d_codes, d_scales, d_offsets, d_y, n_in, n_out, form);
std::vector<float> got((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * sizeof(float))
.wait()),
"copy back");
@@ -372,7 +372,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(uint16_t)).wait()),
"bench copy x");
/*
@@ -381,7 +381,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"bench copy codes");
/*
@@ -390,7 +390,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"bench copy scales");
@@ -430,7 +430,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
// sums in a different order - so this is a relative comparison, not bit equality.
strata::kernels::s_gemv(d_x, d_codes, d_scales, nullptr, d_y, n_in, n_out, form);
std::vector<float> ref_naive((size_t) n_out);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(ref_naive.data(), d_y,
ref_naive.size() * sizeof(float))
.wait()),
@@ -455,7 +455,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
// correctness of the thing being timed
std::vector<float> got((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * sizeof(float))
.wait()),
"copy split result");
@@ -488,7 +488,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
std::chrono::steady_clock::now() - q0).count());
}
std::sort(qms.begin(), qms.end());
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y,
got.size() * sizeof(float))
.wait()),
@@ -524,7 +524,7 @@ void bench_s2_gemv(long long n_in, long long n_out, int iters, int* split_bad) {
}
std::sort(fms.begin(), fms.end());
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y,
got.size() * sizeof(float))
.wait()),
@@ -669,7 +669,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, x.data(), x.size() * sizeof(uint16_t)).wait()),
"copy x");
/*
@@ -678,7 +678,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"copy codes");
/*
@@ -687,13 +687,13 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * sizeof(float)).wait()),
"copy scales");
strata::kernels::s_gemv(d_x, d_codes, d_scales, nullptr, d_y, n_in, n_out, tc.form);
std::vector<float> got((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * sizeof(float))
.wait()),
"copy back");
diff --git a/sycl/src/kernels/s_gemv_q8k_parity.cpp b/sycl/src/kernels/s_gemv_q8k_parity.cpp
index 315bab4b5..769fbe52c 100644
--- a/sycl/src/kernels/s_gemv_q8k_parity.cpp
+++ b/sycl/src/kernels/s_gemv_q8k_parity.cpp
@@ -128,7 +128,7 @@ int ragged_rows(const Case& cs, long long n_out) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_xf, xf.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_xf, xf.data(),
(size_t)n_in * 4).wait()),
"rcxf");
/*
@@ -137,7 +137,7 @@ int ragged_rows(const Case& cs, long long n_out) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"rcc");
/*
@@ -146,7 +146,7 @@ int ragged_rows(const Case& cs, long long n_out) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * 4).wait()),
"rcs");
/*
@@ -155,16 +155,16 @@ int ragged_rows(const Case& cs, long long n_out) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_offs, offs.data(), offs.size() * 4).wait()),
"rco");
strata::kernels::quantize_q8_K(d_xf, d_xk, n_in, nullptr);
strata::kernels::quantize_q8_0(d_xf, d_x0, n_in, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(xk.data(), d_xk, xk.size())
.wait()),
"rcxk");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(x0.data(), d_x0, x0.size())
.wait()),
"rcx0");
@@ -200,7 +200,7 @@ int ragged_rows(const Case& cs, long long n_out) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_y, sentinel.data(), sentinel.size() * 4).wait()),
"rsent");
if (kind == 0)
@@ -214,7 +214,7 @@ int ragged_rows(const Case& cs, long long n_out) {
"ragged split");
std::vector<uint32_t> got_bits(sentinel.size());
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got_bits.data(), d_y, got_bits.size() * 4)
.wait()),
"rcy");
@@ -302,11 +302,11 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_xf, xf.data(), (size_t)n_in * 4).wait()),
"cxf");
strata::kernels::quantize_q8_K(d_xf, d_xq, n_in, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(xq8k.data(), d_xq, xq8k.size())
.wait()),
"cxq");
@@ -344,7 +344,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_codes, codes.data(), codes.size()).wait()),
"cc");
/*
@@ -353,7 +353,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_scales, scales.data(), scales.size() * 4).wait()),
"cs");
/*
@@ -362,20 +362,20 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_offs, offs.data(), offs.size() * 4).wait()),
"co");
std::vector<float> naive((size_t) n_out), warp((size_t) n_out);
strata::kernels::s_gemv_q8k(d_xq, d_codes, d_scales, cs.has_offset ? d_offs : nullptr, d_y, n_in, n_out,
f, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(naive.data(), d_y, (size_t)n_out * 4)
.wait()),
"cy1");
strata::kernels::s_gemv_q8k_split(d_xq, d_codes, d_scales, cs.has_offset ? d_offs : nullptr, d_y, n_in,
n_out, f, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(warp.data(), d_y, (size_t)n_out * 4)
.wait()),
"cy2");
@@ -402,7 +402,7 @@ int main(int argc, char** argv) {
xq0.size(), dpct::get_in_order_queue())),
"x0");
strata::kernels::quantize_q8_0(d_xf, d_x0, n_in, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(xq0.data(), d_x0, xq0.size())
.wait()),
"cx0");
@@ -425,7 +425,7 @@ int main(int argc, char** argv) {
n_in, n_out, f, nullptr);
std::vector<float> got0((size_t) n_out);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got0.data(), d_y, (size_t)n_out * 4)
.wait()),
"cy0");
@@ -459,14 +459,14 @@ int main(int argc, char** argv) {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x16, x16.data(), (size_t)n_in * 2).wait()),
"cx16");
std::vector<float> fp16out((size_t) n_out);
strata::kernels::s_gemv(d_x16, d_codes, d_scales, cs.has_offset ? d_offs : nullptr, d_y, n_in, n_out,
f);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(fp16out.data(), d_y, (size_t)n_out * 4)
.wait()),
"cy3");
diff --git a/sycl/src/kernels/sampler_parity.cpp b/sycl/src/kernels/sampler_parity.cpp
index 08fef0030..4117ed8d8 100644
--- a/sycl/src/kernels/sampler_parity.cpp
+++ b/sycl/src/kernels/sampler_parity.cpp
@@ -114,13 +114,13 @@ int run(const char* name, const std::vector<float>& logits, int n_tokens, const
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_l, logits.data(), logits.size() * sizeof(float)).wait()),
"copy");
// -1 in every output slot first: a row the kernel leaves unwritten can never match (a verify window reads
// every row, so "no output" is a wrong answer, not a skipped one)
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(d_o, 0xFF, (size_t)n_tokens * sizeof(int))
.wait()),
"fill out");
@@ -135,7 +135,7 @@ int run(const char* name, const std::vector<float>& logits, int n_tokens, const
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_h, hist.data(), hist.size() * sizeof(int)).wait()),
"copy hist");
}
@@ -143,7 +143,7 @@ int run(const char* name, const std::vector<float>& logits, int n_tokens, const
nullptr);
std::vector<int> got((size_t) n_tokens);
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_o, got.size() * sizeof(int))
.wait()),
"back");
@@ -394,7 +394,7 @@ struct DeviceRows {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
l, logits.data(), logits.size() * sizeof(float)).wait()),
"copy");
if (hist_len > 0) {
@@ -408,7 +408,7 @@ struct DeviceRows {
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
h, hist.data(), hist.size() * sizeof(int)).wait()),
"copy hist");
}
@@ -423,7 +423,7 @@ struct DeviceRows {
std::vector<int> sample(const strata::kernels::SamplerParams &p,
dpct::queue_ptr stream) {
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(o, 0xFF, (size_t)n_tokens * sizeof(int))
.wait()),
"fill out");
@@ -432,7 +432,7 @@ struct DeviceRows {
check(DPCT_CHECK_ERROR(stream->wait()), "stream sync");
std::vector<int> got((size_t) n_tokens);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), o, got.size() * sizeof(int))
.wait()),
"back");
@@ -473,7 +473,7 @@ void bench_sampled() {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_l, l.data(), l.size() * sizeof(float)).wait()),
"bench copy");
for (int k : {20, 64}) {
@@ -621,19 +621,19 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_l, l.data(), l.size() * sizeof(float)).wait()),
"c1");
strata::kernels::sample_tokens(d_l, NT, NV, nullptr, 0, a, d_a, nullptr);
strata::kernels::sample_tokens(d_l, NT, NV, nullptr, 0, b, d_b, nullptr);
std::vector<int> ga((size_t) NT), gb((size_t) NT);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(ga.data(), d_a, ga.size() * sizeof(int))
.wait()),
"g1");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(gb.data(), d_b, gb.size() * sizeof(int))
.wait()),
"g2");
@@ -1130,7 +1130,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
input, uniform.data(), uniform.size() * sizeof(float)).wait()),
"counter upload");
strata::kernels::SamplerParams p;
@@ -1138,7 +1138,7 @@ int main(int argc, char** argv) {
strata::kernels::sample_tokens(input, count, vocab, nullptr, 0, p, output, nullptr);
std::vector<int> batch(count), singles(count), repeated(count);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(batch.data(), output, count * sizeof(int))
.wait()),
"counter batch");
@@ -1147,13 +1147,13 @@ int main(int argc, char** argv) {
strata::kernels::sample_tokens(input, 1, vocab, nullptr, 0, one, output + i, nullptr);
}
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(singles.data(), output, count * sizeof(int))
.wait()),
"counter singles");
strata::kernels::sample_tokens(input, count, vocab, nullptr, 0, p, output, nullptr);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(repeated.data(), output, count * sizeof(int))
.wait()),
"counter repeated");
@@ -1388,7 +1388,7 @@ int main(int argc, char** argv) {
cs = dpct::get_current_device().create_queue(true)),
"fixture 18 stream");
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(rows.o, 0xFF, (size_t)T * sizeof(int))
.wait()),
"fixture 18 fill");
@@ -1407,7 +1407,7 @@ int main(int argc, char** argv) {
"instantiate");
for (int replay = 0; replay < 2; ++replay) {
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memset(rows.o, 0xFF, (size_t)T * sizeof(int))
.wait()),
"fixture 18 refill");
@@ -1415,7 +1415,7 @@ int main(int argc, char** argv) {
"graph launch");
check(DPCT_CHECK_ERROR(cs->wait()), "graph sync");
std::vector<int> got((size_t) T);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), rows.o,
got.size() * sizeof(int))
.wait()),
diff --git a/sycl/src/kernels/shared_expert_parity.cpp b/sycl/src/kernels/shared_expert_parity.cpp
index 08e9a44d1..5bf8525da 100644
--- a/sycl/src/kernels/shared_expert_parity.cpp
+++ b/sycl/src/kernels/shared_expert_parity.cpp
@@ -232,7 +232,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_x, hx.data(), hx.size() * sizeof(uint16_t)).wait()),
"c x");
/*
@@ -242,7 +242,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_gc, gc.data(), gc.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_gc, gc.data(), gc.size()).wait()),
"c gc");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
@@ -251,7 +251,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_uc, uc.data(), uc.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_uc, uc.data(), uc.size()).wait()),
"c uc");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
@@ -260,7 +260,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue().memcpy(d_dc, dc.data(), dc.size()).wait()),
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_dc, dc.data(), dc.size()).wait()),
"c dc");
/*
DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
@@ -268,7 +268,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_gs, gs.data(), gs.size() * sizeof(float)).wait()),
"c gs");
/*
@@ -277,7 +277,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_us, us.data(), us.size() * sizeof(float)).wait()),
"c us");
/*
@@ -286,7 +286,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ds, ds.data(), ds.size() * sizeof(float)).wait()),
"c ds");
/*
@@ -295,7 +295,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ginp, ginp.data(), ginp.size() * sizeof(float)).wait()),
"c ginp");
/*
@@ -304,7 +304,7 @@ int main(int argc, char** argv) {
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_xb, hx_bf16.data(), hx_bf16.size() * sizeof(uint16_t)).wait()),
"c xb");
/*
@@ -314,7 +314,7 @@ int main(int argc, char** argv) {
synchronization behavior.
*/
check(
- DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ginpb, hginp_bf16.data(), hginp_bf16.size() * sizeof(uint16_t)).wait()),
"c ginpb");
@@ -340,11 +340,11 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_xf, fx.data(), (size_t)n_embd * 4).wait()),
"cxf");
strata::kernels::quantize_q8_0(d_xf, d_x0, n_embd, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(hx0.data(), d_x0, hx0.size())
.wait()),
"cx0");
@@ -364,7 +364,7 @@ int main(int argc, char** argv) {
d_dc, d_ds, nullptr, d_ginpb, d_scratch, d_out, n_embd, n_ff, tpr, nullptr);
std::vector<float> got((size_t) n_embd);
check(DPCT_CHECK_ERROR(
- dpct::get_in_order_queue()
+ (dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_out, got.size() * sizeof(float))
.wait()),
"c out");
@@ -472,7 +472,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_witness, witness.data(), witness.size() * sizeof(float)).wait()),
"native shared upload x");
auto run = [&](void* stream, const float* x_float = nullptr) {
@@ -485,12 +485,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ginpb, zeros.data(), zeros.size() * sizeof(uint16_t)).wait()),
"zero shared gate");
run(nullptr);
std::vector<float> half_output((size_t) n_embd), legacy((size_t) n_embd), native((size_t) n_embd), replay((size_t) n_embd);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(half_output.data(), d_out,
half_output.size() * sizeof(float))
.wait()),
@@ -501,7 +501,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ginpb, basis.data(), basis.size() * sizeof(uint16_t)).wait()),
"basis shared gate");
/*
@@ -510,12 +510,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_xb, witness_bf16.data(),
witness_bf16.size() * sizeof(uint16_t)).wait()),
"witness shared bf16");
run(nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(legacy.data(), d_out,
legacy.size() * sizeof(float))
.wait()),
@@ -534,7 +534,7 @@ int main(int argc, char** argv) {
"native shared stream");
run(stream, d_witness);
check(DPCT_CHECK_ERROR(stream->wait()), "native shared sync");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(native.data(), d_out,
native.size() * sizeof(float))
.wait()),
@@ -570,7 +570,7 @@ int main(int argc, char** argv) {
check(DPCT_CHECK_ERROR(stream->ext_oneapi_graph(*executable)),
"native shared graph replay");
check(DPCT_CHECK_ERROR(stream->wait()), "native shared graph sync");
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_out,
replay.size() * sizeof(float))
.wait()),
@@ -590,7 +590,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_ginpb, hginp_bf16.data(),
hginp_bf16.size() * sizeof(uint16_t)).wait()),
"restore shared gate");
@@ -600,11 +600,11 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_xb, hx_bf16.data(), hx_bf16.size() * sizeof(uint16_t)).wait()),
"restore shared bf16");
run(nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(replay.data(), d_out,
replay.size() * sizeof(float))
.wait()),
@@ -673,7 +673,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_p, parts.data(), parts.size() * 4).wait()),
"mc cp");
/*
@@ -682,7 +682,7 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(d_w, w.data(),
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(d_w, w.data(),
w.size() * 4).wait()),
"mc cw");
/*
@@ -691,12 +691,12 @@ int main(int argc, char** argv) {
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
*/
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue()).memcpy(
d_s, shared.data(), shared.size() * 4).wait()),
"mc cs");
strata::kernels::moe_combine(d_p, d_w, d_s, d_y, n_embd2, k2, nullptr);
std::vector<float> got((size_t) n_embd2);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * 4)
.wait()),
"mc cy");
@@ -718,7 +718,7 @@ int main(int argc, char** argv) {
// a null `shared` must mean "no shared expert", not "add nothing but leave it undefined"
strata::kernels::moe_combine(d_p, d_w, nullptr, d_y, n_embd2, k2, nullptr);
- check(DPCT_CHECK_ERROR(dpct::get_in_order_queue()
+ check(DPCT_CHECK_ERROR((dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())
.memcpy(got.data(), d_y, got.size() * 4)
.wait()),
"mc cy2");
diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp
index d7c835c42..18881b90b 100644
--- a/sycl/src/program/generate.cpp
+++ b/sycl/src/program/generate.cpp
@@ -5285,6 +5285,7 @@ int main(int argc, char **argv) try {
if (p.lent.empty()) return true;
tr("refill start", (long long) p.lent.size());
const strata::core::OnDevice on(p.dev);
+ size_t queued = 0;
for (const auto& [i, slot] : p.lent) { // D-4: queued, one wait (STRATA_REFILL_BLOCKING=1: each)
const uint8_t* b = srcp->blob(i / g.n_expert, i % g.n_expert);
const int64_t nb = (int64_t) strata::kernels::cpu::expert_layout().blob_bytes(i / g.n_expert);
@@ -5292,6 +5293,8 @@ int main(int argc, char **argv) try {
: p.cache->fill_slot_queued(slot, b, e, nb)))
return false;
host_res[(size_t) i] = slot;
+ // SYCL port: drain before GgufExpertSource's 512-buffer blob ring can wrap onto a queued copy
+ if (!refill_blocking() && ++queued % 256 == 0 && !p.cache->sync_queued(e)) return false;
}
if (!p.cache->sync_queued(e)) return false;
p.lent.clear();
@@ -5905,6 +5908,7 @@ int main(int argc, char **argv) try {
// refill the lent slots from the arena and give them back to the decode tier
if (!lent.empty()) {
const Clock::time_point tr = Clock::now();
+ size_t queued = 0;
for (const auto& [i, slot] : lent) { // D-4: queued, one wait (STRATA_REFILL_BLOCKING=1: each)
const uint8_t* b = srcp->blob(i / g.n_expert, i % g.n_expert);
const int64_t nb = (int64_t) strata::kernels::cpu::expert_layout().blob_bytes(i / g.n_expert);
@@ -5914,6 +5918,13 @@ int main(int argc, char **argv) try {
return 1;
}
host_res[(size_t) i] = slot;
+ // SYCL port: GgufExpertSource::blob() hands out a ring of 512 buffers, valid until the next blob()
+ // call; a queued copy reads its buffer later, so drain before the ring can wrap onto one (938 lent
+ // slots refilled through 512 buffers gave ~426 slots another expert's bytes)
+ if (!refill_blocking() && ++queued % 256 == 0 && !xcache.sync_queued(err)) {
+ std::fprintf(stderr, "strata generate: refilling the lent slots failed: %s\n", err.c_str());
+ return 1;
+ }
}
if (!xcache.sync_queued(err)) {
std::fprintf(stderr, "strata generate: refilling the lent slots failed: %s\n", err.c_str());
diff --git a/sycl/tools/fixups.py b/sycl/tools/fixups.py
index cb786c278..453cd364a 100644
--- a/sycl/tools/fixups.py
+++ b/sycl/tools/fixups.py
@@ -262,3 +262,12 @@ for rel in all_sources():
edit(str(rel), sub(r"\(\(cudaStream_t\)(\w+)\)->", r"strata::q_of(\1)->"))
# 0.1.29: sycl::free takes void*; NativeEmbed frees a const device pointer.
edit("src/core/native_head.cpp", lambda s: s.replace("sycl::free(dev_, dpct::get_in_order_queue())", "sycl::free((void *) dev_, dpct::get_in_order_queue())"))
+
+# 2026-10-01: cudaMemcpy / cudaMemset on the legacy default stream wait for every earlier launch on the device's
+# blocking streams; dpct's `get_in_order_queue().memcpy(...)` does not wait for work on another queue. The parity
+# tests launch on their own queue (`s`, `cs`) and copy results back on the default one, so a slow kernel's output
+# could be read before it finished (iq_multi_parity's IQ2_XS reference, qsa_parity's sequential side). In the tests,
+# every default-queue copy/fill first drains the device's queues - cudaMemcpy's semantics.
+for p in sorted((root / "src" / "kernels").glob("*_parity.cpp")):
+ edit(str(p.relative_to(root)), sub(r"(?<!queues_wait_and_throw\(\), )dpct::get_in_order_queue\(\)(\s*)\.(memcpy|memset)\(",
+ r"(dpct::get_current_device().queues_wait_and_throw(), dpct::get_in_order_queue())\1.\2("))