public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32512]  New: efficiency of RESHAPE and SPREAD
@ 2007-06-26  6:28 highegg at gmail dot com
  2007-06-26  6:36 ` [Bug fortran/32512] " highegg at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: highegg at gmail dot com @ 2007-06-26  6:28 UTC (permalink / raw)
  To: gcc-bugs

gfortran currently implements the TRANSPOSE intrinsic by simply rearranging the
array descriptor, which can save considerable time when passed to an
assumed-shape argument. Two more intrinsics can be implemented in this way:

RESHAPE can check for contiguity of its argument and if so, only construct a
new descriptor sharing the data. 

If, as I assume, the array element reference a(i1,i2,i3) is computed
equivalently to:
*((type *)(offset + i1*dim[0].stride + i2*dim[1].stride + i3*dim[2].stride)

then one can also implement a fast version of SPREAD by using zero strides
in the array descriptor
(thus the array reference will ignore some of the indices). This also covers
broadcasting a scalar to an array (all zero strides).

For code using whole array manipulation intensively, I'd expect significant
savings of both time and memory. Can't find at this moment how to attach a file
in this form, so I'll post a test case afterwards.

cheers to all gfortran developers,
Jaroslav Hajek


-- 
           Summary: efficiency of RESHAPE and SPREAD
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: highegg at gmail dot com


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-05-09 18:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-26  6:28 [Bug fortran/32512] New: efficiency of RESHAPE and SPREAD highegg at gmail dot com
2007-06-26  6:36 ` [Bug fortran/32512] " highegg at gmail dot com
2007-06-26 10:56 ` highegg at gmail dot com
2007-06-26 11:54 ` burnus at gcc dot gnu dot org
2008-03-28 23:24 ` tkoenig at gcc dot gnu dot org
2008-04-13 20:17 ` tkoenig at gcc dot gnu dot org
2008-11-30 19:54 ` pault at gcc dot gnu dot org
2010-05-09 18:43 ` dfranke at gcc dot gnu dot org

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).