[PATCH] D45339: [NVPTX] Fixed vectorized LDG for f16.

Bixia Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 16:21:41 PDT 2018


bixia added inline comments.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp:1244
+    if (EltVT == MVT::f16 && N->getValueType(0) == MVT::v2f16 &&
+        NumElts % 2 == 0) {
+      EltVT = MVT::v2f16;
----------------
I played with this and found that the only f16 vector that can reach here is v2f16, due to the way that the legalizer is set up for the target. If we can somehow make v4f16 reach here, I believe that we will still see an error in routine GetConvertOpcode, similar to what we see for v2f16 before this fix. For this reason, I prefer an assertion, something like this:

if (EltVT == MVT::v2f16) {
     assert(EltVT.getVectorNumElements() == 2 && "missed legalizing vector-of-f16");
} else {
   NumElts = EltVT.getVectorNumElements();
    EltVT = EltVT.getVectorElementType();
}


https://reviews.llvm.org/D45339





More information about the llvm-commits mailing list