diff --git a/libxe2/xe2_gdn.cpp b/libxe2/xe2_gdn.cpp index 3bb47982..dc10c023 100644 --- a/libxe2/xe2_gdn.cpp +++ b/libxe2/xe2_gdn.cpp @@ -626,13 +626,15 @@ int gdn_chunk_scan(const RadArgs* a, RadStream st) { sycl::queue* qu = queue_of(st); if (!qu) return RAD_E_DEVICE; if (K == 128 && V % 32 == 0 && chunk == 64 && !std::getenv("XE2_GDN_SCAN1")) { - /* A work-group of 256 a (sequence, v head, block of 32 value columns), the chunk's k, q, + /* A work-group of 1024 a (sequence, v head, block of 32 value columns), the chunk's k, q, * the block's slices of v, S, W, V' and the sA rows R in local memory (~124 KB). Each phase * of a chunk is a set of independent chains -- W[j][e], V'[i][e], R[i][j], O[i][e], S[d][e] * -- each run by one work-item in libref's order, so the scan is libref's; the parallelism * is the chains' (thousands a phase), not one column a work-item. R and the decays depend - * only on q, k, g, so each column block forms them again. */ - constexpr int CB = 32, CK = 64, KK = 128, WG = 256; + * only on q, k, g, so each column block forms them again. Its ~124 KB of local memory + * leaves one work-group a Xe core, so the work-group is the core's 1024 work-items: 256 + * left three quarters of its threads idle (2.68 -> 0.92 s over a 1882-token prefill). */ + constexpr int CB = 32, CK = 64, KK = 128, WG = 1024; constexpr int KP = KK + 1; /* k and q rows padded: the R phase's lanes read different rows */ const int64_t nblk = V / CB; /* e^{g_i - g_j} for every (row i, chunk position j <= i of i's chunk), libref's double exp