This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Make the vast majority of integration and runner tests work on Windows
ClosedPublic

Authored by zero9178 on Feb 13 2023, 8:48 AM.

Details

Summary

This patch contains the changes required to make the vast majority of integration and runner tests run on Windows.
Historically speaking, the JIT support for Windows has been lacking behind, but recent versions of ORC JIT have now caught up and works for basically all examples in repo.

Sadly due to these tests previously not working on Windows, basically all of them are making unix-like assumptions about things like filenames, paths, shell syntax etc.
This patch fixes all these issues in one big swoop and enables Windows support for the vast majority of integration tests.

More specifically, following changes had to be done:

  • The various JIT runners used paths to the runtime libraries that assumed a Unix toolchain layout and filenames. I abstracted the specific path and filename of these runtime libraries away and implemented search logic in lit to find these isntead. This now also allows a much more convenient syntax: --shared-libs=%mlir_c_runner_utils instead of --shared-libs=%mlir_lib_dir/lib/libmlir_c_runner_utils%shlibext
  • Some tests using python set environment variables using the ENV=VALUE cmd format. This works on Unix, but on Windows it has to prefixed using env ENV=VALUE cmd
  • Some tests used C functions that are simply not available or exported on Windows (fabsf, aligned_alloc). These tests have either been adjusted or explicitly marked as UNSUPPORTED

Some tests remain disabled on Windows as before:

  • In SparseTensor some tests have non-trivial logic for finding the runtime libraries which seems to be required for the use of emulators. I do not have the time to port these so I simply kept them disabled
  • Some tests requiring special hardware which I simply cannot test remain disabled on Windows. These include usage of AVX512 or AMX

The tests for mlir-vulkan-runner and mlir-spirv-runner all work now as well and so do the vast majority of mlir-cpu-runner.

Diff Detail

Event Timeline

zero9178 created this revision.Feb 13 2023, 8:48 AM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
zero9178 requested review of this revision.Feb 13 2023, 8:48 AM
zero9178 edited the summary of this revision. (Show Details)Feb 13 2023, 8:49 AM
This revision is now accepted and ready to land.Feb 13 2023, 9:25 AM

Can we revert this?
Integration tests are broken

cmake --build . --target check-mlir-integration

....

Failed Tests (153):

MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-addi-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-cmpi-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-compare-results-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-constants-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-max-min-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-muli-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shli-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrsi-i16.mlir
MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrui-i16.mlir
MLIR :: Integration/Dialect/Async/CPU/microbench-linalg-async-parallel-for.mlir
MLIR :: Integration/Dialect/Async/CPU/microbench-scf-async-parallel-for.mlir
MLIR :: Integration/Dialect/Async/CPU/test-async-parallel-for-1d.mlir
MLIR :: Integration/Dialect/Async/CPU/test-async-parallel-for-2d.mlir
MLIR :: Integration/Dialect/Complex/CPU/correctness.mlir
MLIR :: Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm-vector.mlir
MLIR :: Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm.mlir
MLIR :: Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
MLIR :: Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
MLIR :: Integration/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
MLIR :: Integration/Dialect/Linalg/CPU/rank-reducing-subview.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-collapse-tensor.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-1d-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-1d-nwc-wcf-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-2d-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-2d-nhwc-hwcf-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-3d-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-conv-3d-ndhwc-dhwcf-call.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-elementwise.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-expand-tensor.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-one-shot-bufferize.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-padtensor.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-subtensor-insert-multiple-uses.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-subtensor-insert.mlir
MLIR :: Integration/Dialect/Linalg/CPU/test-tensor-e2e.mlir
MLIR :: Integration/Dialect/Memref/cast-runtime-verification.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/concatenate.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_cast.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_codegen_foreach.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex32.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex64.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex_ops.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_constant_to_sparse_tensor.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_1d_nwc_wcf.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nhwc_hwcf.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_3d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_ndhwc_dhwcf.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_dyn.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_ptr.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2sparse.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_dot.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_expand.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_file_io.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_foreach_slices.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_index.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_1d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_2d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_3d.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_mult_elt.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_reduction.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_simple.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_pack.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_re_im.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_prod.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reductions.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reductions_prod.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reshape.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_push_back.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sampled_mm_fusion.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_scale.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_scf_nested.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_select.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sign.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_bf16.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_c32.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_f16.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tensor_ops.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir
MLIR :: Integration/Dialect/Standard/CPU/test-ceil-floor-pos-neg.mlir
MLIR :: Integration/Dialect/Standard/CPU/test_subview.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-0-d-vectors.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-broadcast.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-compress.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-constant-mask.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-contraction.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-create-mask-v4i1.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-create-mask.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-expand.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-extract-strided-slice.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-flat-transpose-col.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-flat-transpose-row.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-fma.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-gather.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-index-vectors.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-insert-strided-slice.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-maskedload.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-maskedstore.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-matrix-multiply-col.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-matrix-multiply-row.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-outerproduct-f32.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-outerproduct-i64.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-print-int.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-realloc.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f32-reassoc.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f32.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f64-reassoc.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f64.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i32.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i4.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i64.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-si4.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-reductions-ui4.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-scan.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-scatter.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-shape-cast.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-shuffle.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-sparse-dot-matvec.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-sparse-saxpy-jagged-matvec.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-1d.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-2d.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-3d.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-to-loops.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transfer-write.mlir
MLIR :: Integration/Dialect/Vector/CPU/test-transpose.mlir

