J3/09-108 To: J3 From: Van Snyder Subject: Alternative and simpler method for atomic accesses, UTI 154 Reference: 09-007 Date: 2009 January 12 1. The problem The scheme dreamed up at meeting 186 to specify atomic accesses to a few types and kinds of objects requires two intrinsic subroutines. We already have syntax for reference and definition. A simpler scheme, exploiting existing syntactic mechanisms is proposed here. In addition to simpler sytax and simpler explanation, atomic references would be more efficient, because they do not require copying the atomically referenced object to another variable before using its value. 2. Edits [117:8+ R601] ---------------------------------------------------------- Insert "<> " after "<> ". Maybe alphabetize all of the right-hand sides. [121:5-] --------------------------------------------------------------- Insert a new subclause "6.4.2a Atomic indicator R613a <> % ATOMIC C618a The shall be of type integer with kind ATOMIC_INT_KIND (13.8.2.2) or of type logical with kind ATOMIC_LOGICAL_KIND (13.8.2.3). C618b The shall not be a component of an object of a sequence type (4.5.2.3) or of a type with the BIND(C) attribute. {So the processor can arrange convenient alignment:} C618c If an atomic indicator is an actual argument, the corresponding dummy argument shall have the VALUE attribute. {Require copy-in for atomic actual arguments, to avoid thunking or hoping for copy in/out; maybe put it at [294:22+ C1236b] with "atomic indicator" and "actual argument" exchanged:} If an atomic indicator appears o in a reference, the entirety of the value of the designated entity is produced as if instantaneously, and o in a variable definition context, the entirety of the value of the designated entity is defined as if instantaneously, without interfering with or interference from other images or processes defined by means other than Fortran. NOTE 6.5a Suppose a processor represents LOGICAL(ATOMIC_LOGICAL_KIND) using two octets, and suppose its values are represented by Z'0000' or Z'FFFF'. An atomic reference to or definition of such an object would always produce one of those values, and never produce either Z'00FF' or Z'FF00', even if another image, or a process defined by means other than Fortran, is defining it concurrently." [190:12-14 8.5.1p6] ---------------------------------------------------- Replace the first sentence of the paragraph: "An atomic (6.4.2a) reference to a coarray or coindexed object is permitted during execution of a segment that is unordered relative to the execution of a segment in which an atomic definition of it occurs." [193:NOTE 8.38] -------------------------------------------------------- Replace "CALL ATOMIC_DEFINE (LOCKED[Q], FALSE)" by "LOCKED[Q]%ATOMIC = .FALSE" Replace "VAL = .TRUE. DO WHILE (VAL) CALL ATOMIC_REF (VAL, LOCKED)" by "DO WHILE ( LOCKED%ATOMIC )" [325: Table 13.1] ------------------------------------------------------ Delete "ATOMIC_DEFINE" and "ATOMIC_REF" lines. [337:17-338:10 13.7.20-21] --------------------------------------------- Delete subclauses 13.7.20 and 13.7.21 (ATOMIC_DEFINE and ATOMIC_REF). [402:13, 16] ----------------------------------------------------------- At both places, insert "(6.4.2a)" after the first "atomic", and delete "specified by atomic subroutines".