J3/04-136 Date: 16 Dec. 2003 To: J3 From: Dan Nagle Subject: Better Description of Memory- Same Assumed Shape Processor speeds have increased to very much faster rates than memory speeds, compilers have improved to the point where most code sequences are nearly perfectly optimized. Separate compilation confounds "application compilers", pointers and targets complicate aliasing analysis. Therefore, more information regarding aliasing is essential for very high computational rates. The "Better Description of Memory" features attempt to define features which may provide this missing information to compilers. Since several features combine to do so, they are broken into individual papers for consideration. Title: Better Description of Memory- Same Assumed Shape Submitted By: J3 Status: For Consideration References: Basic Functionality: Allow declarations of assumed shape dummy arguments all having the same shape. Rationale: Situations exists where Fortran's current assumed size argument passing could result in better code if compilers could assume that some arrays had the same extents. This proposal suggests a way to do so. In some situations (internal procedures), the compiler may know that all shapes are the same, in others (external procedures or module procedures), worst case assumptions may need to be made. Estimated Impact: Compilers must recognize a new keywork, and apply the information to code generation. Detailed Specification: SAME_SHAPE_AS() Consider: subroutine muck_em( A, B, C) real, intent( in), dimension(:) :: A real, intent( inout), dimension(:) :: B real, intent( out), dimension(:) :: C B = A * B C = -A + B return end subroutine muck_em If the compiler can assume that A, B, C all have the same shape, size checking code may be eliminated and other improvements may be possible. For example, loop jamming may be easier. Note that differing intents prevent A, B, C from being declared on the same declaration, as would differing types or other attributes. A separate dimension statement has the same problem. real, intent( in), dimension(:) :: A real, intent( inout), same_shape_as( A) :: B real, intent( out), same_shape_as( A) :: C allows the compiler to assume that all arrays have the same shape. History: