public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/29549] matmul slow for complex matrices Date: Sat, 16 Feb 2008 18:50:00 -0000 [thread overview] Message-ID: <20080216185009.1416.qmail@sourceware.org> (raw) In-Reply-To: <bug-29549-1719@http.gcc.gnu.org/bugzilla/> ------- Comment #7 from fxcoudert at gcc dot gnu dot org 2008-02-16 18:50 ------- Thomas is right: -fcx-limited-range sets flag_complex_method to 0, but already with flag_complex_method == 1 we have some rather good figures. Here are the execution times of 300x300 matmul on my MacBook Pro (i386-apple-darwin8.11.1): - a home-made triple do loop in Fortran (Janne's comment #2) is 0.1876 sec - unpatched matmul is 0.5499 sec - matmul compiled with flag_complex_method == 1 is 0.1448 sec The following patch is what I used to benchmark: it creates a -fcx-fortran-rules (of course, we do know that Fortran actually rules, but hiding it in an option name is a clever way for people to slowly start realizing it) option that sets flag_complex_method to 1, and uses it to compile libgfortran's matmul routines. Index: gcc/toplev.c =================================================================== --- gcc/toplev.c (revision 132353) +++ gcc/toplev.c (working copy) @@ -2001,6 +2001,10 @@ if (flag_cx_limited_range) flag_complex_method = 0; + /* With -fcx-fortran-rules, we do something in-between cheap and C99. */ + if (flag_cx_fortran_rules) + flag_complex_method = 1; + /* Targets must be able to place spill slots at lower addresses. If the target already uses a soft frame pointer, the transition is trivial. */ if (!FRAME_GROWS_DOWNWARD && flag_stack_protect) Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 132353) +++ gcc/common.opt (working copy) @@ -390,6 +390,10 @@ Common Report Var(flag_cx_limited_range) Optimization Omit range reduction step when performing complex division +fcx-fortran-rules +Common Report Var(flag_cx_fortran_rules) Optimization +Complex multiplication and division follow Fortran rules + fdata-sections Common Report Var(flag_data_sections) Optimization Place data items into their own section Index: libgfortran/Makefile.am =================================================================== --- libgfortran/Makefile.am (revision 132353) +++ libgfortran/Makefile.am (working copy) @@ -636,7 +636,7 @@ install-pdf: # Turn on vectorization and loop unrolling for matmul. -$(patsubst %.c,%.lo,$(notdir $(i_matmul_c))): AM_CFLAGS += -ftree-vectorize -fs +$(patsubst %.c,%.lo,$(notdir $(i_matmul_c))): AM_CFLAGS += -ftree-vectorize -fs # Logical matmul doesn't vectorize. $(patsubst %.c,%.lo,$(notdir $(i_matmull_c))): AM_CFLAGS += -funroll-loops -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu dot | |org Keywords| |patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29549
next prev parent reply other threads:[~2008-02-16 18:50 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-22 15:58 [Bug fortran/29549] New: " tobias dot burnus at physik dot fu-berlin dot de 2006-11-04 14:15 ` [Bug fortran/29549] " jb at gcc dot gnu dot org 2006-11-04 20:34 ` jb at gcc dot gnu dot org 2006-11-04 21:24 ` jb at gcc dot gnu dot org 2006-11-04 22:17 ` jb at gcc dot gnu dot org 2008-02-10 19:20 ` jb at gcc dot gnu dot org 2008-02-10 22:48 ` tkoenig at gcc dot gnu dot org 2008-02-16 18:50 ` fxcoudert at gcc dot gnu dot org [this message] 2008-02-16 19:01 ` fxcoudert at gcc dot gnu dot org 2008-02-16 21:59 ` rguenth at gcc dot gnu dot org 2008-02-16 22:33 ` jb at gcc dot gnu dot org 2008-02-19 19:34 ` jb at gcc dot gnu dot org 2008-02-25 19:22 ` jb at gcc dot gnu dot org 2008-02-25 19:28 ` jb at gcc dot gnu dot org 2008-02-26 21:15 ` jb at gcc dot gnu dot org
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=20080216185009.1416.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).