[all-commits] [llvm/llvm-project] 0aaf2e: [mlir][GPU] add required address space cast when l...

zero9178 via All-commits all-commits at lists.llvm.org
Mon Feb 13 13:23:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0aaf2e3bc057aa1d784455f8f4da66bc464733d6
      https://github.com/llvm/llvm-project/commit/0aaf2e3bc057aa1d784455f8f4da66bc464733d6
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
    M mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir
    M mlir/test/Conversion/GPUCommon/lower-memset-to-gpu-runtime-calls.mlir

  Log Message:
  -----------
  [mlir][GPU] add required address space cast when lowering to LLVM

The runtime functions `memset` and `memcpy` are lowered are declared with pointers to the default address space (0) while their ops however are compatible with memrefs taking any address space.
Such cases do not cause any issues with MLIRs LLVM Dialect due to `bitcast`s verifier being too lenient at the moment, but actual LLVM IR does not allow casting between address spaces using `bitcast`: https://godbolt.org/z/3a1z97rc9

This patch fixes the issue by inserting an address space cast before the bitcast, to first cast the pointer into the correct address space before doing the bitcast.

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


  Commit: 009fc4ca3b4476826c89de05cb74d0afe2b5d609
      https://github.com/llvm/llvm-project/commit/009fc4ca3b4476826c89de05cb74d0afe2b5d609
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/test/Dialect/LLVMIR/invalid.mlir

  Log Message:
  -----------
  [mlir][LLVM] Verify correct pointer casts with `llvm.bitcast`

`llvm.bitcast` has so far not had a verifier and this allowed various bugs to sneak into the codebase (including within tests!) which could only be caught once translated to actual LLVM IR. This patch fixes those problematic cases by now verifying bitcasts on pointers are done correctly.

Specifically, it verifies that if pointers are involved, that both result and source types are pointers, that this also applies to vector of pointers and that pointer casts are of the same address space.

The only thing left unverified is the general case of "source type size does not match result type size". I think this case is less trivial and more prone to false positives, so I did not yet implement it.

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


  Commit: 19b1e27fcd56a2a61525899a80bddffd8af9ba61
      https://github.com/llvm/llvm-project/commit/19b1e27fcd56a2a61525899a80bddffd8af9ba61
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
    M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
    M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
    M mlir/test/Conversion/SPIRVToLLVM/arithmetic-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/bitwise-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/cast-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/comparison-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/control-flow-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/gl-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/logical-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
    M mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls_fail.mlir
    M mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/shift-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir
    M mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm.mlir
    A mlir/test/Conversion/SPIRVToLLVM/typed-pointers.mlir

  Log Message:
  -----------
  [mlir][SPIRVToLLVM] Add pass option to emit opaque-pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the pass option and required changes to the patterns to support the emission of LLVM IR opaque pointers. Given how close SPIRV semantics are to LLVM IR semantics this boils down to just a few changes:
