This is the mail archive of the
mailing list for the GNU Fortran project.
Re: [patch] PR32131: allocatable arrays have stride 1
- From: Tobias Burnus <burnus at net-b dot de>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 02 Jul 2009 16:41:24 +0200
- Subject: Re: [patch] PR32131: allocatable arrays have stride 1
- References: <Pine.LNX.email@example.com>
Michael Matz wrote:
> Their lowest dimension always has stride 1, so adjusting
> gfc_conv_descriptor_stride_get() is enough (on top of richis recent
> improvements to alias disambiguation) to vectorize everything interesting
> in leslie. Its runtime drops from 960 to 823 seconds, 14% improvement.
Impressive what a that small patch can do. Thanks for the patch.
> Okay for trunk?
Yes, the patch is OK.
* * *
I wonder whether one couldn't extend the patch to explicit shape,
automatic arrays and assumed-size arrays; here also the innermost
dimension should have stride=1. (For pointers and for nonallocatable
assumed-shape arrays, this assumption is moot.)
To do this, one would need to update trans.c's gfc_array_kind, which
currently only has GFC_ARRAY_UNKNOWN, GFC_ARRAY_ASSUMED_SHAPE,
GFC_ARRAY_POINTER; maybe adding a GFC_ARRAY_CONTIGUOUS would be best?
PS: To other readers: If one passes an allocatable array as via
vector-section and strides as actual argument, then the dummy argument
cannot be allocatable. If it is allocatable, it must be contiguous as
one cannot allocate with strides; thus this patch should be save. (For
pointers, the world is different.)