-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Julia bindings to MLIR dialects out of JLL (#166)
* Rename generated dialect file names * Add dialect binding file generator script * Generate dialect files * Automatize dialect regeneration * Fix paths * Fix docs generation
- Loading branch information
Showing
13 changed files
with
9,796 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Regenerate MLIR Dialects | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
jobs: | ||
make: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1.10' | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- run: julia deps/ReactantExtra/make-dialects.jl | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Regenerate MLIR Dialects | ||
title: 'Regenerate MLIR Dialects' | ||
branch: regenerate-dialects | ||
delete-branch: true | ||
- name: Check outputs | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
for file in [ | ||
"Builtin.jl", | ||
"Arith.jl", | ||
"Affine.jl", | ||
"Func.jl", | ||
"Enzyme.jl", | ||
"StableHLO.jl", | ||
"CHLO.jl", | ||
"VHLO.jl", | ||
] | ||
run( | ||
`bazel build --action_env=JULIA=$(Base.julia_cmd().exec[1]) --repo_env HERMETIC_PYTHON_VERSION="3.10" --check_visibility=false --verbose_failures //:$file`, | ||
) | ||
Base.Filesystem.cp( | ||
joinpath(@__DIR__, "bazel-bin", file), | ||
joinpath(dirname(dirname(@__DIR__)), "src", "mlir", "Dialects", file), | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,6 @@ pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..")) # add Enzyme to environment stac | |
|
||
using Reactant | ||
using Documenter | ||
using Reactant_jll | ||
|
||
struct TestRemote <: Remotes.Remote end | ||
Remotes.repourl(::TestRemote) = "https://github.com/JuliaBinaryWrappers/Reactant_jll.jl" | ||
function Remotes.fileurl(::TestRemote, ::Any, filename, linerange) | ||
L1, L2 = first(linerange), last(linerange) | ||
return "https://github.com/JuliaBinaryWrappers/Reactant_jll.jl/$(filename)#L$(L1)-$(L2)" | ||
end | ||
function Remotes.issueurl(::TestRemote, issue) | ||
return "https://github.com/EnzymeAD/Reactant.jl/blob/$(issue)" | ||
end | ||
|
||
DocMeta.setdocmeta!(Reactant, :DocTestSetup, :(using Reactant); recursive=true) | ||
|
||
|
@@ -30,19 +19,6 @@ for (_, name) in examples | |
Literate.markdown(example_filepath, OUTPUT_DIR; documenter=true) | ||
end | ||
|
||
run(Cmd(`rm -rf .git`; dir=Reactant_jll.artifact_dir)) | ||
run(Cmd(`git init`; dir=Reactant_jll.artifact_dir)) | ||
run(Cmd(`git config user.name ReactantDocs`; dir=Reactant_jll.artifact_dir)) | ||
run(Cmd(`git config user.email [email protected]`; dir=Reactant_jll.artifact_dir)) | ||
run( | ||
Cmd( | ||
`git remote add origin https://github.com/EnzymeAD/Reactant.jl`; | ||
dir=Reactant_jll.artifact_dir, | ||
), | ||
) | ||
run(Cmd(`git add -A`; dir=Reactant_jll.artifact_dir)) | ||
run(Cmd(`git commit -m "Initial commit"`; dir=Reactant_jll.artifact_dir)) | ||
|
||
examples = [ | ||
title => joinpath("generated", string(name, ".md")) for (title, name) in examples | ||
] | ||
|
@@ -66,11 +42,6 @@ makedocs(; | |
Reactant.MLIR.Dialects.builtin, | ||
], | ||
authors="William Moses <[email protected]>, Valentin Churavy <[email protected]>", | ||
remotes=Dict( | ||
# Just non-repository directories | ||
joinpath(@__DIR__, "..") => gh, | ||
Reactant_jll.artifact_dir => TestRemote(), | ||
), | ||
sitename="Reactant.jl", | ||
format=Documenter.HTML(; | ||
prettyurls=get(ENV, "CI", "false") == "true", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2874e0d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactant.jl Benchmarks
ViT base (256 x 256 x 3 x 32)/forward/CUDA/Reactant
1477123147
ns1332320696
ns1.11
ViT base (256 x 256 x 3 x 32)/forward/CUDA/Lux
214785620
ns227642603
ns0.94
ViT base (256 x 256 x 3 x 32)/forward/CPU/Reactant
6060496845
ns5335100365
ns1.14
ViT base (256 x 256 x 3 x 32)/forward/CPU/Lux
36462862558
ns13923447717
ns2.62
ViT small (256 x 256 x 3 x 4)/forward/CUDA/Reactant
1187812104
ns1316736699.5
ns0.90
ViT small (256 x 256 x 3 x 4)/forward/CUDA/Lux
8061529.5
ns8429763.5
ns0.96
ViT small (256 x 256 x 3 x 4)/forward/CPU/Reactant
1956949148
ns1623537344.5
ns1.21
ViT small (256 x 256 x 3 x 4)/forward/CPU/Lux
4250420279
ns2861216622
ns1.49
ViT tiny (256 x 256 x 3 x 32)/forward/CUDA/Reactant
1262284206
ns1322466226.5
ns0.95
ViT tiny (256 x 256 x 3 x 32)/forward/CUDA/Lux
21000200
ns92359736
ns0.23
ViT tiny (256 x 256 x 3 x 32)/forward/CPU/Reactant
2531747932
ns2131612752
ns1.19
ViT tiny (256 x 256 x 3 x 32)/forward/CPU/Lux
6462833510
ns5865040182.5
ns1.10
ViT tiny (256 x 256 x 3 x 4)/forward/CUDA/Reactant
1257017538
ns1307662641.5
ns0.96
ViT tiny (256 x 256 x 3 x 4)/forward/CUDA/Lux
7263013.5
ns7432819
ns0.98
ViT tiny (256 x 256 x 3 x 4)/forward/CPU/Reactant
1799018534
ns1467758920
ns1.23
ViT tiny (256 x 256 x 3 x 4)/forward/CPU/Lux
2829308508
ns1560090503.5
ns1.81
ViT tiny (256 x 256 x 3 x 16)/forward/CUDA/Reactant
1287683652
ns1302764583
ns0.99
ViT tiny (256 x 256 x 3 x 16)/forward/CUDA/Lux
11229614
ns11569359
ns0.97
ViT tiny (256 x 256 x 3 x 16)/forward/CPU/Reactant
2142481803
ns1760726473
ns1.22
ViT tiny (256 x 256 x 3 x 16)/forward/CPU/Lux
3163883256
ns3822923609.5
ns0.83
ViT small (256 x 256 x 3 x 16)/forward/CUDA/Reactant
1256704809
ns1326375402
ns0.95
ViT small (256 x 256 x 3 x 16)/forward/CUDA/Lux
25518660.5
ns91537054
ns0.28
ViT small (256 x 256 x 3 x 16)/forward/CPU/Reactant
2537928548
ns2202666488.5
ns1.15
ViT small (256 x 256 x 3 x 16)/forward/CPU/Lux
6538820532.5
ns3885854683
ns1.68
ViT small (256 x 256 x 3 x 32)/forward/CUDA/Reactant
1243726167
ns1296753848.5
ns0.96
ViT small (256 x 256 x 3 x 32)/forward/CUDA/Lux
50161174
ns115901535
ns0.43
ViT small (256 x 256 x 3 x 32)/forward/CPU/Reactant
3347331233
ns3060865793
ns1.09
ViT small (256 x 256 x 3 x 32)/forward/CPU/Lux
9372958155
ns5422475355
ns1.73
ViT base (256 x 256 x 3 x 16)/forward/CUDA/Reactant
1328529825
ns1357473731
ns0.98
ViT base (256 x 256 x 3 x 16)/forward/CUDA/Lux
68217886
ns128651601.5
ns0.53
ViT base (256 x 256 x 3 x 16)/forward/CPU/Reactant
3568972676
ns3799896887
ns0.94
ViT base (256 x 256 x 3 x 16)/forward/CPU/Lux
11764280358
ns9419165654
ns1.25
ViT base (256 x 256 x 3 x 4)/forward/CUDA/Reactant
1323662542
ns1356160172
ns0.98
ViT base (256 x 256 x 3 x 4)/forward/CUDA/Lux
19588351
ns92550180
ns0.21
ViT base (256 x 256 x 3 x 4)/forward/CPU/Reactant
2203161073
ns2407987798
ns0.91
ViT base (256 x 256 x 3 x 4)/forward/CPU/Lux
5053716394
ns2697762090
ns1.87
This comment was automatically generated by workflow using github-action-benchmark.