[PATCH] D108694: [RISCV] Add the zvl extension according to the v1.0-rc1 spec

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 20:33:04 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:112
     return 0;
-  assert(RVVVectorBitsMax >= 128 && RVVVectorBitsMax <= 65536 &&
+  assert(RVVVectorBitsMax >= 32 && RVVVectorBitsMax <= 65536 &&
          isPowerOf2_32(RVVVectorBitsMax) &&
----------------
The max should be greater than ZvlLen right?


================
Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:127
   assert((RVVVectorBitsMin == 0 ||
-          (RVVVectorBitsMin >= 128 && RVVVectorBitsMax <= 65536 &&
+          (RVVVectorBitsMin >= 32 && RVVVectorBitsMax <= 65536 &&
            isPowerOf2_32(RVVVectorBitsMin))) &&
----------------
Some of the callers of this will break if it returns a value less than 64. We need to limit ELEN to 32 if VLEN is 32. And we can't use LMUL=1/8 with i8 vectors, or LMUL=1/4 with i16 vector, or LMUL=1/2 with i32 vector.


================
Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:134
          "maximum!");
+  assert(RVVVectorBitsMin >= ZvlLen &&
+         "Minimum V extension vector length should be at least the length "
----------------
eopXD wrote:
> kito-cheng wrote:
> > I guess this should be more than an assertion? but I am not sure does it make sense to emit error or warning here? or just silently return `ZvlLen` if `RVVVectorBitsMin` is less than `ZvlLen`.
> I think the compiler should not return `ZvlLen` silently if the specified `RVVVectorBitsMin` is less. As `zvl` hard restricts the minimum `vlen`, the user should be aware (notified) of that. I think the assertion error here can guide the user to either increase their `RVVVectorBitsMin` in the argument or compile under another architecture specification.
assertions are compiled out of release builds. The code after the assertions was trying to do something sane for release builds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108694



More information about the llvm-commits mailing list