This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] [0/11] Inline transpose part 1


Hello,

this patch serie implements inlining transpose, in other words, transpose as a scalarizer thing.


* In the current implementation *


for an array reference like a(1,2,:,3,:), the scalarizer info is filled along the 3th and 5th dimensions, and the dim array holds the value {2,4} (index starts at 0).
Then, transpose(a(1,2,:,3,:)) has a completely new scalarizer info filled along the 1st and 2nd dimensions, the dim array holding the value {0,1}. At trans stage, there is a trick to create a descriptor with exchanged strides, so that the descriptor's 1st dimension will actually access the array's 2nd dimension (or the 5th of `a' in the case above) and vice versa.


* What the patch does *

is evaluate transpose(a(...)) as a(...) itself, with the scalarizer's dim exchanged ({4,2} instead of {2,4} in the case above).

This breaks some assumptions in the code and leads to various unrelated
regression, which are fixed by the patches 3..9 and 11. The actual patch is the 10th.


The good thing:
With the patches transpose(a+b) is handled without a temporary for (a + b).

The bad thing:
With the patches function(transpose(a)) needs a temporary for transpose(a) which was not needed before. This is due to the trans stage trick which is gone, and will have to come back save us in gfc_conv_expr_descriptor: this is the point of the inline transpose part 2 patch serie (to come).



The patches were tested one by one on an older revision, and only all together recently. No regression. I will ask for committal on trunk for every of them.


Mikael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]