Skip to content

Commit

Permalink
download and use makslevental MLIR wheel distribution instead of MLIR…
Browse files Browse the repository at this point in the history
…_jll
  • Loading branch information
jumerckx committed Dec 20, 2023
1 parent d13c86d commit 03bfb7e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MLIRdist]
git-tree-sha1 = "7a30d5d08131c8d72e002314ee933895a1bed594"
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ version = "0.1.0"
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
LLVM = "929cbde3-209d-540e-8aea-75f648917ca0"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
MLIR_jll = "a70bccb4-a5c0-5e2e-a329-e731972457e8"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[compat]
CEnum = "0.4"
julia = "1.9"
LLVM = "5"
julia = "1.9"
9 changes: 7 additions & 2 deletions src/MLIR.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
module MLIR

include("get_artifact.jl")

import LLVM

module API
using CEnum

# MLIR C API
import ..LLVM
using MLIR_jll

using Pkg.Artifacts
MLIRdist_path = artifact"MLIRdist"
const mlir_c = joinpath(MLIRdist_path, "mlir/lib/libMLIR-C.so")

let
# ver = string(LLVM.version().major)
ver = "18"
dir = joinpath(@__DIR__, "..", "lib", ver)
if !isdir(dir)
Expand Down
20 changes: 20 additions & 0 deletions src/get_artifact.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Pkg.Artifacts

function __init__()
artifact_toml = joinpath(@__DIR__, "../Artifacts.toml")

MLIRdist_hash = artifact_hash("MLIRdist", artifact_toml)

if MLIRdist_hash == nothing || !artifact_exists(MLIRdist_hash)
MLIRdist_hash = create_artifact() do artifact_dir
@info "Downloading MLIR distribution (this can take a while ~700MB)"
temp = download("https://github.com/makslevental/mlir-wheels/releases/download/latest/mlir-18.0.0.2023121501+bf2b035e-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl")
@info "Unzipping $temp to $artifact_dir (unzip should be installed on your system)"
run(`unzip -q $temp -d $artifact_dir`)
end
bind_artifact!(
artifact_toml,
"MLIRdist",
MLIRdist_hash)
end
end

0 comments on commit 03bfb7e

Please sign in to comment.