From 5010e1d0838ab6dacb7b875017b1856833d3a681 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 25 Oct 2026 11:13:28 +0100 Subject: [PATCH] libxe2: gdn recurrent update issues its state loads before the local stores -- 234 -> 166 us a call The state pointer is generic, so IGC ordered every load behind the preceding local store and the 128 loads of a row block each paid a full memory round trip. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1 --- libxe2/xe2_gdn.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libxe2/xe2_gdn.cpp b/libxe2/xe2_gdn.cpp index 1e0376e1..2919c097 100644 --- a/libxe2/xe2_gdn.cpp +++ b/libxe2/xe2_gdn.cpp @@ -1628,10 +1628,15 @@ int launch_recurrent_reg_t(sycl::queue& qu, const RecIO& r, int64_t n_seq, float float st[K]; auto load_rows = [&](int64_t slot) { if constexpr (COAL) { + /* every load issued before the first local store: the state pointer is + * generic, so a load after a local store waits for it, and interleaved + * the 128 loads ran one memory latency each */ const float* base = (const float*)sp + at4(r.stv, slot, h, e0, 0); + float ld[kCb * K / kSub]; + for (int i = 0; i < kCb * K / kSub; ++i) ld[i] = base[i * kSub + l]; for (int i = 0; i < kCb * K / kSub; ++i) { const int idx = i * kSub + l; - tr[(idx / K) * (K + 1) + idx % K] = base[idx]; + tr[(idx / K) * (K + 1) + idx % K] = ld[i]; } sycl::group_barrier(sg); for (int d = 0; d < K; ++d) st[d] = tr[l * (K + 1) + d];