public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pan Li <panli@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8415] RISC-V: Add optim-no-fusion compile option [VSETVL PASS] Date: Thu, 25 Jan 2024 07:59:11 +0000 (GMT) [thread overview] Message-ID: <20240125075911.DBA723858C52@sourceware.org> (raw) https://gcc.gnu.org/g:1a8bebb1c59960590e7e2bc1a52757dfdd94210a commit r14-8415-g1a8bebb1c59960590e7e2bc1a52757dfdd94210a Author: Juzhe-Zhong <juzhe.zhong@rivai.ai> Date: Thu Jan 25 15:55:39 2024 +0800 RISC-V: Add optim-no-fusion compile option [VSETVL PASS] This patch adds no fusion compile option to disable phase 2 global fusion. It can help us to analyze the compile-time and debugging. Committed. gcc/ChangeLog: * config/riscv/riscv-opts.h (enum vsetvl_strategy_enum): Add optim-no-fusion option. * config/riscv/riscv-vsetvl.cc (pass_vsetvl::lazy_vsetvl): Ditto. (pass_vsetvl::execute): Ditto. * config/riscv/riscv.opt: Ditto. Diff: --- gcc/config/riscv/riscv-opts.h | 8 +++++--- gcc/config/riscv/riscv-vsetvl.cc | 22 ++++++++++++---------- gcc/config/riscv/riscv.opt | 5 ++++- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index ca57dddf1d9..1500f8811ef 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -118,11 +118,13 @@ enum stringop_strategy_enum { /* Behavior of VSETVL Pass. */ enum vsetvl_strategy_enum { - /* Simple: Insert a vsetvl* instruction for each Vector instruction. */ - VSETVL_SIMPLE = 1, /* Optimized: Run LCM dataflow analysis to reduce vsetvl* insns and delete any redundant ones generated in the process. */ - VSETVL_OPT = 2 + VSETVL_OPT, + /* Simple: Insert a vsetvl* instruction for each Vector instruction. */ + VSETVL_SIMPLE, + /* No fusion: Disable Phase 2 earliest global fusion. */ + VSETVL_OPT_NO_FUSION, }; #define TARGET_ZICOND_LIKE (TARGET_ZICOND || (TARGET_XVENTANACONDOPS && TARGET_64BIT)) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 170fc7f003d..53d954e1dff 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -3495,16 +3495,18 @@ pass_vsetvl::lazy_vsetvl () /* Phase 2: Fuse header and footer vsetvl infos between basic blocks. */ if (dump_file) fprintf (dump_file, "\nPhase 2: Lift up vsetvl info.\n\n"); - bool changed; - int fused_count = 0; - do + if (vsetvl_strategy != VSETVL_OPT_NO_FUSION) { - if (dump_file) - fprintf (dump_file, " Try lift up %d.\n\n", fused_count); - changed = pre.earliest_fuse_vsetvl_info (fused_count); - fused_count += 1; - } while (changed); - + bool changed = true; + int fused_count = 0; + do + { + if (dump_file) + fprintf (dump_file, " Try lift up %d.\n\n", fused_count); + changed = pre.earliest_fuse_vsetvl_info (fused_count); + fused_count += 1; + } while (changed); + } if (dump_file && (dump_flags & TDF_DETAILS)) pre.dump (dump_file, "phase 2"); @@ -3545,7 +3547,7 @@ pass_vsetvl::execute (function *) if (!has_vector_insn (cfun)) return 0; - if (!optimize || vsetvl_strategy & VSETVL_SIMPLE) + if (!optimize || vsetvl_strategy == VSETVL_SIMPLE) simple_vsetvl (); else lazy_vsetvl (); diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 65c656204ca..7c2292d8f91 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -552,11 +552,14 @@ Enum Name(vsetvl_strategy) Type(enum vsetvl_strategy_enum) Valid arguments to -param=vsetvl-strategy=: +EnumValue +Enum(vsetvl_strategy) String(optim) Value(VSETVL_OPT) + EnumValue Enum(vsetvl_strategy) String(simple) Value(VSETVL_SIMPLE) EnumValue -Enum(vsetvl_strategy) String(optim) Value(VSETVL_OPT) +Enum(vsetvl_strategy) String(optim-no-fusion) Value(VSETVL_OPT_NO_FUSION) -param=vsetvl-strategy= Target Undocumented RejectNegative Joined Enum(vsetvl_strategy) Var(vsetvl_strategy) Init(VSETVL_OPT)
reply other threads:[~2024-01-25 7:59 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240125075911.DBA723858C52@sourceware.org \ --to=panli@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).