[MLIR] Make MLIR cmake variable names consistent
Fix inconsistent MLIR CMake variable names. Consistently name them as MLIR_ENABLE_<feature>. Eg: MLIR_CUDA_RUNNER_ENABLED -> MLIR_ENABLE_CUDA_RUNNER MLIR follows (or has mostly followed) the convention of naming cmake enabling variables in the from MLIR_ENABLE_... etc. Using a convention here is easy and also important for convenience. A counter pattern was started with variables named MLIR_..._ENABLED. This led to a sequence of related counter patterns: MLIR_CUDA_RUNNER_ENABLED, MLIR_ROCM_RUNNER_ENABLED, etc.. From a naming standpoint, the imperative form is more meaningful. Additional discussion at: https://llvm.discourse.group/t/mlir-cmake-enable-variable-naming-convention/3520 Switch all inconsistent ones to the ENABLE form. Keep the couple of old mappings needed until buildbot config is migrated. Differential Revision: https://reviews.llvm.org/D102976
This commit is contained in:
parent
000a05fd1a
commit
9c21ddb70a
|
@ -56,26 +56,33 @@ add_custom_target(mlir-doc)
|
|||
# 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 @@ option(MLIR_INCLUDE_INTEGRATION_TESTS
|
|||
# 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 @@ endif()
|
|||
# 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()
|
||||
|
|
|
@ -24,7 +24,7 @@ function(add_mlir_python_extension libname extname)
|
|||
# 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()
|
||||
|
|
|
@ -12,7 +12,7 @@ Current status: Under development and not enabled by default
|
|||
|
||||
### CMake variables
|
||||
|
||||
* **`MLIR_BINDINGS_PYTHON_ENABLED`**`:BOOL`
|
||||
* **`MLIR_ENABLE_BINDINGS_PYTHON`**`:BOOL`
|
||||
|
||||
Enables building the Python bindings. Defaults to `OFF`.
|
||||
|
||||
|
@ -23,7 +23,7 @@ Current status: Under development and not enabled by default
|
|||
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
|
||||
|
|
|
@ -820,7 +820,7 @@ supported.
|
|||
|
||||
To build the runner, add the following option to `cmake`:
|
||||
```bash
|
||||
-DMLIR_SPIRV_CPU_RUNNER_ENABLED=1
|
||||
-DMLIR_ENABLE_SPIRV_CPU_RUNNER=1
|
||||
```
|
||||
|
||||
### Pipeline
|
||||
|
|
|
@ -12,7 +12,7 @@ emit corresponding `linalg.generic` IR for the composition.
|
|||
|
||||
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.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
if(MLIR_BINDINGS_PYTHON_ENABLED)
|
||||
if(MLIR_ENABLE_BINDINGS_PYTHON)
|
||||
add_subdirectory(Python)
|
||||
endif()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if (MLIR_CUDA_CONVERSIONS_ENABLED)
|
||||
if (MLIR_ENABLE_CUDA_CONVERSIONS)
|
||||
set(NVPTX_LIBS
|
||||
NVPTXCodeGen
|
||||
NVPTXDesc
|
||||
|
@ -6,7 +6,7 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (MLIR_ROCM_CONVERSIONS_ENABLED)
|
||||
if (MLIR_ENABLE_ROCM_CONVERSIONS)
|
||||
set(AMDGPU_LIBS
|
||||
AMDGPUCodeGen
|
||||
AMDGPUDesc
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if (MLIR_CUDA_CONVERSIONS_ENABLED)
|
||||
if (MLIR_ENABLE_CUDA_CONVERSIONS)
|
||||
set(NVPTX_LIBS
|
||||
NVPTXCodeGen
|
||||
NVPTXDesc
|
||||
|
@ -6,7 +6,7 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (MLIR_ROCM_CONVERSIONS_ENABLED)
|
||||
if (MLIR_ENABLE_ROCM_CONVERSIONS)
|
||||
set(AMDGPU_LIBS
|
||||
MCParser
|
||||
AMDGPUAsmParser
|
||||
|
@ -59,8 +59,8 @@ add_mlir_dialect_library(MLIRGPU
|
|||
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 @@ if(MLIR_CUDA_RUNNER_ENABLED)
|
|||
|
||||
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")
|
||||
|
|
|
@ -106,7 +106,7 @@ add_mlir_library(mlir_async_runtime
|
|||
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 @@ if(MLIR_CUDA_RUNNER_ENABLED)
|
|||
)
|
||||
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})
|
||||
|
|
|
@ -2,19 +2,19 @@ add_subdirectory(CAPI)
|
|||
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 @@ set(MLIR_TEST_DEPENDS
|
|||
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 @@ if(LLVM_BUILD_EXAMPLES)
|
|||
)
|
||||
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 @@ if(MLIR_SPIRV_CPU_RUNNER_ENABLED)
|
|||
)
|
||||
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
|
||||
|
|
|
@ -36,15 +36,15 @@ config.mlir_runner_utils_dir = "@MLIR_RUNNER_UTILS_DIR@"
|
|||
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@"
|
||||
|
|
Loading…
Reference in a new issue