Testing Time: 0.46s

Unsupported:  64
Passed     :   5
Failed     : 153

Hello Aart!

I am sorry that this patch is causing you trouble. Do you happen to know as to why the changes are seemingly breaking, what I am assuming to be your develop environment?
More specifically I am wondering whether your cmake options or maybe version do not play well with the changes here.
The list of failed tests seems to include basically all of them, so I am thinking its some environment issue. Furthermore, all build bots seemingly had no problem running all these tests and neither did I on both my Windows and Linux machine.
This includes eg. the AMD build bot which did run all the integration tests that seemingly failed on your machine https://lab.llvm.org/buildbot/#/builders/220/builds/15586

aartbik added a comment.EditedFeb 13 2023, 9:35 PM

Hello Aart!

I am sorry that this patch is causing you trouble. Do you happen to know as to why the changes are seemingly breaking, what I am assuming to be your develop environment?
More specifically I am wondering whether your cmake options or maybe version do not play well with the changes here.
The list of failed tests seems to include basically all of them, so I am thinking its some environment issue. Furthermore, all build bots seemingly had no problem running all these tests and neither did I on both my Windows and Linux machine.
This includes eg. the AMD build bot which did run all the integration tests that seemingly failed on your machine https://lab.llvm.org/buildbot/#/builders/220/builds/15586

Thanks for your prompt reply! I am one of the original authors of the integration tests, and have been running them since I started the suite, always the same way, and they started only breaking after this change. Not too many people (or bots) run the full integration suite, so I am more likely to find issues than our automated ways, unfortunately. Lastly, note that I also do rotation duties for the Google repo, and this change most likely broke our bazel build setup (but that is *not* the reason for reverting, to be clear, the reason for reverting was a plain Linux vanilla setup breakage).

To give you more details, this is my config, for example (an asan one)

cmake -G Ninja ../llvm \
 -DLLVM_ENABLE_PROJECTS=mlir \
 -DLLVM_BUILD_EXAMPLES=ON \
 -DLLVM_TARGETS_TO_BUILD="host" \
 -DCMAKE_BUILD_TYPE=Release \
 -DLLVM_ENABLE_WARNINGS=ON \
 -DLLVM_ENABLE_PEDANTIC=ON \
 -DLLVM_ENABLE_ASSERTIONS=ON \
 -DLLVM_USE_SANITIZER=Address \
 -DMLIR_RUN_AMX_TESTS=OFF \
 -DMLIR_RUN_X86VECTOR_TESTS=OFF \
 -DMLIR_RUN_ARM_SVE_TESTS=OFF \
 -DMLIR_INCLUDE_INTEGRATION_TESTS=ON \
 -DMLIR_INCLUDE_TESTS=ON \
 -DBUILD_SHARED_LIBS=OFF \
 -DMLIR_ENABLE_BINDINGS_PYTHON=OFF \
 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON

