Skip to content

Commit

Permalink
cpu: x64: brgemm: gemm_microkernel: styling
Browse files Browse the repository at this point in the history
Easier to keep track of branches through if-elseif-else.
  • Loading branch information
dzarukin committed Jan 2, 2025
1 parent 43dae90 commit 0b530f2
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions src/cpu/x64/brgemm/jit_brgemm_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2202,19 +2202,17 @@ void jit_brgemm_kernel_t<Wmm>::gemm_microkernel(int bd_block2, bool is_bdb_tail,
vcvtneeph2ps(vmm_load, addr);
else
vcvtneoph2ps(vmm_load, addr);
} else if (brg.is_f16_b_non_amx_vnni()) {
const auto vnni_addr = ptr[reg_aux_B
+ B_offset(ld, utils::rnd_dn(rd, 2))];
vmovups(vmm_load, vnni_addr);
if (rd % 2 == 0)
vpermw(vmm_load, f16_perm_even_vreg_, vmm_load);
else
vpermw(vmm_load, f16_perm_odd_vreg_, vmm_load);
vcvtph2psx(vmm_load, Vmm_lower_t(vmm_load.getIdx()));
} else {
if (brg.is_f16_b_non_amx_vnni()) {
const auto vnni_addr = ptr[reg_aux_B
+ B_offset(ld, utils::rnd_dn(rd, 2))];
vmovups(vmm_load, vnni_addr);
if (rd % 2 == 0)
vpermw(vmm_load, f16_perm_even_vreg_, vmm_load);
else
vpermw(vmm_load, f16_perm_odd_vreg_, vmm_load);
vcvtph2psx(
vmm_load, Vmm_lower_t(vmm_load.getIdx()));
} else
vcvtph2psx(vmm_load, addr);
vcvtph2psx(vmm_load, addr);
}
} else if (brg.dt_b == data_type::bf16
&& brg.isa_impl == avx2_vnni_2) {
Expand Down Expand Up @@ -2257,21 +2255,18 @@ void jit_brgemm_kernel_t<Wmm>::gemm_microkernel(int bd_block2, bool is_bdb_tail,
vcvtneeph2ps(vmm_load, addr);
else
vcvtneoph2ps(vmm_load, addr);
} else if (brg.is_f16_b_non_amx_vnni()) {
const auto actual_B_offset
= B_offset(ld, utils::rnd_dn(rd, 2));
const auto vnni_addr = ptr[reg_aux_B + actual_B_offset];
vmovups(vmm_load, vnni_addr);
if (rd % 2 == 0)
vpermw(vmm_load, f16_perm_even_vreg_, vmm_load);
else
vpermw(vmm_load, f16_perm_odd_vreg_, vmm_load);
vcvtph2psx(vmm_load, Vmm_lower_t(vmm_load.getIdx()));
} else {
if (brg.is_f16_b_non_amx_vnni()) {
const auto actual_B_offset
= B_offset(ld, utils::rnd_dn(rd, 2));
const auto vnni_addr
= ptr[reg_aux_B + actual_B_offset];
vmovups(vmm_load, vnni_addr);
if (rd % 2 == 0)
vpermw(vmm_load, f16_perm_even_vreg_, vmm_load);
else
vpermw(vmm_load, f16_perm_odd_vreg_, vmm_load);
vcvtph2psx(
vmm_load, Vmm_lower_t(vmm_load.getIdx()));
} else
vcvtph2psx(vmm_load, addr);
vcvtph2psx(vmm_load, addr);
}
} else if (brg.dt_b == data_type::bf16
&& brg.isa_impl == avx2_vnni_2) {
Expand Down

0 comments on commit 0b530f2

Please sign in to comment.