Skip to content

Commit c09aee6

Browse files
author
TanyoKwok
committed
guard with macro
1 parent 7773940 commit c09aee6

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ def VerifyTosaBackendContract : Pass<"torch-verify-tosa-backend-contract", "Modu
4242
let constructor = "mlir::torch::TorchConversion::createVerifyTosaBackendContractPass()";
4343
}
4444

45+
#ifdef TORCH_MLIR_ENABLE_MHLO
4546
def VerifyMhloBackendContract : Pass<"torch-verify-mhlo-backend-contract", "ModuleOp"> {
4647
let summary = "Verifies conformity to the mhlo backend contract";
4748
let constructor = "mlir::torch::TorchConversion::createVerifyMhloBackendContractPass()";
4849
}
50+
#endif // TORCH_MLIR_ENABLE_MHLO
4951
#endif // TORCHMLIR_TORCHCONVERSION_PASSES

lib/Dialect/TorchConversion/Transforms/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ set(LinkedLibs MLIRIR
1212

1313
if(TORCH_MLIR_ENABLE_MHLO)
1414
list(APPEND LinkedLibs ChloPasses)
15-
list(APPEND MhloContract VerifyMhloBackendContract.cpp)
1615
endif()
1716

1817
add_mlir_library(TorchMLIRTorchConversionPasses
@@ -21,8 +20,7 @@ add_mlir_library(TorchMLIRTorchConversionPasses
2120
Passes.cpp
2221
VerifyLinalgOnTensorsBackendContract.cpp
2322
VerifyTosaBackendContract.cpp
24-
${MhloContract}
25-
23+
VerifyMhloBackendContract.cpp
2624

2725
ADDITIONAL_HEADER_DIRS
2826
${PROJECT_SOURCE_DIR}/include/torch-mlir/Dialect/TorchConversion/Transforms

lib/Dialect/TorchConversion/Transforms/VerifyMhloBackendContract.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Also available under a BSD-style license. See LICENSE.
77
//
88
//===----------------------------------------------------------------------===//
9-
9+
#ifdef TORCH_MLIR_ENABLE_MHLO
1010
#include "PassDetail.h"
1111

1212
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
@@ -70,3 +70,4 @@ std::unique_ptr<OperationPass<ModuleOp>>
7070
mlir::torch::TorchConversion::createVerifyMhloBackendContractPass() {
7171
return std::make_unique<VerifyMhloBackendContractPass>();
7272
}
73+
#endif // TORCH_MLIR_ENABLE_MHLO

utils/bazel/torch-mlir-overlay/BUILD.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ gentbl_cc_library(
314314
strip_include_prefix = "include",
315315
tbl_outs = [
316316
(
317-
["-gen-pass-decls"],
317+
[
318+
"-gen-pass-decls",
319+
"-DTORCH_MLIR_ENABLE_MHLO",
320+
],
318321
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h.inc",
319322
),
320323
],
@@ -502,6 +505,7 @@ cc_library(
502505
"lib/Dialect/TorchConversion/Transforms/Passes.cpp",
503506
"lib/Dialect/TorchConversion/Transforms/VerifyLinalgOnTensorsBackendContract.cpp",
504507
"lib/Dialect/TorchConversion/Transforms/VerifyTosaBackendContract.cpp",
508+
"lib/Dialect/TorchConversion/Transforms/VerifyMhloBackendContract.cpp",
505509
],
506510
hdrs = [
507511
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h",

0 commit comments

Comments
 (0)