This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][taco] Support complex types.
ClosedPublic

Authored by bixia on Jun 17 2022, 11:06 AM.

Details

Summary

Support complex types of float and double. See the added test for an example.

Diff Detail

Event Timeline

bixia created this revision.Jun 17 2022, 11:06 AM
bixia requested review of this revision.Jun 17 2022, 11:06 AM
bixia updated this revision to Diff 437976.Jun 17 2022, 11:10 AM

Fixed comments.

aartbik added inline comments.Jun 17 2022, 11:34 AM
mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
78

I have been using np.complex128/np.complex64 for these, since I like the bit-number at the end (which is also consistent with what we do for float). Do you mind changing that here?

mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_api.py
44

same question on complex128, or is this defined by taco this way?

mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
142

note that we now have

mlir.runtime.as_ctype()

and

mlir.runtime.C128/C64

so I don't think you need to do this "doubling" trick anymore

151

we have

mlir.runtime.to_numpy()

aartbik added inline comments.Jun 17 2022, 2:04 PM
mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
75

Note that we can include np.float16 also now!

bixia updated this revision to Diff 438037.Jun 17 2022, 2:20 PM
bixia marked 3 inline comments as done.

Use runtime.as_ctype and runtime.to_numpy.
replace csingle/cdouble with complex64/128.

mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
142

use runtime.as_ctype and runtime.to_numpy

aartbik accepted this revision.Jun 17 2022, 3:09 PM

few last naming nitpicks, but this looks solid!

mlir/test/Integration/Dialect/SparseTensor/taco/test_tensor_complex.py
13

complex64/128?

mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_api.py
44

same question, did you keep this csingle/cdouble on purpose?
why not complex64/128?

mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
96

np.complex64/128?

149

yes, nice!

This revision is now accepted and ready to land.Jun 17 2022, 3:09 PM
bixia updated this revision to Diff 438053.Jun 17 2022, 3:38 PM
bixia marked 3 inline comments as done.

Rename csingle/ccomplex to complex64/128.

bixia added inline comments.Jun 17 2022, 3:40 PM
mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
75

Will add this and test in another PR.

This revision was landed with ongoing or failed builds.Jun 17 2022, 4:07 PM
This revision was automatically updated to reflect the committed changes.