public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110119] New: RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE
@ 2023-06-05 4:38 juzhe.zhong at rivai dot ai
2023-06-15 1:18 ` [Bug target/110119] " cvs-commit at gcc dot gnu.org
2023-06-15 3:23 ` juzhe.zhong at rivai dot ai
0 siblings, 2 replies; 3+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-06-05 4:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110119
Bug ID: 110119
Summary: RISC-V: RVV
--param=riscv-autovec-preference=fixed-vlmax ICE
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: juzhe.zhong at rivai dot ai
Target Milestone: ---
This following cases:
#include "riscv_vector.h"
typedef int8_t vnx2qi __attribute__ ((vector_size (2)));
__attribute__ ((noipa)) vnx2qi
f_vnx2qi (int8_t a, int8_t b, int8_t *out)
{
vnx2qi v = {a, b};
return v;
}
__attribute__ ((noipa)) vnx2qi
f_vnx2qi_2 (vnx2qi a, int8_t *out)
{
return a;
}
__attribute__ ((noipa)) vint32m1_t
f_vint32m1 (int8_t * a, int8_t *out)
{
vint32m1_t v = *(vint32m1_t*)a;
return v;
}
are all causing ICE:
0x1667a6d crash_signal
../../../riscv-gcc/gcc/toplev.cc:314
0x10a476c hard_function_value(tree_node const*, tree_node const*, tree_node
const*, int)
../../../riscv-gcc/gcc/explow.cc:2258
0x116f092 aggregate_value_p(tree_node const*, tree_node const*)
../../../riscv-gcc/gcc/function.cc:2126
0x117938e allocate_struct_function(tree_node*, bool)
../../../riscv-gcc/gcc/function.cc:4831
0xd0c7b7 store_parm_decls()
../../../riscv-gcc/gcc/c/c-decl.cc:10743
0xd7811e c_parser_declaration_or_fndef
../../../riscv-gcc/gcc/c/c-parser.cc:2805
0xd75ea7 c_parser_external_declaration
../../../riscv-gcc/gcc/c/c-parser.cc:1925
0xd7592e c_parser_translation_unit
../../../riscv-gcc/gcc/c/c-parser.cc:1779
0xdc1d2b c_parse_file()
../../../riscv-gcc/gcc/c/c-parser.cc:24657
0xe5f20b c_common_parse_file()
../../../riscv-gcc/gcc/c-family/c-opts.cc:1248
The reason of this ICE is because this walkaround code:
/* TODO: Currently, it will cause an ICE for --param
riscv-autovec-preference=fixed-vlmax. So, we just return NULL_RTX here
let GCC generate loads/stores. Ideally, we should either warn the user not
to use an RVV vector type as function argument or support the calling
convention directly. */
if (riscv_v_ext_mode_p (mode))
return NULL_RTX;
in riscv_get_arg_info.
From my experience (my local downstream GCC doesn't have such issue), I am
100% sure that such issue will be addressed when we support vector calling
convention in GCC.
And we already have calling convention in "rvv-next" branch, there is no
difference between "rvv-next" and my internal downstream RVV GCC.
The calling convention implementation of "rvv-next" is totally same as LLVM.
However, the calling convention is not ratified yet.
I don't have time to figure out the approach without supporting calling
convention and I don't think we need this approach.
I believe we will ultimately remove this approach (without supporting calling
convention) since we will have vector calling convention.
Also, this ICE only happens when we specify
--param=riscv-autovec-preference=fixed-vlmax
Base on these circumstances, I suggest we support vector calling convention and
enable it when --param=riscv-autovec-preference=fixed-vlmax is enable.
I think such GCC internal compile option to enable vector calling convention
doesn't break the RISC-V standard.
Any suggestions?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/110119] RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE
2023-06-05 4:38 [Bug c/110119] New: RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE juzhe.zhong at rivai dot ai
@ 2023-06-15 1:18 ` cvs-commit at gcc dot gnu.org
2023-06-15 3:23 ` juzhe.zhong at rivai dot ai
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-15 1:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110119
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:
https://gcc.gnu.org/g:0ec3fbb5903ac3ad735b3154e814b46724fe1a27
commit r14-1829-g0ec3fbb5903ac3ad735b3154e814b46724fe1a27
Author: Lehua Ding <lehua.ding@rivai.ai>
Date: Wed Jun 14 19:56:11 2023 +0800
RISC-V: Ensure vector args and return use function stack to pass [PR110119]
The V2 patch address comments from Juzhe, thanks.
Hi,
The reason for this bug is that in the case where the vector register is
set
to a fixed length (with `--param=riscv-autovec-preference=fixed-vlmax`
option),
TARGET_PASS_BY_REFERENCE thinks that variables of type vint32m1 can be
passed
through two scalar registers, but when GCC calls FUNCTION_VALUE (call
function
riscv_get_arg_info inside) it returns NULL_RTX. These two functions are not
unified. The current treatment is to pass all vector arguments and returns
through the function stack, and a new calling convention for vector
registers
will be added in the future.
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/
https://github.com/palmer-dabbelt/riscv-elf-psabi-doc/commit/126fa719972ff998a8a239c47d506c7809aea363
Best,
Lehua
gcc/ChangeLog:
PR target/110119
* config/riscv/riscv.cc (riscv_get_arg_info): Return NULL_RTX for
vector mode
(riscv_pass_by_reference): Return true for vector mode
gcc/testsuite/ChangeLog:
PR target/110119
* gcc.target/riscv/rvv/base/pr110119-1.c: New test.
* gcc.target/riscv/rvv/base/pr110119-2.c: New test.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/110119] RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE
2023-06-05 4:38 [Bug c/110119] New: RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE juzhe.zhong at rivai dot ai
2023-06-15 1:18 ` [Bug target/110119] " cvs-commit at gcc dot gnu.org
@ 2023-06-15 3:23 ` juzhe.zhong at rivai dot ai
1 sibling, 0 replies; 3+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-06-15 3:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110119
JuzheZhong <juzhe.zhong at rivai dot ai> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
fix on trunk.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-15 3:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 4:38 [Bug c/110119] New: RISC-V: RVV --param=riscv-autovec-preference=fixed-vlmax ICE juzhe.zhong at rivai dot ai
2023-06-15 1:18 ` [Bug target/110119] " cvs-commit at gcc dot gnu.org
2023-06-15 3:23 ` juzhe.zhong at rivai dot ai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).