18
18
#include " torch-mlir/Conversion/TorchToSCF/TorchToSCF.h"
19
19
#include " torch-mlir/Conversion/TorchToTMTensor/TorchToTMTensor.h"
20
20
#include " torch-mlir/Conversion/TorchToTensor/TorchToTensor.h"
21
- #include " torch-mlir/Conversion/TorchToTosa/TorchToTosa.h"
22
21
#include " torch-mlir/Dialect/Torch/Transforms/Passes.h"
22
+
23
23
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
24
24
#include " stablehlo/transforms/Passes.h"
25
25
#include " torch-mlir/Conversion/TorchToStablehlo/TorchToStablehlo.h"
26
26
#endif
27
- #include " torch-mlir/Dialect/Torch/Transforms/Passes.h"
27
+
28
+ #ifdef TORCH_MLIR_ENABLE_TOSA
29
+ #include " torch-mlir/Conversion/TorchToTosa/TorchToTosa.h"
30
+ using namespace mlir ::tosa;
31
+ #endif
28
32
29
33
using namespace mlir ;
30
34
using namespace mlir ::torch;
31
- using namespace mlir ::tosa;
32
35
33
36
// ===----------------------------------------------------------------------===//
34
37
// Pass registration
@@ -46,12 +49,13 @@ void mlir::torch::registerTorchConversionPasses() {
46
49
" Pipeline lowering torch backend contract to linalg-on-tensors backend "
47
50
" contract." ,
48
51
TorchConversion::createTorchBackendToLinalgOnTensorsBackendPipeline);
49
-
52
+ # ifdef TORCH_MLIR_ENABLE_TOSA
50
53
mlir::PassPipelineRegistration<>(
51
54
" torch-backend-to-tosa-backend-pipeline" ,
52
55
" Pipeline lowering torch backend contract to TOSA backend "
53
56
" contract." ,
54
57
TorchConversion::createTorchBackendToTosaBackendPipeline);
58
+ #endif
55
59
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
56
60
mlir::PassPipelineRegistration<
57
61
TorchConversion::StablehloBackendPipelineOptions>(
@@ -107,6 +111,7 @@ void TorchConversion::createTorchBackendToLinalgOnTensorsBackendPipeline(
107
111
pm.addPass (TorchConversion::createVerifyLinalgOnTensorsBackendContractPass ());
108
112
}
109
113
114
+ #ifdef TORCH_MLIR_ENABLE_TOSA
110
115
void TorchConversion::createTorchBackendToTosaBackendPipeline (
111
116
OpPassManager &pm) {
112
117
pm.addNestedPass <func::FuncOp>(createConvertTorchToTosaPass ());
@@ -130,6 +135,7 @@ void TorchConversion::createTorchBackendToTosaBackendPipeline(
130
135
// correct form.
131
136
pm.addPass (TorchConversion::createVerifyTosaBackendContractPass ());
132
137
}
138
+ #endif
133
139
134
140
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
135
141
void TorchConversion::createTorchBackendToStablehloBackendPipeline (
0 commit comments