Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest a GCC/LLVM compatible compile option for RVV auto-vectorization #33

Open
zhongjuzhe opened this issue Mar 28, 2023 · 6 comments

Comments

@zhongjuzhe
Copy link

Is it possible that we can have a GCC/LLVM compatible compile option to specifiy LMUL in auto-vectorization?
For example, -mriscv-vector-lmul or -mrvv-vector-lmul ?

Thanks.

@zhongjuzhe
Copy link
Author

@kito-cheng Can you help me with that ?

@kito-cheng
Copy link
Collaborator

LLVM has an option to specify that -mllvm -riscv-v-register-bit-width-lmul=N, but I guess we need to figure out and define the semantic for the option, especially for the loop contains more than one element width, e.g. one loop contain with i64 and i32, so which LMUL should be used for i64 and i32 IF we specify the -mrvv-vector-lmul=m2? i32 use m2, i64 use m4 or i32 use m1, i64 use m2?

We'll need to clarify those case if we want to define a common option.

@kito-cheng
Copy link
Collaborator

Tag some LLVM developer here to get some feedback about this idea: @topperc @asb @rofirrim @preames

@zhongjuzhe is the major contributor of the vector support for RISC-V GCC, including intrinsic and vectorizer, he already finish first version of auto vectorization on their downstream GCC, and we are planing to support vectorizer on GCC trunk in the second half of 2023,

@zhongjuzhe
Copy link
Author

Prefer i64 use m2 && i32 use m1 when -mrvv-vector-lmul=m2

@preames
Copy link

preames commented Mar 29, 2023

I, strongly, think we're too early in having this discussion. If you have specific examples where you think the default code generation is sub-optimal, please file bugs. Only once we've implemented reasonable code quality in both compilers does it start making sense to provide compatible forcing options.

Also, any option prefixed with -mllvm is explicitly internal, and is not stable. Use at your own risk, you will get no support if that breaks.

@vineetgarc
Copy link

I'm guessing we can restart this conversation. cfr: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112651

TL/DR: in gcc we currently use --param to convey lmul, but that is more of a hint to the optimizer and not really a mandate for it. For latter the preferred way is to use a -mXX toggle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants