[PATCH] D129013: [RISCV] Enable (scalable) vectorization by default

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 09:20:45 PDT 2022


reames added a comment.

In D129013#3712666 <https://reviews.llvm.org/D129013#3712666>, @kito-cheng wrote:

>> clang is inherently a cross compiler. We can't ask question of the host environment (e.g. kernel version). To my knowledge, this information is not available in any information we do have about the target platform. Am I missing something here?
>
> We could check with `/proc/cpuinfo` like `-mcpu=native` for most other targets, `V` only appeared in the `/proc/cpuinfo` only if `V` is supported in kernel[2].

Doing something specific for -mcpu=native would seem reasonable to me.  Can you point me to a similiar warning on another target?  If so, I can figure out a patch to warn on +v without the entry in /proc/cpuinfo.

> Ideally this issue should resolved by checking `Tag_RISCV_arch`[1] in kernel loader.

Very much out of scope for this patch.  :)

Also, not "kernel loader".  This would be the user-land dynamic loader at most.

In D129013#3713263 <https://reviews.llvm.org/D129013#3713263>, @compnerd wrote:

> In D129013#3712606 <https://reviews.llvm.org/D129013#3712606>, @reames wrote:
>
>> 2. clang is inherently a cross compiler.  We can't ask question of the host environment (e.g. kernel version).  To my knowledge, this information is not available in any information we do have about the target platform.  Am I missing something here?
>
> That is correct.  The check would need to be dynamic in that it must be part of the application.  Something like what Kito suggests with processing `/proc/cpuinfo`.  Longer term, it would be good to have the kernel actually check the riscv tag, but that leaves the older versions still in this state where things are easy to mis-configure.

Inserting runtime checks is well out of scope for the compiler.  If you're interested in this, working to mature the Tag_RISCV_arch feature would be my recommendation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129013



More information about the llvm-commits mailing list