(j3.2006) "Contiguous" doesn't quite do what I need
Bill Long
longb
Mon Mar 26 13:01:31 EDT 2007
Van Snyder wrote:
>
>If I have a contiguous multidimensional array for which I know the
>extent of the leading dimension is 3, or of the two leading dimensions
>is 2x2, and I do an operation on (1:3,:) or (1:2,2:2,:), any benefit the
>processor might have gotten from the contiguous attribute at least
>partly (mostly?) evaporates, because the processor doesn't know the
>extent from the declaration.
>
If you are saying that explicit-shape declarations with constant bounds
lead to more efficient code that assumed-shape declarations, then I
certainly agree. In the later case the processor has to extract the
extent from the dope vector, involving one memory reference. But more
advanced compiler technology is needed to make any use of the actual
value in generating optimal code. Same is true for explicit-shape
arrays if the bounds are variables.
>It has to assume that the spacing along
>the second (third) dimension comes from the (product of the) length(s)
>of the earlier dimension(s).
>
Well, the compiler does not generate code to do the products each time
- only once when the array is allocated. That computed spacing
information is also in the dope vector - one more memory reference,
though probably from cache by this point.
>This will lead me to clutter my code with
>#ifdef's that result from experiments that determine whether it's better
>for a particular processor to peel loops or exploit contiguity, since
>none can do both. What a dog's breakfast we're making.
>
I'm not sure how any of this relates to loop peeling - maybe loop
unwinding. Either of which is independent of contiguity. I don't think
we (j3) are making a dog's breakfast. Sounds like this particular code
might qualify, though.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the J3
mailing list