(j3.2006) (SC22WG5.3715) [ukfortran] Atomic stuff

Jim Xia jimxia
Wed Dec 3 13:36:29 EST 2008


j3-bounces at j3-fortran.org wrote on 12/03/2008 01:14:52 PM:

> >Now I take another look at the atomic stuff we worked out in Tokyo, I 
> >think there is an issue we didn't address: alignment.  Consider on a 
> >system we have atomic_integer_kind being 4 bytes, and the processor 
also 
> >supports 2 byte integers, then the following declarations
> >
> >    integer(2) x(3)
> >    integer(ATOMIC_INTEGER_KIND) y, z
> >
> >    equivalence (y, x(2))
> >    equivalence (z, x)
> >
> >Now either y or z is out of natural alignment.  This will certainly 
cause 
> >implementation problems on atomic operations on y and z.  We have to 
> >disallow this to happen.
> 
> Already done for that example - see Note 5.42 in 5.7.1.5.

Nick, I don't see how that note (5.42) covers my example.


                                                              But let's 
say 
> that we make the appropriate changes to avoid that. Then it is clobbered 
by 
> constraint C589, C590, C591 and 4.5.2.3.
> 
> The problem has been there since time immemorial in the case of systems 
> where unaligned access is not supported (especially for DOUBLE 
PRECISION). 
> Yes, I know that the IBM System/360 (sic) Fortran library trapped the 
> interrupts and fixed up the alignment, but that was a performance 
disaster, 
> not all compilers did and some still don't. But, curiously, I can't find 

> where that that one is locked out.


Atomic loads and stores on mis-aligned variables are nearly impossible on 
many hardwares (The solution to fix up the mis-alignment by either 
hardware or OS causes the operation become non-atomic, let along the 
performance hit).

Three places I think will likely cause this mis-alignment: EQUIVELENCE, 
COMMON BLOCK and structure component level.  The one that is relevant to 
coarrays is structure component.  The other two will apply to local 
objects only.  We need to think how to fix that.

Cheers,

Jim Xia

RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20081203/9c45b2e7/attachment.html 



More information about the J3 mailing list