Fortran LTO and array descriptors.

Thomas Koenig tkoenig@netcologne.de
Sun Feb 4 20:15:00 GMT 2018


Hi Richard,
> On February 3, 2018 6:17:15 PM GMT+01:00, Thomas Koenig <tkoenig@netcologne.de> wrote:
>> I wrote:
>>
>>> -  descriptor_dimension dim[r];\
>>> +  descriptor_dimension dim[];\
>>>    }
>>
>>> which works well
>>
>> ... up to a point, there are numerous dtio failures
>> when regression testing this.
>>
>> So, clearly not ready for prime time :-)
> 
> As far as I remember libgfortran has function signatures with the array descriptor with the maximum number of dimensions and the frontend generates aliased function decls with descriptors of the number of dimensions of the actual argument?
> 
> I believe the solution to the problem is to have the frontend
> emit only one declaration matching the library one

That is definitely preferred.

> and passing down pointers to descriptors that are accessed via the same full dimension type.
> 
> That can be achieved by either making all array descriptor instances full size

Unfortunately, this is quite wasteful of memory. On a 64-bit system, we
have 24 bytes per dimension; if we allocated a full rank 15
descriptor for a rank one array, we would have 336 unused bytes
on the stack.

> or by doing _all_ actual accesses via that type. Like in pseudo C code:
> 
> Array2 two_dim;
> ((arrayFullDim *) & two_dim) - >data =... ;

Would it also be OK to make this a cast to a flexible member type?

Regards

	Thomas



More information about the Fortran mailing list