public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paul dot richard dot thomas at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/37131] inline matmul for small matrix sizes
Date: Sat, 05 Jun 2010 06:55:00 -0000	[thread overview]
Message-ID: <20100605065503.23171.qmail@sourceware.org> (raw)
In-Reply-To: <bug-37131-10391@http.gcc.gnu.org/bugzilla/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]



------- Comment #10 from paul dot richard dot thomas at gmail dot com  2010-06-05 06:55 -------
Subject: Re:  inline matmul for small matrix sizes

Dear Thomas,


> The preferred way would therefore be to state the rank 2 * rank 2 problem as
>
>  do i=1,m
>     do j=1,n
>        c(i,j) = sum(a(i,:) * b(:,j))
>     end do
>  end do
>
> with the inner dot product borrowed using the scalarizer (borrowing
> from dot_product), and the outer loops using either hand-crafted
> TREE code or calling the DO translation.

Yes that is reasonable.  Otherwise, you could borrow a little trick
that I used in allocatable components: trans-array.c:6020

      gfc_add_expr_to_block (&loopbody, tmp);

      /* Build the loop and return.  */
      gfc_init_loopinfo (&loop);
      loop.dimen = 1;
      loop.from[0] = gfc_index_zero_node;
      loop.loopvar[0] = index;
      loop.to[0] = nelems;
      gfc_trans_scalarizing_loops (&loop, &loopbody);
      gfc_add_block_to_block (&fnblock, &loop.pre);

      tmp = gfc_finish_block (&fnblock);
      if (null_cond != NULL_TREE)
        tmp = build3_v (COND_EXPR, null_cond, tmp,
                        build_empty_stmt (input_location));

Here tmp in the first line is the expression or finished block within
the loop.  Earlier on, you will find an expression involving the
index.

Cheers

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131


  parent reply	other threads:[~2010-06-05  6:55 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 19:24 [Bug fortran/37131] New: " tkoenig at gcc dot gnu dot org
2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
2008-11-29 16:20 ` burnus at gcc dot gnu dot org
2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com [this message]
2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
2010-06-05  9:31 ` mikael at gcc dot gnu dot org
2010-06-05 18:27 ` tkoenig at netcologne dot de
     [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
2011-01-02 23:20 ` tkoenig at gcc dot gnu.org
2014-10-03 19:56 ` mikael at gcc dot gnu.org
2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
2015-05-01  7:15 ` schwab@linux-m68k.org
2015-05-01  8:32 ` ubizjak at gmail dot com
2015-05-01 11:25 ` dominiq at lps dot ens.fr
2015-05-01 13:16 ` mikael at gcc dot gnu.org
2015-05-02 11:31 ` schwab@linux-m68k.org
2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
2021-10-23 22:11 ` sandra at gcc dot gnu.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=20100605065503.23171.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: link
Be 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).