and this is a typical run command

cmake --build . --target check-mlir-integration

Maybe you can get some log output of the failures?

Maybe you can get some log output of the failures?

Yeah, always a good idea (sorry -it has been a long day here-)

Here is the output on main, using the setup given earlier, *after* the revert, so all is well.

cmake --build . --target check-mlir-integration

[0/1] Running lit suite /usr/local/google/home/ajcbik/LLVM/llvm-project/mlir/test/Integration

Testing Time: 38.38s
  Unsupported:  64
  Passed     : 158

Then, rolling back to a change *before* the revert, with some of the logging output below.
Note that I see a strange literal ,$<TARGET_FILE:mlir_runner_utils> in the RUN command.
It is not impossible something is wrong in my setup, but, again, please note I have been running
this from the very start of the suite ;-)

cmake --build . --target check-mlir-integration

[0/1] Running lit suite /usr/local/google/home/ajcbik/LLVM/llvm-project/mlir/test/Integration
-- Testing: 222 tests, 12 workers --
Testing:
FAIL: MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir (1 of 222)
******************** TEST 'MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir' FAILED ********************
Script:
--
: 'RUN: at line 8';   /usr/local/google/home/ajcbik/LLVM/llvm-project/build_asan/bin/mlir-opt /usr/local/google/home/ajcbik/LLVM/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir --sparse  -compiler=enable-runtime-library=true | /usr/local/google/home/ajcbik/LLVM/llvm-project/build_asan/bin/mlir-cpu-runner -e entry -entry-point-result=void -shared-libs=$<TARGET_FILE:mlir_c_runner_utils>,$<TARGET_FILE:mlir_runner_utils> | /usr/local/google/home/ajcbik/LLVM/llvm-project/build_asan/bin/FileCheck /usr/local/google/home/ajcbik/LLVM/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir

 ...

Testing Time: 3.73s
  Unsupported:  64
  Passed     :   5
  Failed     : 153

Then, rolling back to a change *before* the revert, with some of the logging output below.
Note that I see a strange literal ,$<TARGET_FILE:mlir_runner_utils> in the RUN command.

Thanks! That's likely be helpful, the $<TARGET_FILE:mlir_runner_utils> seems like CMake internal not being expanded. It could be a matter of different CMake version or some build flags (like -DBUILD_SHARED_LIBS or other settings)

This seems likely to be a cmake issue indeed. What cmake version are you using?
I tested it a second ago with 3.15 and 3.20 on Linux with the same configure options as you posted and 3.25 on Windows and they all work.
3.13 is the oldest that MLIR supposedly allows (although with deprecation warning) but that threw some errors so couldn't test that old of a version.

