Skip to content

Commit 47c5873

Browse files
Merge branch 'main' into rahuls/verbose_mode
2 parents 9a90d60 + 38a0a5a commit 47c5873

37 files changed

+1439
-558
lines changed

.github/actions/setup-build/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
steps:
2828
- name: Set up Python
2929
if: ${{ runner.arch == 'X64' }}
30-
uses: actions/setup-python@v4
30+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
3131
with:
3232
python-version: '3.11'
3333

@@ -74,7 +74,7 @@ runs:
7474

7575
- name: Enable ccache
7676
if: ${{ inputs.cache-enabled == 'true' }}
77-
uses: actions/cache@v3
77+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
7878
with:
7979
path: ${{ github.workspace }}/.ccache
8080
key: ${{ runner.os }}-${{ inputs.cache-suffix }}-${{ github.sha }}

.github/workflows/RollPyTorch.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
sudo rm -rf $GITHUB_WORKSPACE/*
2323
2424
- name: Get torch-mlir
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2626
with:
2727
submodules: 'false'
2828
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
@@ -95,7 +95,7 @@ jobs:
9595
9696
- name: Post issue comment on build failure
9797
if: failure()
98-
uses: peter-evans/create-or-update-comment@v2
98+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
9999
with:
100100
issue-number: 1690
101101
body: |
@@ -111,7 +111,7 @@ jobs:
111111
- name: Update PyTorch Build Cache (if running on main branch)
112112
if: github.ref_name == 'main'
113113
id: cache-pytorch
114-
uses: actions/cache@v3
114+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
115115
with:
116116
path: ${{ github.workspace }}/build_tools/python_deploy/wheelhouse
117117
key: ${{ runner.os }}-pytorch-${{ env.PT_HASH }}
@@ -127,7 +127,7 @@ jobs:
127127
git pull origin main
128128
129129
- name: Create pull request
130-
uses: peter-evans/create-pull-request@v5.0.1
130+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
131131
with:
132132
author: Roll PyTorch Action <[email protected]>
133133
branch: rollpytorch

.github/workflows/bazelBuildAndTest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
jobs:
2323
ubuntu-build:
2424
name: ubuntu-x86_64
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-22.04
2626

2727
steps:
2828
- name: Prepare workspace
@@ -32,15 +32,15 @@ jobs:
3232
sudo rm -rf $GITHUB_WORKSPACE/*
3333
3434
- name: Checkout torch-mlir
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636
with:
3737
submodules: 'true'
3838

3939
# Continually update cache even if there's a "hit" during
4040
# restore to avoid the cache going stale over time
4141
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
4242
- name: Setup cache for bazel
43-
uses: actions/cache@v3
43+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
4444
with:
4545
path: ~/.cache/bazel
4646
key: torch_mlir-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
@@ -102,7 +102,7 @@ jobs:
102102
103103
- name: Send mail
104104
if: failure()
105-
uses: dawidd6/action-send-mail@v3
105+
uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0
106106
with:
107107
server_address: ${{ secrets.SMTP_SERVER }}
108108
server_port: ${{ secrets.SMTP_PORT }}

.github/workflows/buildRelease.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
sudo rm -rf $GITHUB_WORKSPACE/*
2929
3030
- name: Get torch-mlir
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3232
with:
3333
submodules: 'true'
3434
fetch-depth: 0
@@ -59,7 +59,7 @@ jobs:
5959
- name: Publish Release (if requested)
6060
if: github.event.inputs.release_id != ''
6161
id: publish_release
62-
uses: eregon/publish-release@v1
62+
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
6363
env:
6464
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
6565
with:
@@ -75,7 +75,7 @@ jobs:
7575
#
7676
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
7777
- name: Store the binary wheel
78-
uses: actions/upload-artifact@v2
78+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
7979
with:
8080
name: wheels
8181
path: dist
@@ -96,7 +96,7 @@ jobs:
9696
sudo rm -rf $GITHUB_WORKSPACE/*
9797
9898
- name: Get torch-mlir
99-
uses: actions/checkout@v3
99+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100100
with:
101101
submodules: 'true'
102102
fetch-depth: 0
@@ -127,7 +127,7 @@ jobs:
127127
- name: Publish Release (if requested)
128128
if: github.event.inputs.release_id != ''
129129
id: publish_release
130-
uses: eregon/publish-release@v1
130+
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
131131
env:
132132
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
133133
with:
@@ -143,7 +143,7 @@ jobs:
143143
#
144144
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
145145
- name: Store the binary wheel
146-
uses: actions/upload-artifact@v2
146+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
147147
with:
148148
name: wheels
149149
path: dist
@@ -156,7 +156,7 @@ jobs:
156156
package: [torch-mlir]
157157
steps:
158158
- name: Get torch-mlir
159-
uses: actions/checkout@v3
159+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
160160
with:
161161
submodules: 'true'
162162
- uses: ./.github/actions/setup-build
@@ -187,7 +187,7 @@ jobs:
187187
- name: Publish Release (if requested)
188188
if: github.event.inputs.release_id != ''
189189
id: publish_release
190-
uses: eregon/publish-release@v1
190+
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
191191
env:
192192
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
193193
with:
@@ -203,7 +203,7 @@ jobs:
203203
#
204204
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
205205
- name: Store the binary wheel
206-
uses: actions/upload-artifact@v2
206+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
207207
with:
208208
name: wheels
209209
path: dist
@@ -216,7 +216,7 @@ jobs:
216216
package: [torch-mlir]
217217
steps:
218218
- name: Get torch-mlir
219-
uses: actions/checkout@v3
219+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
220220
with:
221221
submodules: 'true'
222222
- uses: ./.github/actions/setup-build
@@ -250,7 +250,7 @@ jobs:
250250
- name: Publish Release (if requested)
251251
if: github.event.inputs.release_id != ''
252252
id: publish_release
253-
uses: eregon/publish-release@v1
253+
uses: eregon/publish-release@01df127f5e9a3c26935118e22e738d95b59d10ce # v1.0.6
254254
env:
255255
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
256256
with:
@@ -267,13 +267,13 @@ jobs:
267267
#
268268
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
269269
- name: Store the binary wheel
270-
uses: actions/upload-artifact@v2
270+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
271271
with:
272272
name: wheels
273273
path: dist
274274

275275
publish_releases:
276-
runs-on: ubuntu-latest
276+
runs-on: ubuntu-22.04
277277
needs:
278278
- build_linux
279279
- build_linux_arm64
@@ -285,7 +285,7 @@ jobs:
285285

286286
steps:
287287
- name: Invoke Publish Releases Page
288-
uses: benc-uk/workflow-dispatch@v1
288+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
289289
with:
290290
workflow: Publish releases page
291291
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

.github/workflows/gh-pages-releases.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
scrape_and_publish_releases:
1010
name: "Scrape and publish releases"
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212

1313
# Don't run this in everyone's forks.
1414
if: github.repository == 'llvm/torch-mlir'
@@ -20,7 +20,7 @@ jobs:
2020
# existing lock files.
2121
sudo rm -rf $GITHUB_WORKSPACE/*
2222
- name: Checking out repository
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2424
with:
2525
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
2626
- name: Run scrape releases script

.github/workflows/merge-rollpytorch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
merge-pr:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313
if: |
1414
github.repository == 'llvm/torch-mlir' &&
1515
github.event.workflow_run.actor.login == 'stellaraccident' &&
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
# Fetch the repo first so that the gh command knows where to look for the PR
2020
- name: Fetch Repo
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222
with:
2323
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
2424

.github/workflows/oneshotSnapshotPackage.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
sudo rm -rf $GITHUB_WORKSPACE/*
1919
2020
- name: Checking out repository
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222
with:
2323
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
2424

@@ -43,16 +43,15 @@ jobs:
4343

4444
- name: Create Release
4545
id: create_release
46-
uses: actions/create-release@v1
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
46+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
4947
with:
50-
tag_name: ${{ env.tag_name }}
51-
release_name: torch-mlir snapshot ${{ env.tag_name }}
48+
tag: ${{ env.tag_name }}
49+
name: torch-mlir snapshot ${{ env.tag_name }}
5250
body: |
5351
Automatic snapshot release of torch-mlir.
5452
draft: true
5553
prerelease: false
54+
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
5655

5756
- name: "Invoke workflow :: Build and Test"
5857
uses: benc-uk/workflow-dispatch@v1

.github/workflows/pre-commit-all.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on:
66

77
jobs:
88
pre-commit:
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v3
13-
- uses: pre-commit/[email protected]
11+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
13+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
1414
with:
1515
extra_args: --color=always --all-files

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55

66
jobs:
77
pre-commit:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-22.04
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1111
with:
1212
# requites to grab the history of the PR
1313
fetch-depth: 0
14-
- uses: actions/setup-python@v3
15-
- uses: pre-commit/[email protected]
14+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
15+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
1616
with:
1717
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}

.github/workflows/releaseSnapshotPackage.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
release_snapshot_package:
1111
name: "Tag snapshot release"
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313
# Don't run this in everyone's forks.
1414
if: github.repository == 'llvm/torch-mlir'
1515
steps:
@@ -21,7 +21,7 @@ jobs:
2121
sudo rm -rf $GITHUB_WORKSPACE/*
2222
2323
- name: Checking out repository
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2525
with:
2626
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
2727

@@ -46,26 +46,25 @@ jobs:
4646

4747
- name: Create Release
4848
id: create_release
49-
uses: actions/create-release@v1
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
49+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
5250
with:
53-
tag_name: ${{ env.tag_name }}
54-
release_name: torch-mlir snapshot ${{ env.tag_name }}
51+
tag: ${{ env.tag_name }}
52+
name: torch-mlir snapshot ${{ env.tag_name }}
5553
body: |
5654
Automatic snapshot release of torch-mlir.
5755
draft: true
5856
prerelease: false
57+
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
5958

6059
- name: "Invoke workflow :: Build and Test"
61-
uses: benc-uk/workflow-dispatch@v1
60+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
6261
with:
6362
workflow: Build and Test
6463
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
6564
ref: "${{ env.tag_name }}"
6665

6766
- name: "Invoke workflow :: Release Build"
68-
uses: benc-uk/workflow-dispatch@v1
67+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
6968
with:
7069
workflow: Release Build
7170
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212

1313
#include "mlir/Dialect/Func/IR/FuncOps.h"
1414
#include "mlir/Pass/Pass.h"
15+
#include "mlir/Transforms/DialectConversion.h"
16+
1517
#include <memory>
1618

1719
namespace mlir {
1820
namespace torch {
21+
22+
/// Collect a set of legal/illegal ops for converting Torch operations to Tosa
23+
/// dialect.
24+
void populateTorchToTosaConversionLegalOps(ConversionTarget &target);
25+
26+
/// Collect a set of patterns to convert Torch operations to Tosa dialect +
27+
/// return the set of illegalOps
28+
std::set<StringRef>
29+
populateTorchToTosaConversionPatternsAndIllegalOps(TypeConverter &typeConverter,
30+
RewritePatternSet &patterns);
31+
1932
std::unique_ptr<OperationPass<func::FuncOp>> createConvertTorchToTosaPass();
20-
}
33+
} // namespace torch
2134
} // namespace mlir
2235

2336
#endif // TORCHMLIR_CONVERSION_TORCHTOTOSA_TORCHTOTOSA_H

0 commit comments

Comments
 (0)