[all-commits] [llvm/llvm-project] 23e513: [mlir][test] Reland: Refactor SparseTensor CPU int...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Fri Aug 11 01:17:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 23e5130ebfe140d865f16b5d2dd6cd8a670379da
      https://github.com/llvm/llvm-project/commit/23e5130ebfe140d865f16b5d2dd6cd8a670379da
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2023-08-11 (Fri, 11 Aug 2023)

  Changed paths:
    M mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1_permute.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/reshape_dot.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cast.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_foreach.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_collapse_shape.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex32.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex64.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex_ops.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_constant_to_sparse_tensor.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_1d_nwc_wcf.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nchw_fchw.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nhwc_hwcf.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_ndhwc_dhwcf.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_dyn.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_element.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_ptr.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2sparse.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_coo_test.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_dot.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand_shape.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_file_io.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_foreach_slices.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_1d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_2d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_3d.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul_slice.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_mult_elt.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_reduction.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_simple.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pack.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pooling_nhwc.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_re_im.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_prod.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_sum.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_prod.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reshape.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_push_back.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_mm_fusion.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_scale.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_scf_nested.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_select.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_semiring_select.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sign.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_bf16.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_c32.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_f16.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_ops.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose_coo.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir

  Log Message:
  -----------
  [mlir][test] Reland: Refactor SparseTensor CPU integration tests

CHANGES SINCE THE ORIGINAL VERSION
----------------------------------
The default test set-up was extracted from
  * SparseTensor/CPU/lit.local.cfg.
and duplicated in all tests. This is to support downstream users that
don't use these local LIT config files.

SUMMARY OF CHANGES
------------------
This patch aims to reduce test duplication. This is a direct follow-up of:
  1. https://reviews.llvm.org/D155403 (test duplication), and
  2. https://reviews.llvm.org/D155405 (code re-use),

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.

1. 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

2. 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.

3. 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).

4. 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 (that should disable some 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.

Differential Revision: https://reviews.llvm.org/D156625




More information about the All-commits mailing list