Skip to content

[mlir][opt] Expose MLIR_ENABLE_DEPRECATED_GPU_SER... in mlir-config.h. #84006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mlir/include/mlir/Config/mlir-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#ifndef MLIR_CONFIG_H
#define MLIR_CONFIG_H

/* If set, enable deprecated serialization passes. */
#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE

/* Enable expensive checks to detect invalid pattern API usage. Failed checks
manifest as fatal errors or invalid memory accesses (e.g., accessing
deallocated memory) that cause a crash. Running with ASAN is recommended for
Expand Down
8 changes: 0 additions & 8 deletions mlir/tools/mlir-opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,3 @@ llvm_update_compile_flags(mlir-opt)

mlir_check_all_link_libraries(mlir-opt)
export_executable_symbols_for_plugins(mlir-opt)

if(MLIR_ENABLE_DEPRECATED_GPU_SERIALIZATION)
# Enable deprecated serialization passes.
target_compile_definitions(mlir-opt
PRIVATE
MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE=1
)
endif()
3 changes: 2 additions & 1 deletion mlir/tools/mlir-opt/mlir-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

#include "mlir/Config/mlir-config.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/MLIRContext.h"
Expand Down Expand Up @@ -277,7 +278,7 @@ void registerTestPasses() {

int main(int argc, char **argv) {
registerAllPasses();
#if MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE == 1
#if MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE
registerGpuSerializeToCubinPass();
registerGpuSerializeToHsacoPass();
#endif
Expand Down
2 changes: 2 additions & 0 deletions utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ expand_template(
name = "mlir_config_h_gen",
out = "include/mlir/Config/mlir-config.h",
substitutions = {
"#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE": "#define MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE 0",
"#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0",
"#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}": "/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */",
"#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH": "#define MLIR_ENABLE_PDL_IN_PATTERNMATCH 1",
Expand Down Expand Up @@ -9171,6 +9172,7 @@ cc_binary(
":SCFToGPU",
":Support",
":Transforms",
":config",
"//llvm:AllTargetsCodeGens",
"//llvm:Support",
"//mlir/test:TestAffine",
Expand Down