SUMMARY OF CHANGES
This patch aims to reduce test duplication and to improve code re-use in
SparseTensor integration tests for CPU. This is a direct follow-up of:
- https://reviews.llvm.org/D155403 (test duplication), and
- https://reviews.llvm.org/D155405 (code re-use),
The key logic for this patch is implemented in:
- SparseTensor/CPU/lit.local.cfg.
Essentially, the set-up that used to be repeated across all test files
has been extracted into a common LIT configuration file. This makes code
re-use straightforward.
All SVE/VLA tests are now enabled _conditionally_ and refactored to use
mlir-cpu-runner rather than lli. The former helps with test
duplication and the latter with code re-use.
A few additional refactoring changes are included.
- The reduce verbosity, long runtime library names like:
%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
are replaced with:
%mlir_c_runner_utils
- In order to keep the code and the comments in sync, and to maintain consistency across the tests, the following:
enable-runtime-library=true
is swapped with (and vice-versa):
enable-runtime-library=false
Note that this change won't affect test coverage. Only few tests
required such update.
- A VLS vectorization RUN line is added in tests where there was a VLA/VLS RUN line, but no VLS RUN line (with a few exceptions of tests that only contained one RUN line to begin with).
- A few test variables are renamed/added. Most notable example:
- %{options} --> %{sparse_compiler_opts}
TEST RUNTIME IMPROVEMENT
Tl;Dr This change improves test execution time by ~25%.
At the moment, the following llvm-lit invocation takes ~7.30s on my
AArch64 workstation (with SVE):
llvm-lit <llvm-project>/mlir/test/Integration/Dialect/SparseTensor/CPU/
This timing doesn't change no matter what the value of the following
CMake variable is (it should enable/disable SVE/VLA tests):
MLIR_RUN_ARM_SVE_TESTS
With this patch, the execution time will indeed depend on the value of
the above CMake variable:
- with MLIR_RUN_ARM_SVE_TESTS=true the timing remains intact,
- with MLIR_RUN_ARM_SVE_TESTS=false the timing drops to ~5.40s (~25% improvement).
This is expected:
- on average there are 4 RUN lines per test,
- _without this change_ (and with MLIR_RUN_ARM_SVE_TESTS=false) the 4th RUN line would in most cases duplicate the 3rd RUN line,
- _with this change) (and with MLIR_RUN_ARM_SVE_TESTS=false) the 4th RUN line becomes empty.
PATCH SIZE
While rather large and touching many files, most changes in this patch
are rather mechanical. All test configurations have been preserved and
only in a handful of cases new RUN lines added.
"some downstream users" very diplomatic ;-)
And thanks for that!