Skip to content

Commit 49fdc1a

Browse files
Add bazel targets for TorchOnnxToTorch conversion passes (#2596)
Adapts to the TorchOnnxToTorch changes from #2585. Also restores bazel builds in post-merge CI that was disabled in 2148c4c. Bazel workflow: https://github.com/sjain-stanford/torch-mlir/actions/runs/7023912962
1 parent dc9ea08 commit 49fdc1a

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

.github/workflows/bazelBuildAndTest.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Bazel Build and Test
22

33
on:
4-
# TODO: Fix bazel build after US holidays of 2023-Nov-23 and re-enable.
5-
# push:
6-
# branches: [ main ]
4+
push:
5+
branches: [ main ]
76
workflow_dispatch:
87

98
# Ensure that only a single job or workflow using the same

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,31 @@ gentbl_cc_library(
282282
],
283283
)
284284

285+
td_library(
286+
name = "TorchMLIRConversionTorchOnnxToTorchPassTdFiles",
287+
srcs = [
288+
"include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.td",
289+
],
290+
includes = ["include"],
291+
)
292+
293+
gentbl_cc_library(
294+
name = "TorchMLIRConversionTorchOnnxToTorchPassIncGen",
295+
strip_include_prefix = "include",
296+
tbl_outs = [
297+
(
298+
["-gen-pass-decls"],
299+
"include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.h.inc",
300+
),
301+
],
302+
tblgen = "@llvm-project//mlir:mlir-tblgen",
303+
td_file = "include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.td",
304+
deps = [
305+
":TorchMLIRConversionTorchOnnxToTorchPassTdFiles",
306+
"@llvm-project//mlir:PassBaseTdFiles",
307+
],
308+
)
309+
285310
# TorchConversion transforms
286311
td_library(
287312
name = "TorchMLIRTorchConversionPassesTdFiles",
@@ -454,6 +479,22 @@ cc_library(
454479
],
455480
)
456481

482+
cc_library(
483+
name = "TorchMLIRTorchOnnxToTorch",
484+
srcs = glob([
485+
"lib/Conversion/TorchOnnxToTorch/*.h",
486+
"lib/Conversion/TorchOnnxToTorch/*.cpp",
487+
]),
488+
hdrs = glob(["include/torch-mlir/Conversion/TorchOnnxToTorch/*.h"]),
489+
strip_include_prefix = "include",
490+
deps = [
491+
":TorchMLIRConversionTorchOnnxToTorchPassIncGen",
492+
":TorchMLIRTorchDialect",
493+
"@llvm-project//mlir:IR",
494+
"@llvm-project//mlir:Pass",
495+
],
496+
)
497+
457498
cc_library(
458499
name = "TorchMLIRConversionPasses",
459500
srcs = [
@@ -468,6 +509,7 @@ cc_library(
468509
strip_include_prefix = "include",
469510
deps = [
470511
":TorchMLIRTorchConversionToMLProgram",
512+
":TorchMLIRTorchOnnxToTorch",
471513
":TorchMLIRTorchToArith",
472514
":TorchMLIRTorchToLinalg",
473515
":TorchMLIRTorchToSCF",

0 commit comments

Comments
 (0)