This is an archive of the discontinued LLVM Phabricator instance.

Add tensor.bitcast op to Tensor dialect
ClosedPublic

Authored by trevor-m on May 1 2023, 12:25 PM.

Details

Summary

Add tensor.bitcast operator to bitcast between two tensors of compatible shape and same bit width. This can be use to reinterpret an unsigned integer as a signed integer or vice versa.

Diff Detail

Event Timeline

trevor-m created this revision.May 1 2023, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 12:25 PM
trevor-m requested review of this revision.May 1 2023, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 12:25 PM
rsuderman added inline comments.May 1 2023, 2:50 PM
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
173

LLVM is migrating to a different cast syntax: https://mlir.llvm.org/deprecation/

So this should be dyn_cast<TensorType>(a)

198

Ditto on the cast issue.

trevor-m updated this revision to Diff 518786.May 2 2023, 10:17 AM

Updated to use free function casts.

Thanks @rsuderman for the review!

rsuderman accepted this revision.May 2 2023, 11:20 AM
This revision is now accepted and ready to land.May 2 2023, 11:20 AM
This revision was landed with ongoing or failed builds.May 2 2023, 1:28 PM
This revision was automatically updated to reflect the committed changes.