IQ4_XS's AVX-2 kernel on AVX-2 CPUs only; native_expert_parity skips the AVX-512 check it has no kernel for (#415 follow-up)
- The engine's `avx2` switch is on for AVX-512 CPUs too, so the widened gate sent an AVX-512 CPU's IQ4_XS gate/up rows to the new AVX-2 kernel instead of ggml-cpu: other rounding on CPUs that #415 did not mean to change. A format with only an AVX-2 kernel now takes it on CPUs without AVX-512; everything else is dispatched as before. - native_expert_parity ran its AVX-512 check for IQ4_XS on an AVX-512 CPU: iq512_rows has no case for it, so the rows stayed zero and the check failed. Each check runs only for the formats its kernel implements; the AVX-2 one runs on AVX-512 CPUs too, so this PC tests the new kernel.
This commit is contained in:
1 parent
3ce93f90fe
commit
e4ed23fc17
2 files changed
+8
-5
No files matched your search
@@ -98,9 +98,11 @@ void native_gu_rows(const NativeFmt& f, const uint8_t* blob, const void* const*
|
||||
kq256_gu_rows(f.gu_type, blob, f.gu_row, f.up_off, (int) f.n_embd, act, nt, ff, r0, r1);
|
||||
return;
|
||||
}
|
||||
if (nt >= mt_min && (iq512_supported(f.gu_type) || iq256_supported(f.gu_type))) {
|
||||
// each kernel only for the formats it implements: IQ4_XS has an AVX-2 one and no AVX-512 one, and
|
||||
// falling through an empty switch would leave ff unwritten instead of falling back to ggml-cpu.
|
||||
// A format with only an AVX-2 kernel (IQ4_XS, #415) takes it on AVX-2 CPUs only: an AVX-512 CPU keeps ggml-cpu for
|
||||
// it, as before (its rows would round differently). Each kernel only for the formats it implements: falling
|
||||
// through an empty switch would leave ff unwritten instead of falling back to ggml-cpu.
|
||||
static const bool cpu512 = cpu_avx512_ok();
|
||||
if (nt >= mt_min && (iq512_supported(f.gu_type) || (!cpu512 && iq256_supported(f.gu_type)))) {
|
||||
if (avx512 && iq512_supported(f.gu_type)) {
|
||||
iq512_gu_rows(f.gu_type, blob, f.gu_row, f.up_off, (int) f.n_embd, act, nt, ff, r0, r1);
|
||||
return;
|
||||
|
||||
@@ -145,8 +145,9 @@ int check_blob(const cpu::NativeFmt& f, const std::vector<uint8_t>& blob, int se
|
||||
tag, us1, 2.0 * f.up_off / us1 / 1e3, usg, 2.0 * f.up_off / usg / 1e3);
|
||||
std::printf(" gate+up %d tokens one thread: %s %.0f us vs ggml %d x %.0f us\n", NT, tag, usn, NT, usg);
|
||||
};
|
||||
if (cpu::cpu_avx512_ok()) check("avx512", true); // guarded: the binary runs on AVX-2 CPUs too
|
||||
check("avx2", false);
|
||||
// guarded: the binary runs on AVX-2 CPUs too, and IQ4_XS has no AVX-512 kernel (an empty switch)
|
||||
if (cpu::cpu_avx512_ok() && cpu::iq512_supported(f.gu_type)) check("avx512", true);
|
||||
if (cpu::iq256_supported(f.gu_type)) check("avx2", false);
|
||||
}
|
||||
for (int k = 0; k < NT; ++k) {
|
||||
cpu::native_quant_h(f, ff[k].data(), hq[k].data());
|
||||
|
||||
Reference in new issue
Block a user