public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: "Mikael Morin" <mikael.morin@sfr.fr>,
	"Dominique d'Humières" <dominiq@lps.ens.fr>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	 GNU GFortran <fortran@gcc.gnu.org>
Subject: Re: [patch, fortran, RFC] First steps towards inlining matmul
Date: Sat, 11 Apr 2015 17:01:00 -0000	[thread overview]
Message-ID: <55295358.60707@netcologne.de> (raw)
In-Reply-To: <552924F2.6000406@sfr.fr>

Hi Mikael,

>> Still to do:  Bounds checking (a rather big one),
> ... as you do a front-end to front-end transformation, you get bounds
> checking for free, don't you?

Only partially.

What the patch does is

     integer i,j,k
     c = 0
     do j=0, size(b,2)-1
       do k=0, size(a, 2)-1
         do i=0, size(a, 1)-1
            c(i * stride(c,1) + lbound(c,1), j * stride(c,2) +
lbound(c,2)) =
           c(i * stride(c,1) + lbound(c,1), j * stride(c,2) + lbound(c,2)) +
            a(i * stride(a,1) + lbound(a,1), k * stride(a,2) +
lbound(a,2)) *
            b(k * stride(b,1) + lbound(b,1), j * stride(b,2) + lbound(b,2))
         end do
       end do
     end do

If size(b,2) < size(c,2) or size(a,1) < size(c,1) or
size(a,2) < size(b,1), this will not get caught - no
array bounds violation in the DO loops, but illegal
code nonetheless.

Also, the error message is different, which should also be
changed.

What I would like to add to check before the loop, and then
add a "do not bounds-check" flag to the reference.

	Thomas

  reply	other threads:[~2015-04-11 17:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05 13:55 Dominique Dhumieres
2015-04-05 14:33 ` Thomas Koenig
2015-04-05 18:25   ` Dominique d'Humières
2015-04-05 20:37     ` Thomas Koenig
2015-04-05 23:15       ` Dominique d'Humières
2015-04-06 12:18         ` Dominique d'Humières
2015-04-09 22:18           ` Thomas Koenig
2015-04-10 14:15             ` Dominique d'Humières
2015-04-10 16:57               ` Dominique d'Humières
2015-04-11 12:24               ` Thomas Koenig
2015-04-11 13:43                 ` Mikael Morin
2015-04-11 17:01                   ` Thomas Koenig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-05 12:32 Thomas Koenig
2015-04-05 13:20 ` Jerry DeLisle
2015-04-05 13:48   ` Thomas Koenig
2015-04-07 19:24 ` David Malcolm

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=55295358.60707@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikael.morin@sfr.fr \
    /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).