Archived
libxe2: w2a8 head stages its activation with every load before the local stores -- 2.81 -> 2.55 ms
The pair-a-step staging loaded through a generic pointer after each local store, one round trip an iteration. Same arithmetic; greedy text and speculative round count unchanged (rad-kbench has no recipe for the shape). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
1b2cc6d826
commit
70e50f4758
1 file changed
+24
@@ -328,6 +328,8 @@ int zp_dpas(sycl::queue& q, const int8_t* ab, int64_t ars, const char* sab, uint
|
||||
int64_t group, int mm) {
|
||||
const int64_t G = K / group;
|
||||
const size_t wgs = (size_t)((N + 16 * kZpDpasSgs - 1) / (16 * kZpDpasSgs));
|
||||
const bool stage16 = K % 16 == 0 && 8 * (K / 16) <= 16 * kZpDpasSgs * kSub && ars % 16 == 0 &&
|
||||
rad_ptr_aligned(ab, 16);
|
||||
return submit([&] {
|
||||
q.submit([&](sycl::handler& h) {
|
||||
/* the activation as A columns: at[(k / 2) * 8 + m] is the pair (a[m][k], a[m][k + 1]) */
|
||||
@@ -337,6 +339,28 @@ int zp_dpas(sycl::queue& q, const int8_t* ab, int64_t ars, const char* sab, uint
|
||||
const sycl::sub_group sg = it.get_sub_group();
|
||||
const int s = (int)sg.get_group_linear_id(), lane = (int)sg.get_local_linear_id();
|
||||
const int t = (int)it.get_local_id(0);
|
||||
if (stage16) {
|
||||
/* a lane 16 bytes of a row (8 pairs) at a time, every load issued before the
|
||||
* first local store: `ab` is a generic pointer, so a load after a local store
|
||||
* waits for it, and the pair a step form ran 80 round trips a work-group */
|
||||
constexpr int kPer = 16; /* items a lane: K <= kPer * 256 * 8 / 8 */
|
||||
const int64_t items = 8 * (K / 16); /* (row m, 8-pair block) */
|
||||
sycl::vec<uint16_t, 8> v[kPer];
|
||||
#pragma unroll
|
||||
for (int u = 0; u < kPer; ++u) {
|
||||
const int64_t idx = t + (int64_t)u * kZpDpasSgs * kSub;
|
||||
const int64_t m = idx % 8, kb8 = idx / 8;
|
||||
v[u] = idx < items && m < mm ? *(const sycl::vec<uint16_t, 8>*)(ab + m * ars + 16 * kb8)
|
||||
: sycl::vec<uint16_t, 8>(0);
|
||||
}
|
||||
#pragma unroll
|
||||
for (int u = 0; u < kPer; ++u) {
|
||||
const int64_t idx = t + (int64_t)u * kZpDpasSgs * kSub;
|
||||
if (idx >= items) break;
|
||||
const int64_t m = idx % 8, kb8 = idx / 8;
|
||||
for (int e = 0; e < 8; ++e) At[(kb8 * 8 + e) * 8 + m] = v[u][e];
|
||||
}
|
||||
} else
|
||||
for (int64_t i = t; i < 4 * K; i += kZpDpasSgs * kSub) {
|
||||
const int64_t m = i % 8, kp = i / 8;
|
||||
uint16_t v = 0;
|
||||
|
||||
Reference in new issue
Block a user