* Making sure that GEP and alloca are built with the explicit base pointer type
* creating opaque pointers instead of typed pointers if requested
* omitting pointer to pointer bitcasts

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


  Commit: 161b9d741a3c25f7bd79620598c5a2acf3f0f377
      https://github.com/llvm/llvm-project/commit/161b9d741a3c25f7bd79620598c5a2acf3f0f377
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M mlir/include/mlir/ExecutionEngine/RunnerUtils.h
    M mlir/test/CMakeLists.txt
    R mlir/test/Integration/Dialect/Arith/CPU/lit.local.cfg
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-addi-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-cmpi-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-compare-results-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-constants-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-max-min-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-muli-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-shli-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrsi-i16.mlir
    M mlir/test/Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrui-i16.mlir
    M mlir/test/Integration/Dialect/Async/CPU/lit.local.cfg
    M mlir/test/Integration/Dialect/Async/CPU/microbench-linalg-async-parallel-for.mlir
    M mlir/test/Integration/Dialect/Async/CPU/microbench-scf-async-parallel-for.mlir
    M mlir/test/Integration/Dialect/Async/CPU/test-async-parallel-for-1d.mlir
    M mlir/test/Integration/Dialect/Async/CPU/test-async-parallel-for-2d.mlir
    M mlir/test/Integration/Dialect/Complex/CPU/correctness.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/X86/lit.local.cfg
    M mlir/test/Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm-vector.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg
    M mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
    M mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/rank-reducing-subview.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-collapse-tensor.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-1d-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-1d-nwc-wcf-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-2d-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-2d-nhwc-hwcf-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-3d-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-conv-3d-ndhwc-dhwcf-call.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-elementwise.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-expand-tensor.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-one-shot-bufferize.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-padtensor.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-subtensor-insert-multiple-uses.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-subtensor-insert.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-tensor-e2e.mlir
    M mlir/test/Integration/Dialect/Linalg/CPU/test-tensor-matmul.mlir
    M mlir/test/Integration/Dialect/Memref/cast-runtime-verification.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate.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/lit.local.cfg
    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_codegen_dim.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_foreach.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_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_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_dot.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand.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_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_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_reductions.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_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_unary.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir
    M mlir/test/Integration/Dialect/SparseTensor/python/test_SDDMM.py
    M mlir/test/Integration/Dialect/SparseTensor/python/test_SpMM.py
    M mlir/test/Integration/Dialect/SparseTensor/python/test_elementwise_add_sparse_output.py
    M mlir/test/Integration/Dialect/SparseTensor/python/test_output.py
    M mlir/test/Integration/Dialect/SparseTensor/python/test_stress.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_MTTKRP.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_SDDMM.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_SpMM.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_SpMV.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_Tensor.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_scalar_tensor_algebra.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_simple_tensor_algebra.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_tensor_complex.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_tensor_types.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_tensor_unary_ops.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/test_true_dense_tensor_algebra.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/unit_test_tensor_core.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/unit_test_tensor_io.py
    M mlir/test/Integration/Dialect/SparseTensor/taco/unit_test_tensor_utils.py
    M mlir/test/Integration/Dialect/Standard/CPU/test-ceil-floor-pos-neg.mlir
    M mlir/test/Integration/Dialect/Standard/CPU/test_subview.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-mulf-full.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-mulf.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-muli-ext.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-muli-full.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-muli.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-tilezero-block.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/AMX/test-tilezero.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-dot.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-inline-asm-vector-avx512.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-mask-compress.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-sparse-dot-product.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-vp2intersect-i32.mlir
    R mlir/test/Integration/Dialect/Vector/CPU/lit.local.cfg
    M mlir/test/Integration/Dialect/Vector/CPU/test-0-d-vectors.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-broadcast.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-compress.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-constant-mask.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-contraction.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-create-mask-v4i1.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-create-mask.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-expand.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-extract-strided-slice.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-flat-transpose-col.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-flat-transpose-row.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-fma.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-gather.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-index-vectors.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-insert-strided-slice.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-maskedload.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-maskedstore.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-matrix-multiply-col.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-matrix-multiply-row.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-outerproduct-f32.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-outerproduct-i64.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-print-int.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-realloc.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-f32-reassoc.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-f32.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-f64-reassoc.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-f64.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-i32.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-i4.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-i64.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-si4.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-reductions-ui4.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-scan.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-scatter.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-shape-cast.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-shuffle.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-sparse-dot-matvec.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-sparse-saxpy-jagged-matvec.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read-1d.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read-2d.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read-3d.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-to-loops.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-write.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/test-transpose.mlir
    M mlir/test/Integration/Dialect/Vector/GPU/CUDA/test-reduction-distribute.mlir
    M mlir/test/Integration/Dialect/Vector/GPU/CUDA/test-warp-distribute.mlir
    M mlir/test/Integration/GPU/CUDA/TensorCore/wmma-matmul-f16.mlir
    M mlir/test/Integration/GPU/CUDA/TensorCore/wmma-matmul-f32.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-and.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-max.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-min.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-op.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-or.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-region.mlir
    M mlir/test/Integration/GPU/CUDA/all-reduce-xor.mlir
    M mlir/test/Integration/GPU/CUDA/async.mlir
    M mlir/test/Integration/GPU/CUDA/gpu-to-cubin.mlir
    M mlir/test/Integration/GPU/CUDA/multiple-all-reduce.mlir
    M mlir/test/Integration/GPU/CUDA/printf.mlir
    M mlir/test/Integration/GPU/CUDA/shuffle.mlir
    M mlir/test/Integration/GPU/CUDA/two-modules.mlir
    M mlir/test/Integration/GPU/ROCM/gpu-to-hsaco.mlir
    M mlir/test/Integration/GPU/ROCM/printf.mlir
    M mlir/test/Integration/GPU/ROCM/two-modules.mlir
    M mlir/test/Integration/GPU/ROCM/vecadd.mlir
    M mlir/test/Integration/GPU/ROCM/vector-transferops.mlir
    M mlir/test/lit.cfg.py
    M mlir/test/lit.site.cfg.py.in
    M mlir/test/mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir
    M mlir/test/mlir-cpu-runner/async-error.mlir
    M mlir/test/mlir-cpu-runner/async-func.mlir
    M mlir/test/mlir-cpu-runner/async-group.mlir
    M mlir/test/mlir-cpu-runner/async-value.mlir
    M mlir/test/mlir-cpu-runner/async.mlir
    M mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir
    M mlir/test/mlir-cpu-runner/copy.mlir
    M mlir/test/mlir-cpu-runner/global-memref.mlir
    M mlir/test/mlir-cpu-runner/lit.local.cfg
    M mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir
    M mlir/test/mlir-cpu-runner/memref-reinterpret-cast.mlir
    M mlir/test/mlir-cpu-runner/memref-reshape.mlir
    M mlir/test/mlir-cpu-runner/print.mlir
    M mlir/test/mlir-cpu-runner/sgemm-naive-codegen.mlir
    M mlir/test/mlir-cpu-runner/simple.mlir
    M mlir/test/mlir-cpu-runner/unranked-memref.mlir
    M mlir/test/mlir-cpu-runner/utils.mlir
    M mlir/test/mlir-cpu-runner/x86-varargs.mlir
    M mlir/test/mlir-spirv-cpu-runner/double.mlir
    M mlir/test/mlir-spirv-cpu-runner/lit.local.cfg
    M mlir/test/mlir-spirv-cpu-runner/mlir_test_spirv_cpu_runner_c_wrappers.cpp
    M mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
    M mlir/test/mlir-vulkan-runner/addf.mlir
    M mlir/test/mlir-vulkan-runner/addi.mlir
    M mlir/test/mlir-vulkan-runner/addi8.mlir
    M mlir/test/mlir-vulkan-runner/mulf.mlir
    M mlir/test/mlir-vulkan-runner/smul_extended.mlir
    M mlir/test/mlir-vulkan-runner/subf.mlir
    M mlir/test/mlir-vulkan-runner/time.mlir
    M mlir/test/mlir-vulkan-runner/umul_extended.mlir

  Log Message:
  -----------
  [mlir] Make the vast majority of integration and runner tests work on Windows

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 by making the paths to the runtime libraries be passed from cmake into lit. 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`.

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


Compare: https://github.com/llvm/llvm-project/compare/9d0b596aada6...161b9d741a3c


More information about the All-commits mailing list