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++

hip: fence after the doorbell ring store so the host sees it (#697)

Niko12210f1390bd1111
diff --git a/src/kernels/cuda/elementwise.cu b/src/kernels/cuda/elementwise.cu
index 4817763db..ac78bc325 100644
--- a/src/kernels/cuda/elementwise.cu
+++ b/src/kernels/cuda/elementwise.cu
@@ -209,6 +209,9 @@ void silu_inplace(float* x, int64_t n, void* stream) {
__global__ void doorbell_ring_kernel(uint32_t* seq) {
__threadfence_system();
*(volatile uint32_t*) seq = *(volatile uint32_t*) seq + 1u;
+#if defined(__HIPCC__) // #697: HIP only; on RDNA4 the volatile store alone can sit in L2 until the stream syncs
+ __threadfence_system();
+#endif
}
__global__ void doorbell_wait_kernel(const volatile uint32_t* flag, const volatile uint32_t* seq) {
@@ -302,6 +305,9 @@ __global__ void doorbell_publish_kernel(const float* __restrict__ x, const int32
__syncthreads();
if (threadIdx.x == 0) {
*(volatile uint32_t*) seq = *(volatile uint32_t*) seq + 1u;
+#if defined(__HIPCC__) // #697: HIP only; on RDNA4 the volatile store alone can sit in L2 until the stream syncs
+ __threadfence_system();
+#endif
}
}
@@ -323,6 +329,9 @@ __global__ void doorbell_publish_res_kernel(const float* __restrict__ x, const i
__syncthreads();
if (threadIdx.x == 0) {
*(volatile uint32_t*) seq = *(volatile uint32_t*) seq + 1u;
+#if defined(__HIPCC__) // #697: HIP only; on RDNA4 the volatile store alone can sit in L2 until the stream syncs
+ __threadfence_system();
+#endif
}
}