diff --git a/tests/cuda/prefill_mmq_kquant_test.cpp b/tests/cuda/prefill_mmq_kquant_test.cpp index 38e0a41e..aa54ad47 100644 --- a/tests/cuda/prefill_mmq_kquant_test.cpp +++ b/tests/cuda/prefill_mmq_kquant_test.cpp @@ -95,6 +95,9 @@ void product(mmq::Context& ctx, cudaStream_t s, const char* name, ggml_type t, i ck(cudaMemcpy(db.p, bounds.data(), bounds.size() * 4, cudaMemcpyHostToDevice), "bounds"); ck(cudaMemcpy(dw.p, w.data(), w.size(), cudaMemcpyHostToDevice), "w"); ck(cudaMemset(dy.p, 0xff, (size_t) rows * (size_t) out_rows * 4), "sentinel"); + // the copies and the sentinel above run on the legacy stream, which a non-blocking stream does not wait for: a + // pageable cudaMemcpy/cudaMemset can still be in flight when the kernels start (a 128-SM 4090 caught it) + ck(cudaDeviceSynchronize(), "inputs"); mmq::quantize((const float*) dx.p, (const int32_t*) dsrc.p, dxq.p, (int) t, cols, cols, rows, s); mmq::Product p; p.w = dw.p; p.type = (int) t; p.w_rows = out_rows; p.w_cols = cols; p.expert_bytes = eb; p.n = n;