Skip to content

Commit 7b8d0bd

Browse files
Enable TOSA conversions in bazel build rules (#4023)
Follows #4021. Also pushes a small pre-commit fix. Bazel CI triggered here: https://github.com/sjain-stanford/torch-mlir/actions/runs/13297425038/job/37132415527
1 parent aa74936 commit 7b8d0bd

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

build_tools/autogen_ltc_backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
try:
3535
from yaml import CSafeLoader as Loader
3636
except ImportError:
37-
from yaml import SafeLoader as Loader #type:ignore[assignment, misc]
37+
from yaml import SafeLoader as Loader # type:ignore[assignment, misc]
38+
3839

3940
def reindent(text, prefix=""):
4041
return indent(dedent(text), prefix)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ gentbl_cc_library(
278278
[
279279
"-gen-pass-decls",
280280
"-DTORCH_MLIR_ENABLE_STABLEHLO",
281+
"-DTORCH_MLIR_ENABLE_TOSA",
281282
],
282283
"include/torch-mlir/Conversion/Passes.h.inc",
283284
),
@@ -334,6 +335,7 @@ gentbl_cc_library(
334335
[
335336
"-gen-pass-decls",
336337
"-DTORCH_MLIR_ENABLE_STABLEHLO",
338+
"-DTORCH_MLIR_ENABLE_TOSA",
337339
],
338340
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h.inc",
339341
),
@@ -542,6 +544,7 @@ cc_library(
542544
],
543545
defines = [
544546
"TORCH_MLIR_ENABLE_STABLEHLO",
547+
"TORCH_MLIR_ENABLE_TOSA",
545548
],
546549
strip_include_prefix = "include",
547550
deps = [
@@ -566,6 +569,7 @@ cc_library(
566569
hdrs = glob(["include/torch-mlir/Dialect/TorchConversion/Transforms/*.h"]),
567570
defines = [
568571
"TORCH_MLIR_ENABLE_STABLEHLO",
572+
"TORCH_MLIR_ENABLE_TOSA",
569573
],
570574
strip_include_prefix = "include",
571575
deps = [
@@ -600,6 +604,9 @@ cc_library(
600604
"lib/Conversion/TorchToTosa/*.cpp",
601605
]),
602606
hdrs = glob(["include/torch-mlir/Conversion/TorchToTosa/*.h"]),
607+
defines = [
608+
"TORCH_MLIR_ENABLE_TOSA",
609+
],
603610
strip_include_prefix = "include",
604611
deps = [
605612
":TorchMLIRConversionPassesIncGen",
@@ -887,6 +894,7 @@ cc_library(
887894
copts = [
888895
"-DTORCH_MLIR_ENABLE_REFBACKEND",
889896
"-DTORCH_MLIR_ENABLE_STABLEHLO",
897+
"-DTORCH_MLIR_ENABLE_TOSA",
890898
],
891899
strip_include_prefix = "include",
892900
deps = [

0 commit comments

Comments
 (0)