-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Update MLIR backend to LLVM 20.dev #799
base: main
Are you sure you want to change the base?
Conversation
.github/workflows/ci.yml
Outdated
@@ -11,20 +11,20 @@ jobs: | |||
strategy: | |||
matrix: | |||
os: ['ubuntu-latest'] | |||
python: ['3.10', '3.11', '3.12'] | |||
python: ['3.10'] # , '3.11', '3.12' |
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.
Finch-mlir
CI build needs to support other oses, archs, and Python versions.
CodSpeed Performance ReportMerging #799 will degrade performances by 24.56%Comparing Summary
Benchmarks breakdown
|
e3204d0
to
a20ae89
Compare
ed208b8
to
49cfb20
Compare
We still need more wheels for |
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.
Thanks for the test changes, overall the essence of this change LGTM, it is mlir
-> Finch_mlir
and figuring out the COO format better. Thanks!
@@ -94,13 +94,15 @@ def _from_scipy(arr: ScipySparseArray, copy: bool | None = None) -> Array: | |||
case "coo": | |||
if copy is not None and not copy: | |||
raise RuntimeError(f"`scipy.sparse.{type(arr.__name__)}` cannot be zero-copy converted.") | |||
coords = np.stack([arr.row, arr.col], axis=1) | |||
row, col = arr.row, arr.col |
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.
We should raise a RuntimeError
if row.dtype != col.dtype
.
sparse/mlir_backend/_core.py
Outdated
if os.name == "posix": | ||
MLIR_C_RUNNER_UTILS = f"{finch_lib_path}/{MLIR_C_RUNNER_UTILS}" |
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.
This needs something for Windows.
singleton_counter += 1 | ||
fields.append( | ||
( | ||
f"indices_{compressed_counter}_coords_{singleton_counter}", | ||
get_nd_memref_descr(1, idx_dtype), | ||
) | ||
) | ||
else: | ||
fields.append((f"indices_{compressed_counter}", get_nd_memref_descr(1, idx_dtype))) | ||
|
||
if LevelFormat.Singleton == level.format: | ||
singleton_counter += 1 | ||
fields.append( | ||
(f"indices_{compressed_counter}_coords_{singleton_counter}", get_nd_memref_descr(1, idx_dtype)) | ||
) | ||
|
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.
This should probably handle SOA and without SOA separately.
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.
In my opinion we should only support SoA singleton format:
- Non-SoA singleton looks to be buggy for basic operations link
- Mixed singleton levels aren't allowed: https://github.com/llvm/llvm-project/blob/8d38fbf2f027c72332c8ba03ff0ff0f83b4dcf02/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp#L811
What would be the benefit of supporting non-SoA singleton levels separately?
1dca588
to
57ca082
Compare
57ca082
to
d511c5c
Compare
This PR replaces #787 and fixes #797
This PR updates MLIR backend to current LLVM 20.dev (so
main
branch):tensor.empty
call link.As one can see it fixes a bunch of skips in the test suite: sparse/mlir_backend/tests/test_simple.py
It's thanks to changes already present in
main
branch, added after19.x
branched, and:soa
property tosparse_tensor
Python bindings llvm/llvm-project#109135encoding
argument totensor.empty
Python function llvm/llvm-project#110656test_output.py
test llvm/llvm-project#110882