diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake --- a/mlir/cmake/modules/AddMLIRPython.cmake +++ b/mlir/cmake/modules/AddMLIRPython.cmake @@ -234,7 +234,7 @@ COMMENT "Copying python source ${_src_path} -> ${_dest_path}" DEPENDS "${_src_path}" BYPRODUCTS "${_dest_path}" - COMMAND "${CMAKE_COMMAND}" -E create_symlink + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${_src_path}" "${_dest_path}" ) install( diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -94,6 +94,10 @@ # TODO: detect Darwin/Windows situation (or mark these tests as unsupported on these platforms). if "asan" in config.available_features and "Linux" in config.host_os: python_executable = f"LD_PRELOAD=$({config.host_cxx} -print-file-name=libclang_rt.asan-{config.host_arch}.so) {config.python_executable}" +# On Windows the path to python could contains spaces in which case it needs to be provided in quites. +# This is the equivalent of how %python is setup in llvm/utils/lit/lit/llvm/config.py. +elif "Windows" in config.host_os: + python_executable = '"%s"' % (python_executable) tools.extend([ ToolSubst('%PYTHON', python_executable, unresolved='ignore'), ]) diff --git a/mlir/test/python/dialects/shape.py b/mlir/test/python/dialects/shape.py --- a/mlir/test/python/dialects/shape.py +++ b/mlir/test/python/dialects/shape.py @@ -23,7 +23,7 @@ RankedTensorType.get((12, -1), f32)) def const_shape_tensor(arg): return shape.ConstShapeOp( - DenseElementsAttr.get(np.array([10, 20]), type=IndexType.get())) + DenseElementsAttr.get(np.array([10, 20], dtype=np.int64), type=IndexType.get())) # CHECK-LABEL: func @const_shape_tensor(%arg0: tensor<12x?xf32>) # CHECK: shape.const_shape [10, 20] : tensor<2xindex> diff --git a/mlir/test/python/execution_engine.py b/mlir/test/python/execution_engine.py --- a/mlir/test/python/execution_engine.py +++ b/mlir/test/python/execution_engine.py @@ -345,13 +345,21 @@ arg0_memref_ptr = ctypes.pointer( ctypes.pointer(get_ranked_memref_descriptor(arg0))) + if sys.platform == 'win32': + shared_libs = [ + "../../../../bin/mlir_runner_utils.dll", + "../../../../bin/mlir_c_runner_utils.dll" + ] + else: + shared_libs = [ + "../../../../lib/libmlir_runner_utils.so", + "../../../../lib/libmlir_c_runner_utils.so" + ] + execution_engine = ExecutionEngine( lowerToLLVM(module), opt_level=3, - shared_libs=[ - "../../../../lib/libmlir_runner_utils.so", - "../../../../lib/libmlir_c_runner_utils.so" - ]) + shared_libs=shared_libs) execution_engine.invoke("main", arg0_memref_ptr) # CHECK: Unranked Memref # CHECK-NEXT: [42] @@ -379,13 +387,21 @@ func.func private @printMemrefI64(memref<*xi64>) attributes { llvm.emit_c_interface } }""") + if sys.platform == 'win32': + shared_libs = [ + "../../../../bin/mlir_runner_utils.dll", + "../../../../bin/mlir_c_runner_utils.dll" + ] + else: + shared_libs = [ + "../../../../lib/libmlir_runner_utils.so", + "../../../../lib/libmlir_c_runner_utils.so" + ] + execution_engine = ExecutionEngine( lowerToLLVM(module), opt_level=3, - shared_libs=[ - "../../../../lib/libmlir_runner_utils.so", - "../../../../lib/libmlir_c_runner_utils.so" - ]) + shared_libs=shared_libs) execution_engine.invoke("main") # CHECK: Unranked Memref # CHECK: [{{.*}}]