[PATCH] D99037: [Matrix] Implement explicit type conversions for matrix types

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 31 14:09:41 PDT 2021


fhahn added a comment.

In D99037#2659477 <https://reviews.llvm.org/D99037#2659477>, @SaurabhJha wrote:

>> What code do you want to get out of this?  Are there e.g. vectorized float->double conversions we can use, or is the operation basically doomed to break the matrix apart and put it back together again?
>
> I think because matrices are vectors underneath, we should try vectorised conversions.

I think there should be vector versions of common conversions in most modern vector instruction sets, e.g. both ARM64 and X86 (with varying levels of support, depending on the supported vector extensions) have vector instructions for sign extend i32 -> i64 and floating point extension float -> double: https://godbolt.org/z/jx4Ya4PP5. John, please let me know if you were referring to something else, but IIUC then it would be best to emit vector conversion for the full vector (that should also be the easiest in terms of codegen).

More recent instruction set versions also have specialized instructions for things like dot-products, that also extend/truncate some of their operands and/or results., which we could also make use of easily if we have the vector conversions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99037/new/

https://reviews.llvm.org/D99037



More information about the cfe-commits mailing list