Skip to content

Commit 954996f

Browse files
committed
Use wheel from GitHub release
1 parent 32abcf0 commit 954996f

File tree

8 files changed

+42
-32
lines changed

8 files changed

+42
-32
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ defaults:
22
run:
33
shell: bash -leo pipefail {0}
44

5-
concurrency:
6-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7-
cancel-in-progress: true
5+
# concurrency:
6+
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7+
# cancel-in-progress: true
88

99
jobs:
1010
test:
1111
strategy:
1212
matrix:
1313
os: ['ubuntu-latest']
14-
python: ['3.10', '3.11', '3.12']
14+
python: ['3.10'] # , '3.11', '3.12'
1515
pip_opts: ['']
1616
numba_boundscheck: [0]
17-
include:
18-
- os: macos-latest
19-
python: '3.10'
20-
- os: windows-latest
21-
python: '3.10'
22-
- os: ubuntu-latest
23-
python: '3.10'
24-
numba_boundscheck: 1
25-
- os: ubuntu-latest
26-
python: '3.10'
27-
pip_opts: 'numpy<2'
28-
fail-fast: false
17+
# include:
18+
# - os: macos-latest
19+
# python: '3.10'
20+
# - os: windows-latest
21+
# python: '3.10'
22+
# - os: ubuntu-latest
23+
# python: '3.10'
24+
# numba_boundscheck: 1
25+
# - os: ubuntu-latest
26+
# python: '3.10'
27+
# pip_opts: 'numpy<2'
28+
#fail-fast: false
2929
runs-on: ${{ matrix.os }}
3030
env:
3131
PYTHON_VERSION: ${{ matrix.python }}

ci/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- pytest
1313
- pytest-cov
1414
- pytest-xdist
15-
- mlir-python-bindings==19.*
1615
- pip:
1716
- finch-tensor >=0.1.31
1817
- pytest-codspeed
18+
- https://github.com/nullplay/Finch-mlir/releases/download/latest/mlir_finch-0.0.1-cp310-cp310-linux_x86_64.whl

sparse/mlir_backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
import mlir # noqa: F401
2+
import mlir_finch # noqa: F401
33
except ModuleNotFoundError as e:
44
raise ImportError(
55
"MLIR Python bindings not installed. Run "

sparse/mlir_backend/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import weakref
55
from dataclasses import dataclass
66

7-
from mlir import ir
7+
from mlir_finch import ir
88

99

1010
class MlirType(abc.ABC):

sparse/mlir_backend/_constructors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from collections.abc import Iterable
33
from typing import Any
44

5-
import mlir.runtime as rt
6-
from mlir import ir
7-
from mlir.dialects import sparse_tensor
5+
import mlir_finch.runtime as rt
6+
from mlir_finch import ir
7+
from mlir_finch.dialects import sparse_tensor
88

99
import numpy as np
1010
import scipy.sparse as sps

sparse/mlir_backend/_core.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@
22
import ctypes.util
33
import os
44
import pathlib
5+
import sys
56

6-
from mlir.ir import Context
7-
from mlir.passmanager import PassManager
7+
from mlir_finch.ir import Context
8+
from mlir_finch.passmanager import PassManager
89

910
DEBUG = bool(int(os.environ.get("DEBUG", "0")))
1011
CWD = pathlib.Path(".")
1112

13+
LD_ENV_PATH = f"{sys.prefix}/lib/python3.10/site-packages/lib"
14+
15+
if "LD_LIBRARY_PATH" in os.environ:
16+
os.environ["LD_LIBRARY_PATH"] = f"{LD_ENV_PATH}:{os.environ['LD_LIBRARY_PATH']}"
17+
else:
18+
os.environ["LD_LIBRARY_PATH"] = LD_ENV_PATH
19+
1220
MLIR_C_RUNNER_UTILS = ctypes.util.find_library("mlir_c_runner_utils")
21+
if os.name == "posix":
22+
MLIR_C_RUNNER_UTILS = f"{LD_ENV_PATH}/{MLIR_C_RUNNER_UTILS}"
1323
libc = ctypes.CDLL(ctypes.util.find_library("c")) if os.name != "nt" else ctypes.cdll.msvcrt
1424
libc.free.argtypes = [ctypes.c_void_p]
1525
libc.free.restype = None

sparse/mlir_backend/_dtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import typing
55

6-
from mlir import ir
6+
from mlir_finch import ir
77

88
import numpy as np
99

sparse/mlir_backend/_ops.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import ctypes
22

3-
import mlir.execution_engine
4-
import mlir.passmanager
5-
from mlir import ir
6-
from mlir.dialects import arith, func, linalg, sparse_tensor, tensor
3+
import mlir_finch.execution_engine
4+
import mlir_finch.passmanager
5+
from mlir_finch import ir
6+
from mlir_finch.dialects import arith, func, linalg, sparse_tensor, tensor
77

88
import numpy as np
99

@@ -67,7 +67,7 @@ def add(a, b):
6767
if DEBUG:
6868
(CWD / "add_module_opt.mlir").write_text(str(module))
6969

70-
return mlir.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
70+
return mlir_finch.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
7171

7272

7373
@fn_cache
@@ -92,7 +92,7 @@ def reshape(a, shape):
9292
if DEBUG:
9393
(CWD / "reshape_module_opt.mlir").write_text(str(module))
9494

95-
return mlir.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
95+
return mlir_finch.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
9696

9797

9898
@fn_cache
@@ -120,7 +120,7 @@ def broadcast_to(in_tensor):
120120
if DEBUG:
121121
(CWD / "broadcast_to_module_opt.mlir").write_text(str(module))
122122

123-
return mlir.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
123+
return mlir_finch.execution_engine.ExecutionEngine(module, opt_level=2, shared_libs=[MLIR_C_RUNNER_UTILS])
124124

125125

126126
def add(x1: Tensor, x2: Tensor) -> Tensor:

0 commit comments

Comments
 (0)