diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -56,26 +56,33 @@ # Build the CUDA conversions and run according tests if the NVPTX backend # is available if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) - set(MLIR_CUDA_CONVERSIONS_ENABLED 1) + set(MLIR_ENABLE_CUDA_CONVERSIONS 1) else() - set(MLIR_CUDA_CONVERSIONS_ENABLED 0) + set(MLIR_ENABLE_CUDA_CONVERSIONS 0) endif() # TODO: we should use a config.h file like LLVM does -add_definitions(-DMLIR_CUDA_CONVERSIONS_ENABLED=${MLIR_CUDA_CONVERSIONS_ENABLED}) +add_definitions(-DMLIR_CUDA_CONVERSIONS_ENABLED=${MLIR_ENABLE_CUDA_CONVERSIONS}) # Build the ROCm conversions and run according tests if the AMDGPU backend # is available if ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD) - set(MLIR_ROCM_CONVERSIONS_ENABLED 1) + set(MLIR_ENABLE_ROCM_CONVERSIONS 1) else() - set(MLIR_ROCM_CONVERSIONS_ENABLED 0) + set(MLIR_ENABLE_ROCM_CONVERSIONS 0) endif() -add_definitions(-DMLIR_ROCM_CONVERSIONS_ENABLED=${MLIR_ROCM_CONVERSIONS_ENABLED}) +add_definitions(-DMLIR_ROCM_CONVERSIONS_ENABLED=${MLIR_ENABLE_ROCM_CONVERSIONS}) -set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner") -set(MLIR_ROCM_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir ROCm runner") -set(MLIR_SPIRV_CPU_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir SPIR-V cpu runner") -set(MLIR_VULKAN_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir Vulkan runner") +# Until the buildbot configuration is updated, preserve old names. +if (${MLIR_CUDA_RUNNER_ENABLED}) + set(MLIR_ENABLE_CUDA_RUNNER_DEFAULT ${MLIR_CUDA_RUNNER_ENABLED}) +else() + set(MLIR_ENABLE_CUDA_RUNNER_DEFAULT 0) +endif() + +set(MLIR_ENABLE_CUDA_RUNNER ${MLIR_ENABLE_CUDA_RUNNER_DEFAULT} CACHE BOOL "Enable building the mlir CUDA runner") +set(MLIR_ENABLE_ROCM_RUNNER 0 CACHE BOOL "Enable building the mlir ROCm runner") +set(MLIR_ENABLE_SPIRV_CPU_RUNNER 0 CACHE BOOL "Enable building the mlir SPIR-V cpu runner") +set(MLIR_ENABLE_VULKAN_RUNNER 0 CACHE BOOL "Enable building the mlir Vulkan runner") option(MLIR_INCLUDE_TESTS "Generate build targets for the MLIR unit tests." @@ -96,15 +103,22 @@ # This linking mode is somewhat more consistent across platforms and surfaces # undefined symbols at link time (vs runtime). It is suitable for development # workflows but can be disabled for more flexible deployment by -# setting -DMLIR_PYTHON_BINDINGS_VERSION_LOCKED=OFF +# setting -DMLIR_BINDINGS_PYTHON_LOCK_VERSION=OFF #------------------------------------------------------------------------------- -set(MLIR_BINDINGS_PYTHON_ENABLED 0 CACHE BOOL +# Until the buildbot configuration is updated, support old name. +if (${MLIR_BINDINGS_PYTHON_ENABLED}) + set(MLIR_ENABLE_BINDINGS_PYTHON_DEFAULT ${MLIR_BINDINGS_PYTHON_ENABLED}) +else() + set(MLIR_ENABLE_BINDINGS_PYTHON_DEFAULT 0) +endif() + +set(MLIR_ENABLE_BINDINGS_PYTHON ${MLIR_ENABLE_BINDINGS_PYTHON_DEFAULT} CACHE BOOL "Enables building of Python bindings.") -set(MLIR_PYTHON_BINDINGS_VERSION_LOCKED 1 CACHE BOOL +set(MLIR_BINDINGS_PYTHON_LOCK_VERSION 1 CACHE BOOL "Links to specific python libraries, resolving all symbols.") -if(MLIR_BINDINGS_PYTHON_ENABLED) +if(MLIR_ENABLE_BINDINGS_PYTHON) include(MLIRDetectPythonEnv) find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} COMPONENTS Interpreter Development NumPy REQUIRED) @@ -146,7 +160,7 @@ # Generally things after this point may depend on MLIR_ALL_LIBS or libMLIR.so. add_subdirectory(tools) -if(MLIR_BINDINGS_PYTHON_ENABLED) +if(MLIR_ENABLE_BINDINGS_PYTHON) # Python sources: built extensions come in via lib/Bindings/Python add_subdirectory(python) endif() 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 @@ -24,7 +24,7 @@ # symbols, which is better for development. Note that not all python # configurations provide build-time libraries to link against, in which # case, we fall back to MODULE linking. - if(Python3_LIBRARIES STREQUAL "" OR NOT MLIR_PYTHON_BINDINGS_VERSION_LOCKED) + if(Python3_LIBRARIES STREQUAL "" OR NOT MLIR_BINDINGS_PYTHON_LOCK_VERSION) set(PYEXT_LINK_MODE MODULE) set(PYEXT_LIBADD) else() diff --git a/mlir/docs/Bindings/Python.md b/mlir/docs/Bindings/Python.md --- a/mlir/docs/Bindings/Python.md +++ b/mlir/docs/Bindings/Python.md @@ -12,7 +12,7 @@ ### CMake variables -* **`MLIR_BINDINGS_PYTHON_ENABLED`**`:BOOL` +* **`MLIR_ENABLE_BINDINGS_PYTHON`**`:BOOL` Enables building the Python bindings. Defaults to `OFF`. @@ -23,7 +23,7 @@ multiple Python implementations, setting this explicitly to the preferred `python3` executable is strongly recommended. -* **`MLIR_PYTHON_BINDINGS_VERSION_LOCKED`**`:BOOL` +* **`MLIR_BINDINGS_PYTHON_LOCK_VERSION`**`:BOOL` Links the native extension against the Python runtime library, which is optional on some platforms. While setting this to `OFF` can yield some greater diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md --- a/mlir/docs/SPIRVToLLVMDialectConversion.md +++ b/mlir/docs/SPIRVToLLVMDialectConversion.md @@ -820,7 +820,7 @@ To build the runner, add the following option to `cmake`: ```bash --DMLIR_SPIRV_CPU_RUNNER_ENABLED=1 +-DMLIR_ENABLE_SPIRV_CPU_RUNNER=1 ``` ### Pipeline diff --git a/mlir/docs/Tools/LinalgOpDsl.md b/mlir/docs/Tools/LinalgOpDsl.md --- a/mlir/docs/Tools/LinalgOpDsl.md +++ b/mlir/docs/Tools/LinalgOpDsl.md @@ -12,7 +12,7 @@ The tool is bundled with the MLIR Python bindings. To use from the CMake build tree, MLIR must be build with Python bindings enabled -(`-DMLIR_BINDINGS_PYTHON_ENABLED=ON`). Then add the `python` directory in the +(`-DMLIR_ENALBE_BINDINGS_PYTHON=ON`). Then add the `python` directory in the build tree to your `PYTHONPATH` environment variable (i.e. `export PYTHONPATH=$PWD/build/python`). Optionally, use an installed MLIR package, if available, to avoid building. diff --git a/mlir/lib/Bindings/CMakeLists.txt b/mlir/lib/Bindings/CMakeLists.txt --- a/mlir/lib/Bindings/CMakeLists.txt +++ b/mlir/lib/Bindings/CMakeLists.txt @@ -1,3 +1,3 @@ -if(MLIR_BINDINGS_PYTHON_ENABLED) +if(MLIR_ENABLE_BINDINGS_PYTHON) add_subdirectory(Python) endif() diff --git a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt --- a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt +++ b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt @@ -1,4 +1,4 @@ -if (MLIR_CUDA_CONVERSIONS_ENABLED) +if (MLIR_ENABLE_CUDA_CONVERSIONS) set(NVPTX_LIBS NVPTXCodeGen NVPTXDesc @@ -6,7 +6,7 @@ ) endif() -if (MLIR_ROCM_CONVERSIONS_ENABLED) +if (MLIR_ENABLE_ROCM_CONVERSIONS) set(AMDGPU_LIBS AMDGPUCodeGen AMDGPUDesc diff --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt --- a/mlir/lib/Dialect/GPU/CMakeLists.txt +++ b/mlir/lib/Dialect/GPU/CMakeLists.txt @@ -1,4 +1,4 @@ -if (MLIR_CUDA_CONVERSIONS_ENABLED) +if (MLIR_ENABLE_CUDA_CONVERSIONS) set(NVPTX_LIBS NVPTXCodeGen NVPTXDesc @@ -6,7 +6,7 @@ ) endif() -if (MLIR_ROCM_CONVERSIONS_ENABLED) +if (MLIR_ENABLE_ROCM_CONVERSIONS) set(AMDGPU_LIBS MCParser AMDGPUAsmParser @@ -59,8 +59,8 @@ MLIRTransformUtils ) -if(MLIR_CUDA_RUNNER_ENABLED) - if(NOT MLIR_CUDA_CONVERSIONS_ENABLED) +if(MLIR_ENABLE_CUDA_RUNNER) + if(NOT MLIR_ENABLE_CUDA_CONVERSIONS) message(SEND_ERROR "Building mlir with cuda support requires the NVPTX backend") endif() @@ -98,7 +98,7 @@ endif() -if(MLIR_ROCM_RUNNER_ENABLED) +if(MLIR_ENABLE_ROCM_RUNNER) if (NOT ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD)) message(SEND_ERROR "Building mlir with ROCm support requires the AMDGPU backend") diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt --- a/mlir/lib/ExecutionEngine/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/CMakeLists.txt @@ -106,7 +106,7 @@ set_property(TARGET mlir_async_runtime PROPERTY CXX_VISIBILITY_PRESET hidden) target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS) -if(MLIR_CUDA_RUNNER_ENABLED) +if(MLIR_ENABLE_CUDA_RUNNER) # Configure CUDA support. Using check_language first allows us to give a # custom error message. include(CheckLanguage) @@ -138,7 +138,7 @@ ) endif() -if(MLIR_ROCM_RUNNER_ENABLED) +if(MLIR_ENABLE_ROCM_RUNNER) # Configure ROCm support. if (NOT DEFINED ROCM_PATH) if (NOT DEFINED ENV{ROCM_PATH}) diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -2,19 +2,19 @@ add_subdirectory(SDBM) add_subdirectory(lib) -if(MLIR_BINDINGS_PYTHON_ENABLED) +if(MLIR_ENABLE_BINDINGS_PYTHON) add_subdirectory(python) endif() llvm_canonicalize_cmake_booleans( - MLIR_BINDINGS_PYTHON_ENABLED + MLIR_ENABLE_BINDINGS_PYTHON LLVM_BUILD_EXAMPLES - MLIR_CUDA_CONVERSIONS_ENABLED - MLIR_CUDA_RUNNER_ENABLED - MLIR_ROCM_CONVERSIONS_ENABLED - MLIR_ROCM_RUNNER_ENABLED - MLIR_SPIRV_CPU_RUNNER_ENABLED - MLIR_VULKAN_RUNNER_ENABLED + MLIR_ENABLE_CUDA_CONVERSIONS + MLIR_ENABLE_CUDA_RUNNER + MLIR_ENABLE_ROCM_CONVERSIONS + MLIR_ENABLE_ROCM_RUNNER + MLIR_ENABLE_SPIRV_CPU_RUNNER + MLIR_ENABLE_VULKAN_RUNNER ) # Passed to lit.site.cfg.py.in to set up the path where to find the libraries @@ -76,11 +76,11 @@ mlir_async_runtime ) -if(MLIR_CUDA_RUNNER_ENABLED) +if(MLIR_ENABLE_CUDA_RUNNER) list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime) endif() -if(MLIR_ROCM_RUNNER_ENABLED) +if(MLIR_ENABLE_ROCM_RUNNER) list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime) endif() @@ -98,7 +98,7 @@ ) endif() -if(MLIR_SPIRV_CPU_RUNNER_ENABLED) +if(MLIR_ENABLE_SPIRV_CPU_RUNNER) add_subdirectory(mlir-spirv-cpu-runner) list(APPEND MLIR_TEST_DEPENDS mlir-spirv-cpu-runner @@ -106,13 +106,13 @@ ) endif() -if(MLIR_VULKAN_RUNNER_ENABLED) +if(MLIR_ENABLE_VULKAN_RUNNER) list(APPEND MLIR_TEST_DEPENDS mlir-vulkan-runner ) endif() -if(MLIR_BINDINGS_PYTHON_ENABLED) +if(MLIR_ENABLE_BINDINGS_PYTHON) list(APPEND MLIR_TEST_DEPENDS MLIRBindingsPythonExtension MLIRBindingsPythonSources diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -36,15 +36,15 @@ config.mlir_tools_dir = "@MLIR_TOOLS_DIR@" config.linalg_test_lib_dir = "@MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR@" config.build_examples = @LLVM_BUILD_EXAMPLES@ -config.run_cuda_tests = @MLIR_CUDA_CONVERSIONS_ENABLED@ -config.enable_cuda_runner = @MLIR_CUDA_RUNNER_ENABLED@ -config.run_rocm_tests = @MLIR_ROCM_CONVERSIONS_ENABLED@ -config.enable_rocm_runner = @MLIR_ROCM_RUNNER_ENABLED@ +config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@ +config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@ +config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@ +config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@ config.spirv_wrapper_library_dir = "@MLIR_SPIRV_WRAPPER_LIBRARY_DIR@" -config.enable_spirv_cpu_runner = @MLIR_SPIRV_CPU_RUNNER_ENABLED@ +config.enable_spirv_cpu_runner = @MLIR_ENABLE_SPIRV_CPU_RUNNER@ config.vulkan_wrapper_library_dir = "@MLIR_VULKAN_WRAPPER_LIBRARY_DIR@" -config.enable_vulkan_runner = @MLIR_VULKAN_RUNNER_ENABLED@ -config.enable_bindings_python = @MLIR_BINDINGS_PYTHON_ENABLED@ +config.enable_vulkan_runner = @MLIR_ENABLE_VULKAN_RUNNER@ +config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@ config.mlir_integration_test_dir = "@MLIR_INTEGRATION_TEST_DIR@" config.intel_sde_executable = "@INTEL_SDE_EXECUTABLE@" config.mlir_run_amx_tests = "@MLIR_RUN_AMX_TESTS@"