Did you also attempt to fully reconfigure the project, as in completetely delete the cmake build directory and reconfigure? I'd hope that'd not be necessary but you never know with cmake :(

This seems likely to be a cmake issue indeed. What cmake version are you using?
I tested it a second ago with 3.15 and 3.20 on Linux with the same configure options as you posted and 3.25 on Windows and they all work.

cmake -version
cmake version 3.25.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

awarzynski added inline comments.Feb 14 2023, 10:09 AM
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
27

Could you update this (and other similar REDEFINEs in mlir/test/Integration/Dialect/SparseTensor/CPU/) as well? Thanks!

Managed to reproduce the error. I basically had to copy your exact cmake command. Only then could I use the check-mlir-integration target. Running just check-mlir works without issues. I am confused why check-mlir-integration is not available in any of my other build configs, but at least I can test and reproduce it.

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
27

These paths use %mlir_native_utils_lib_dir which is not always substituted to the same as %mlir_lib_dir is. In particular, these may be set differently when using enumlators to execute the code. Since I'd certainly break such setups and I am unable to test these I left these as is and have disabled the SparseTensor tests on Windows

zero9178 updated this revision to Diff 497464.Feb 14 2023, 3:45 PM

Don't try to create the lit.site.cfg.py file in two steps, but teach configure_lit_site_cfg how to evaluate generator expressions instead.

The input filename to configure_lit_site_cfg is recorded and put into a global map for llvm-lit, allowing it to be run on subdirectories of a testsuite and still find the lit.site.cfg.py required. Problem was, that the patch doing the config generation in two steps, recorded lit.site.cfg.py.in in this global map, as that is what was passed to configure_lit_site_cfg. check-mlir-integration would therefore read in that file instead of lit.site.cfg.py and the tests would be broken.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 3:45 PM

Can you split the infrastructure change (CMake, lit config, etc.) to a separate patch? Seems like another issue you're addressing there.

zero9178 updated this revision to Diff 497610.Feb 15 2023, 3:00 AM
zero9178 edited the summary of this revision. (Show Details)

Move logic from cmake into lit. Lit now searches for the runtime libraries by simply looking for the file in SHLIBDIR (a variable set to the directory containing the shared libraries on the platform, set by configure_lit_site_cfg) with either no prefix or lib as prefix and the platforms shared library suffix.

The advantages over this approach over the cmake approach is that it 1) uses Python code not cmake 2) therefore works with bazel as well 3) and works correctly with multi-config generators on cmake (which my previous approach did not).

zero9178 reopened this revision.Feb 15 2023, 3:00 AM
This revision is now accepted and ready to land.Feb 15 2023, 3:00 AM
awarzynski added inline comments.Feb 15 2023, 5:47 AM
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
27

Ack, thanks for the explanation!

mehdi_amini accepted this revision.Feb 15 2023, 9:44 AM
mehdi_amini added inline comments.
mlir/test/lit.cfg.py
39

Comment this maybe?

zero9178 updated this revision to Diff 497724.Feb 15 2023, 10:14 AM

Address review comments

This revision was landed with ongoing or failed builds.Feb 15 2023, 10:14 AM
This revision was automatically updated to reflect the committed changes.
aartbik added a comment.EditedFeb 15 2023, 11:00 AM

The change now sticks on linux/cmake, but the bazel configuration I am monitoring is completely broken with this substitution mechanism.
Do you have any pointers for me on where to start debugging this?

I see a non-substituted command line

  1. mlir-opt /usr/local/google/_blaze_ajcbik/77adac8990317f04651682107287f0d3/execroot/google3/blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir.test.runfiles/google3/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir --sparse-compiler=enable-runtime-library=false | mlir-cpu-runner -e entry -entry-point-result=void -shared-libs=%mlir_c_runner_utils | FileCheck /usr/local/google/_blaze_ajcbik/77adac8990317f04651682107287f0d3/execroot/google3/blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir.test.runfiles/google3/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir

The change now sticks on linux/cmake, but the bazel configuration I am monitoring is completely broken with this substitution mechanism.
Do you have any pointers for me on where to start debugging this?

I see a non-substituted command line

  1. mlir-opt /usr/local/google/_blaze_ajcbik/77adac8990317f04651682107287f0d3/execroot/google3/blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir.test.runfiles/google3/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir --sparse-compiler=enable-runtime-library=false | mlir-cpu-runner -e entry -entry-point-result=void -shared-libs=%mlir_c_runner_utils | FileCheck /usr/local/google/_blaze_ajcbik/77adac8990317f04651682107287f0d3/execroot/google3/blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir.test.runfiles/google3/third_party/llvm/llvm-project/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir

The only change that it ought to require is for Bazel to also substitute @SHLIBDIR@ within lit.site.cfg.py.in correctly. It should expand to the directory where the runtime libraries are contained in. In the cmake build that'd be the LLVM_SHLIB_OUTPUT_INTDIR variable

Our set up is a little different, but I got a running again. Thanks!

Our set up is a little different, but I got a running again. Thanks!

Note that it also seems to have broken our bazel build bots

https://buildkite.com/llvm-project/upstream-bazel/builds/54269#018656fb-2bdc-4994-b90f-6a82289b5baa

mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-sparse-dot-product.mlir