Closed mtsokol closed 2 months ago
Comparing direct-style
(ef3e62e) with main
(47b246b)
โ 2 (๐ 2)
regressions
โ
338
untouched benchmarks
Benchmark | main |
direct-style |
Change | |
---|---|---|---|---|
๐ | test_index_fancy[side=100-rank=1-format='coo'] |
680 ยตs | 1,415.4 ยตs | -51.96% |
๐ | test_index_slice[side=100-rank=2-format='gcxs'] |
2.2 ms | 2.5 ms | -12.61% |
@hameerabbasi I applied all your review comments.
Hi @hameerabbasi,
This PR moves MLIR constructors to the direct style (with:
sparse-assembler{direct-out=true}
). I think it's more concise with this approach -_constructors.py
LOC reduced by 50%, to 250.Now all Tensors created from NumPy arrays or SciPy sparse arrays are owned and freed by the python side.
The ones that are results of MLIR ops (like
add
right now) are allocated by MLIR andowns_memory
in Tensor class is set toFalse
.I haven't figured out yet how to correctly free MLIR allocated memrefs, (tried with
libc.free
) as I think there's still a memory leak aftersparse.add(tensor_a, tensor_b)
.