This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Fix a problem in handling data type conversion.
ClosedPublic

Authored by bixia on Mar 30 2023, 1:59 PM.

Details

Summary

Previously, the genCast function generates arith.trunci for converting f32 to
i32. Fix the function to use mlir::convertScalarToDtype to correctly handle
conversion cases beyond index casting.

Add a test case for codegen the sparse_tensor.convert op.

Diff Detail

Event Timeline

bixia created this revision.Mar 30 2023, 1:59 PM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Mar 30 2023, 1:59 PM
Peiming added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
213

Thanks!

I was not aware the existence of this!

Peiming accepted this revision.Mar 30 2023, 2:01 PM
This revision is now accepted and ready to land.Mar 30 2023, 2:01 PM
aartbik accepted this revision.Mar 30 2023, 2:02 PM
bixia edited the summary of this revision. (Show Details)Mar 30 2023, 2:04 PM
wrengr accepted this revision.Mar 30 2023, 2:31 PM