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.
This commit is contained in:
1 parent
65ce329917
commit
557c2b67c1
1 file changed
+18
@@ -8,14 +8,32 @@
|
||||
// goes through these two.
|
||||
#pragma once
|
||||
#include <sycl/sycl.hpp>
|
||||
#include <sycl/ext/intel/experimental/cache_control_properties.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace strata {
|
||||
using sys_atomic_u32 = sycl::atomic_ref<uint32_t, sycl::memory_order::relaxed, sycl::memory_scope::system>;
|
||||
|
||||
// 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<sycl::ext::intel::experimental::cache_control<
|
||||
sycl::ext::intel::experimental::cache_mode::uncached,
|
||||
sycl::ext::oneapi::experimental::cache_level::L1, sycl::ext::oneapi::experimental::cache_level::L3>>));
|
||||
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<uint32_t, doorbell_uncached_read> u(const_cast<uint32_t*>(p));
|
||||
return u[0];
|
||||
}
|
||||
#else
|
||||
inline uint32_t sys_load(const volatile uint32_t* p) {
|
||||
return sys_atomic_u32(*const_cast<uint32_t*>(p)).load();
|
||||
}
|
||||
#endif
|
||||
inline void sys_store(volatile uint32_t* p, uint32_t v) {
|
||||
sys_atomic_u32(*const_cast<uint32_t*>(p)).store(v);
|
||||
sycl::atomic_fence(sycl::memory_order::release, sycl::memory_scope::system);
|
||||
|
||||
Reference in new issue
Block a user