decode_cluster_parity: wait for every upload before the graph replays and timings use it (#548, as #536)

Dev::put uploads with a pageable cudaMemcpy, which can return before its DMA lands, and the graph replays and the
timing cases run on a cudaStreamNonBlocking stream that does not wait for the legacy stream: the graph could read
the previous replay's logits (one argmax token off; 5 of 6 replays on an RTX 5060 Ti, now and then on a 5090).
Dev::put now synchronizes the device after its copy, which covers run_graph_case and bench(). Test only; no engine
code.
This commit is contained in:
Niko1221 committed 2026-10-03 01:57:12 +02:00
1 parent 40ae2d1e80
commit 94705a1463
1 file changed
+3
+3
View File
@@ -58,6 +58,9 @@ template <typename T> struct Dev {
~Dev() { cudaFree(p); }
void put(const std::vector<T>& h) {
ck(cudaMemcpy(p, h.data(), h.size() * sizeof(T), cudaMemcpyHostToDevice), "up");
// #548 #536: a pageable cudaMemcpy can return before its DMA lands, and the graph replays and the timing
// cases run on a cudaStreamNonBlocking stream that does not wait for the legacy stream - so wait here
ck(cudaDeviceSynchronize(), "up landed");
}
std::vector<T> get() const {
std::vector<T> h(n);