This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][taco] Add support for scalar tensors.
ClosedPublic

Authored by bixia on Feb 24 2022, 3:48 PM.

Details

Summary

This change allows the use of scalar tensors with index 0 in tensor index
expressions. In this case, the scalar value is broadcast to match the
dimensions of other tensors in the same expression.

Using scalar tensors as a destination in tensor index expressions is not
supported in the PyTACO DSL.

Add a PyTACO test to show the use of scalar tensors.

Diff Detail

Event Timeline

bixia created this revision.Feb 24 2022, 3:48 PM
bixia requested review of this revision.Feb 24 2022, 3:48 PM
aartbik added inline comments.Feb 24 2022, 3:54 PM
mlir/test/Integration/Dialect/SparseTensor/taco/test_scalar_tensor_algebra.py
25

no allclose for indices, they must be exact!

26

even these seem to be simple enough to check for equality

bixia updated this revision to Diff 411253.Feb 24 2022, 4:07 PM

Use np.array_equal to compare indices.

bixia updated this revision to Diff 411257.Feb 24 2022, 4:19 PM

Use np.array_equal to check the result.

bixia marked 2 inline comments as done.Feb 24 2022, 4:19 PM
aartbik accepted this revision.Feb 24 2022, 5:32 PM
This revision is now accepted and ready to land.Feb 24 2022, 5:32 PM
This revision was landed with ongoing or failed builds.Feb 25 2022, 7:20 AM
This revision was automatically updated to reflect the committed changes.