From 557c2b67c1cc16637f2fffbb45797df0fc56ccb1 Mon Sep 17 00:00:00 2001 From: joeyjoe02 <308000940+joeyjoe02@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:15:05 +0200 Subject: [PATCH] sycl: read doorbell flags with an uncached L1+L3 hint On an Arc Pro B60 a system-scope atomic load of host USM is still served from the GPU's cache, so a device spin never sees the host's store and runs to kSpinMax every time. Read the flag through an annotated_ptr with an uncached L1+L3 read_hint after an acquire fence instead. Bounded ping-pong: 263 ms -> 2.4 us per round trip; per-layer waits on a B60 with experts in the host mirror: 8.7-10.5 -> 19.3 tok/s decode. -DSTRATA_DOORBELL_ATOMIC_LOAD keeps the old load. --- sycl/include/strata/sycl_doorbell.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sycl/include/strata/sycl_doorbell.hpp b/sycl/include/strata/sycl_doorbell.hpp index d801c54e..0690c734 100644 --- a/sycl/include/strata/sycl_doorbell.hpp +++ b/sycl/include/strata/sycl_doorbell.hpp @@ -8,14 +8,32 @@ // goes through these two. #pragma once #include +#include #include namespace strata { using sys_atomic_u32 = sycl::atomic_ref; +// A system-scope atomic load of host USM is still served from the GPU's cache on an Arc Pro B60 (NEO 26.31, +// oneAPI 2026.1.1): a device spin never sees the host's store and runs to kSpinMax every time (bounded host/GPU +// ping-pong: 263 ms per round trip, 168 of 200 waits hit the bound). An explicit uncached L1+L3 read hint goes to +// memory every time: 2.4 us per round trip, 0 of 200. The acquire fence keeps the compiler from hoisting the load +// out of a spin loop. -DSTRATA_DOORBELL_ATOMIC_LOAD restores the atomic load. +#ifndef STRATA_DOORBELL_ATOMIC_LOAD +using doorbell_uncached_read = decltype(sycl::ext::oneapi::experimental::properties( + sycl::ext::intel::experimental::read_hint>)); +inline uint32_t sys_load(const volatile uint32_t* p) { + sycl::atomic_fence(sycl::memory_order::acquire, sycl::memory_scope::system); + sycl::ext::oneapi::experimental::annotated_ptr u(const_cast(p)); + return u[0]; +} +#else inline uint32_t sys_load(const volatile uint32_t* p) { return sys_atomic_u32(*const_cast(p)).load(); } +#endif inline void sys_store(volatile uint32_t* p, uint32_t v) { sys_atomic_u32(*const_cast(p)).store(v); sycl::atomic_fence(sycl::memory_order::release, sycl::memory_scope::system);