Skip to content

Commit be15a6b

Browse files
[mlir][opt] Expose MLIR_ENABLE_DEPRECATED_GPU_SER... in mlir-config.h. (#84006)
This is another follow-up of #83004, which made the same change for `MLIR_CUDA_CONVERSIONS_ENABLED`. As the previous PR, this PR commit exposes mentioned CMake variable through `mlir-config.h` and uses the macro that is introduced with the same name. This replaces the macro `MLIR_ENABLE_DEPRECATED_GPU_SERIALIZATION`, which the CMake files previously defined manually.
1 parent c486d90 commit be15a6b

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

mlir/include/mlir/Config/mlir-config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#ifndef MLIR_CONFIG_H
1414
#define MLIR_CONFIG_H
1515

16+
/* If set, enable deprecated serialization passes. */
17+
#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE
18+
1619
/* Enable expensive checks to detect invalid pattern API usage. Failed checks
1720
manifest as fatal errors or invalid memory accesses (e.g., accessing
1821
deallocated memory) that cause a crash. Running with ASAN is recommended for

mlir/tools/mlir-opt/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,3 @@ llvm_update_compile_flags(mlir-opt)
106106

107107
mlir_check_all_link_libraries(mlir-opt)
108108
export_executable_symbols_for_plugins(mlir-opt)
109-
110-
if(MLIR_ENABLE_DEPRECATED_GPU_SERIALIZATION)
111-
# Enable deprecated serialization passes.
112-
target_compile_definitions(mlir-opt
113-
PRIVATE
114-
MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE=1
115-
)
116-
endif()

mlir/tools/mlir-opt/mlir-opt.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "mlir/Config/mlir-config.h"
1314
#include "mlir/IR/AsmState.h"
1415
#include "mlir/IR/Dialect.h"
1516
#include "mlir/IR/MLIRContext.h"
@@ -277,7 +278,7 @@ void registerTestPasses() {
277278

278279
int main(int argc, char **argv) {
279280
registerAllPasses();
280-
#if MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE == 1
281+
#if MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE
281282
registerGpuSerializeToCubinPass();
282283
registerGpuSerializeToHsacoPass();
283284
#endif

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ expand_template(
3232
name = "mlir_config_h_gen",
3333
out = "include/mlir/Config/mlir-config.h",
3434
substitutions = {
35+
"#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE": "#define MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE 0",
3536
"#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0",
3637
"#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}": "/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */",
3738
"#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH": "#define MLIR_ENABLE_PDL_IN_PATTERNMATCH 1",
@@ -9172,6 +9173,7 @@ cc_binary(
91729173
":SCFToGPU",
91739174
":Support",
91749175
":Transforms",
9176+
":config",
91759177
"//llvm:AllTargetsCodeGens",
91769178
"//llvm:Support",
91779179
"//mlir/test:TestAffine",

0 commit comments

Comments
 (0)