public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113248] New: RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo
@ 2024-01-06  1:12 ewlu at rivosinc dot com
  2024-01-06  5:24 ` [Bug target/113248] " cvs-commit at gcc dot gnu.org
  2024-01-09  0:49 ` ewlu at rivosinc dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ewlu at rivosinc dot com @ 2024-01-06  1:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113248

            Bug ID: 113248
           Summary: RISC-V: Invalid vsetvli fusion using
                    -mtune=generic-ooo
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ewlu at rivosinc dot com
  Target Milestone: ---

Opening a new bug instead of reopening other one since the configuration is
different. 

Same testcase as PR111037. Switching cost model should not cause program to
crash

foo:
        vsetivli        zero,1,e64,m1,ta,ma
        vle64.v v1,0(a1)
        vmv.s.x v3,a0
        vfmv.s.f        v2,fa0 # illegal insn still
        vadd.vv v1,v1,v1

Configuration:
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mtune=generic-ooo/-mcmodel=medlow

Compilation:
./build-gcc-linux-stage2/gcc/xgcc -B./build-gcc-linux-stage2/gcc/ 
../gcc/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111037-3.c  -march=rv64gcv
-mabi=lp64d -mtune=generic-ooo -mcmodel=medlow   -fdiagnostics-plain-output 
-O0 --param=riscv-autovec-preference=scalable -march=rv32gc_zve64f_zvfh
-mabi=ilp32d -O3 -ffat-lto-objects -fno-ident -S   -o pr111037-3.s

Godbolt:
https://godbolt.org/z/q3779xnab

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113248] RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo
  2024-01-06  1:12 [Bug target/113248] New: RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo ewlu at rivosinc dot com
@ 2024-01-06  5:24 ` cvs-commit at gcc dot gnu.org
  2024-01-09  0:49 ` ewlu at rivosinc dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-06  5:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113248

--- Comment #1 from GCC 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:6cf47447f6fba84a17864fc7a19a532a62b6e736

commit r14-6967-g6cf47447f6fba84a17864fc7a19a532a62b6e736
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Sat Jan 6 13:10:38 2024 +0800

    RISC-V: Update MAX_SEW for available vsevl info[VSETVL PASS]

    This patch fixes a bug of VSETVL PASS in this following situation:

        Ignore curr info since prev info available with it:
          prev_info: VALID (insn 8, bb 2)
            Demand fields: demand_ratio_and_ge_sew demand_avl
            SEW=16, VLMUL=mf4, RATIO=64, MAX_SEW=64
            TAIL_POLICY=agnostic, MASK_POLICY=agnostic
            AVL=(const_int 1 [0x1])
            VL=(nil)
          curr_info: VALID (insn 12, bb 2)
            Demand fields: demand_ge_sew demand_non_zero_avl
            SEW=16, VLMUL=m1, RATIO=16, MAX_SEW=32
            TAIL_POLICY=agnostic, MASK_POLICY=agnostic
            AVL=(const_int 1 [0x1])
            VL=(nil)

    We should update prev_info MAX_SEW from 64 into 32.

    Before this patch:
    foo:
            vsetivli        zero,1,e64,m1,ta,ma
            vle64.v v1,0(a1)
            vmv.s.x v3,a0
            vfmv.s.f        v2,fa0
            vadd.vv v1,v1,v1
            ret

    After this patch:
    foo:
            vsetivli        zero,1,e16,mf4,ta,ma
            vle64.v v1,0(a1)
            vmv.s.x v3,a0
            vfmv.s.f        v2,fa0
            vsetvli zero,zero,e64,m1,ta,ma
            vadd.vv v1,v1,v1
            ret

    Tested on both RV32 and RV64 no regression. Committed.

            PR target/113248

    gcc/ChangeLog:

            * config/riscv/riscv-vsetvl.cc
(pre_vsetvl::fuse_local_vsetvl_info):
            Update the MAX_SEW.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/vsetvl/pr113248.c: New test.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113248] RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo
  2024-01-06  1:12 [Bug target/113248] New: RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo ewlu at rivosinc dot com
  2024-01-06  5:24 ` [Bug target/113248] " cvs-commit at gcc dot gnu.org
@ 2024-01-09  0:49 ` ewlu at rivosinc dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ewlu at rivosinc dot com @ 2024-01-09  0:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113248

Edwin Lu <ewlu at rivosinc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Edwin Lu <ewlu at rivosinc dot com> ---
Appears to be fixed. Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-09  0:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-06  1:12 [Bug target/113248] New: RISC-V: Invalid vsetvli fusion using -mtune=generic-ooo ewlu at rivosinc dot com
2024-01-06  5:24 ` [Bug target/113248] " cvs-commit at gcc dot gnu.org
2024-01-09  0:49 ` ewlu at rivosinc dot com

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).