public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: "Dominique d'Humières" <dominiq@lps.ens.fr>
Cc: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libfortran] Speed up cshift for dim > 1
Date: Mon, 19 Jun 2017 18:01:00 -0000	[thread overview]
Message-ID: <d88cec7e-01a6-f772-e568-45a5cd5b979a@netcologne.de> (raw)
In-Reply-To: <B1F0FF5A-F160-494F-9C45-8EA029B41933@lps.ens.fr>

Hi Dominique,

> For the record, the following CSHIFT is still 4 times slower than the DO loop

I have looked into this a bit. The main reason is that, unlike cshift0
(without the array as shift) we do not generate individual functions to
call for the usual data types, we use memcpy with a size determined
at run-time by looking at the array descriptor.  This is, of course,
quite slow.

So, the solution should probably be to generate functions like
cshift1_4_i4 and then call them. This would generate a bit of
bloat, but if people use this in a serios way, I think
this is OK.

This was already done for cshift0 a few years ago. What
we have there looks like (intrinsics/cshift0.c)

   type_size = GFC_DTYPE_TYPE_SIZE (array);

   switch(type_size)
     {
     case GFC_DTYPE_LOGICAL_1:
     case GFC_DTYPE_INTEGER_1:
     case GFC_DTYPE_DERIVED_1:
       cshift0_i1 ((gfc_array_i1 *)ret, (gfc_array_i1 *) array, shift, 
which);
       return;

     case GFC_DTYPE_LOGICAL_2:
     case GFC_DTYPE_INTEGER_2:
       cshift0_i2 ((gfc_array_i2 *)ret, (gfc_array_i2 *) array, shift, 
which);
       return;

so this is something that we could also emulate.

A bit of work, but nothing that looks un-doable.

Regards

	Thomas

  reply	other threads:[~2017-06-19 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 15:14 Dominique d'Humières
2017-06-19 18:01 ` Thomas Koenig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-06-14 19:42 Thomas Koenig
2017-06-16 17:19 ` Jerry DeLisle
2017-06-18 18:16   ` Thomas Koenig

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=d88cec7e-01a6-f772-e568-45a5cd5b979a@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).