Skip to content

Commit 5f3af68

Browse files
xuxinzendzarukin
authored andcommitted
fixup: cpu: x64: brgemm: fix handling big offsets
1 parent c9affbf commit 5f3af68

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/cpu/x64/brgemm/jit_brgemm_kernel.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,12 +2380,18 @@ void jit_brgemm_kernel_t<Wmm>::gemm_microkernel(dim_t bd_block2,
23802380
= B_offset(prefetch_count_B++, rd)
23812381
+ static_cast<dim_t>(brg.LDB) * brg.rd_block
23822382
* brg.typesize_B;
2383-
if (is_superset(brg.isa_impl, avx512_core)) {
2384-
prefetcht0(EVEX_compress_addr_safe(reg_aux_B,
2385-
prefetch_offset, reg_tmp_microkernel));
2383+
// Only use EVEX_compress_addr_safe/make_safe_addr
2384+
// when prefetch_offset > INT_MAX forr perf purpose
2385+
if (prefetch_offset <= INT_MAX) {
2386+
prefetcht0(ptr[reg_aux_B + prefetch_offset]);
23862387
} else {
2387-
prefetcht0(make_safe_addr(reg_aux_B, prefetch_offset,
2388-
reg_tmp_microkernel));
2388+
if (is_superset(brg.isa_impl, avx512_core)) {
2389+
prefetcht0(EVEX_compress_addr_safe(reg_aux_B,
2390+
prefetch_offset, reg_tmp_microkernel));
2391+
} else {
2392+
prefetcht0(make_safe_addr(reg_aux_B,
2393+
prefetch_offset, reg_tmp_microkernel));
2394+
}
23892395
}
23902396
}
23912397
for (dim_t ld = 0; ld < ld_block2; ld++) {

0 commit comments

Comments
 (0)