tests : declare the generic DT3 vec_dot weak in the parity test
Builds without a native DT3 kernel rename the generic symbol to ggml_vec_dot_dt3_q8_0 (arch-fallback.h), so test-dt3 failed to link on them. With a weak declaration the test links everywhere and skips, loudly, when there is no separate generic to compare against. MSVC has no weak symbols, so there the test is compiled out.
This commit is contained in:
+20
-4
@@ -479,10 +479,15 @@ static int test_vec_dot(const ggml_type_traits_cpu * qfns_cpu) {
|
||||
return num_failed;
|
||||
}
|
||||
|
||||
// the scalar reference implementation, always compiled into ggml-cpu; on
|
||||
// architectures without a native kernel the dispatched vec_dot IS this
|
||||
// function and the parity test below passes trivially
|
||||
extern "C" void ggml_vec_dot_dt3_q8_0_generic(int n, float * s, size_t bs, const void * vx, size_t bx, const void * vy, size_t by, int nrc);
|
||||
// the scalar reference implementation. The symbol only exists on builds with
|
||||
// a native DT3 kernel: without one, arch-fallback.h renames the generic to
|
||||
// ggml_vec_dot_dt3_q8_0 and there is nothing to compare against, so the
|
||||
// reference is declared weak and the parity test skips when it is absent.
|
||||
#if defined(_MSC_VER)
|
||||
#define DT3_NO_WEAK_SYMBOLS
|
||||
#else
|
||||
extern "C" void ggml_vec_dot_dt3_q8_0_generic(int n, float * s, size_t bs, const void * vx, size_t bx, const void * vy, size_t by, int nrc) __attribute__((weak));
|
||||
#endif
|
||||
|
||||
// the dispatched (possibly vectorized) vec_dot must match the generic scalar
|
||||
// implementation exactly — the actual function is called, not a re-derivation
|
||||
@@ -492,6 +497,16 @@ extern "C" void ggml_vec_dot_dt3_q8_0_generic(int n, float * s, size_t bs, const
|
||||
static int test_vec_dot_arch_parity(const ggml_type_traits_cpu * qfns_cpu) {
|
||||
int num_failed = 0;
|
||||
|
||||
#if defined(DT3_NO_WEAK_SYMBOLS)
|
||||
(void) qfns_cpu;
|
||||
printf("(skipping vec_dot arch parity: no weak symbol support)\n");
|
||||
return num_failed;
|
||||
#else
|
||||
if (ggml_vec_dot_dt3_q8_0_generic == nullptr) {
|
||||
printf("(skipping vec_dot arch parity: this build has no separate generic vec_dot)\n");
|
||||
return num_failed;
|
||||
}
|
||||
|
||||
const auto * vdot_traits = ggml_get_type_traits_cpu(qfns_cpu->vec_dot_type);
|
||||
|
||||
const int nblocks = 3;
|
||||
@@ -560,6 +575,7 @@ static int test_vec_dot_arch_parity(const ggml_type_traits_cpu * qfns_cpu) {
|
||||
}
|
||||
|
||||
return num_failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
// --dequant IN.bin OUT.f32 : dequantize raw DT3 blocks, for parity checks
|
||||
|
||||
Reference in New Issue
Block a user