simde icon indicating copy to clipboard operation
simde copied to clipboard

How to run a specific test?

Open junaruga opened this issue 2 years ago • 5 comments

Related to the contributing document , I thought if I knew the way to run a specific test, it would be useful to debug or report. Is there a way to do it?

  1. How to run only tests for a specific family? e.g. How to run tests for only roundscale in simde_avx512_families in meson.build (top level).

  2. How to run a specific test? e.g. How to run only test_simde_mm_cvt_ps2pi in test/x86/sse.c?

Thanks.

junaruga avatar Aug 02 '21 21:08 junaruga

For NEON, the test definition makes it such that I can do meson test -C build-cross 'arm/neon/ld1/native/c' to run a single test file (ld1.c).

Looking at the x86 test setup, it looks like you can only run per SSE extension. So I don't think you can do that.

ngzhian avatar Aug 05 '21 16:08 ngzhian

Btw, you can use meson test --list to list all tests, here is a snippet:

x86/avx512/xorsign/emul/c                                                                                                                                                                                                                                     (37 results) [1036/8790]
x86/avx512/xorsign/native/c
x86/avx512/xorsign/emul/cpp
x86/avx512/xorsign/native/cpp
x86/mmx/emul/c
x86/mmx/native/c
x86/mmx/emul/cpp
x86/mmx/native/cpp
x86/sse/emul/c
x86/sse/native/c
x86/sse/emul/cpp
x86/sse/native/cpp
x86/sse2/emul/c

So for SSE/SSE2, you cannot run an individual test. But for AVX512, you an run just xorsign or roundscale tests.

ngzhian avatar Aug 05 '21 17:08 ngzhian

Zhi's answer is correct, but here is a little more info which may help:

Using meson to run a single test works, but the disadvantage is that it will actually compile everything. You can also use ninja to compile a single test and it will only compile that test ninja test/x86/avx512/roundscale-native-c (for the native C version, you can use ninja test/x86/avx512/roundscale-{native,emul}-{c,cpp} to test all four versions).

I often use this during development; my go-to is something like: INSN=x86/avx512/roundscale; ninja test/$INSN-{native,emul}-c && qemu-aarch64-static ./test/$INSN-native-c && qemu-aarch64-static ./test/$INSN-emul-c

If you're using Meson you have to run all the tests in a specific suite. On x86 prior to AVX-512 that can be pretty annoying since all the (for example) SSE2 tests are in a single suite, but for AVX-512 as well as most other architectures the tests are broken up by function instead of ISA extension, so for example you can use test/x86/avx512/roundscale-native-c to test the AVX-512 roundscale functions.

Honestly, the tests are really all fast enough that running a single suite shouldn't really be a problem (SVML is, IMHO, the only real possible exception), but if if you use CMake then the test suite uses µnit which is capable of running a single test (just pass the test name as an argument to run-tests). One of the many drawbacks, though, is that everything has to be compiled and linked, which is pretty much guaranteed to take longer than running the tests.

nemequ avatar Aug 06 '21 13:08 nemequ

Zhi's answer is correct, but here is a little more info which may help:

Hey Evan. Can you copy this information into the docs or a wiki page?

mr-c avatar Aug 06 '21 14:08 mr-c

Sorry for my late response, and thanks for your info. I will take a look at it!

junaruga avatar Aug 24 '21 21:08 junaruga