[J3] [BULK] Re: [EXTERNAL] Should all intrinsic functions be simple?
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Tue Dec 19 20:32:35 UTC 2023
Reuben,
I think it is the other way around. The definition of SIMPLE is missing a bit that might be hard to define in the standard. If so then we need a more nuanced list of SIMPLE intrinsics.
The key thing with the “bad” intrinsic procedures is that there is an implicit context that is accessed when they run. I strongly suspect that under-the-hood, there is the equivalent of COMMON/Save in the form of some private state inside the run-time library.
This is one of the reasons I was uncomfortable with the coarray approach of not passing an object to the intrinsics. With MPI we have a “comm” object that controls access. (MPI has other sins, so just defending the value of biting the bullet and accepting another argument can be a good thing in an intrinsic.)
* Tom
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Tuesday, December 19, 2023 at 2:59 PM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: "Reuben D. Budiardja" <reubendb at ornl.gov>
Subject: [BULK] Re: [J3] [EXTERNAL] Should all intrinsic functions be simple?
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
On 12/19/23 11:04, Brad Richardson via J3 wrote:
<snipped>
However, that would not
necessarily be true for all of the intrinsic functions. Take the
following example:
cur_team = get_team()
...
change team (new_team)
cur_team = get_team()
...
end team
Clearly, it is intended that the two calls to get_team return different
results, so common subexpression elimination would not be valid here.
Also, conceptually, it would not be possible to implement this call in
a way that does "not contain a designator of a variable that is
accessed by use or host association" or "not contain a reference to a
variable in a common block" as it clearly must be accessing some global
state of the program.
Intrinsic functions which may be affected include:
* failed_images
* get_team
* image_index
* num_images
* stopped_images
* team_number
* this_image
I think this is conflating what a compiler may need to do with the
actual program. From the program standpoint, the example above does not
violate any of the simple-ness constraints (or any of the listed
function). So I still think they are SIMPLE.
Best,
Reuben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20231219/46f8b622/attachment.htm>
More information about the J3
mailing list