This is an archive of the discontinued LLVM Phabricator instance.

[flang][runtime] Clean up asynchronous I/O APIs
ClosedPublic

Authored by klausler on May 21 2022, 10:09 PM.

Details

Summary

Now that the requirements and implementation of asynchronous I/O are
better understood, adjust their I/O runtime APIs. In particular:

  1. Remove the BeginAsynchronousOutput/Input APIs; they're not needed, since any data transfer statement might have ASYNCHRONOUS= and (if ASYNCHRONOUS='YES') ID= control list specifiers that need to at least be checked.
  2. Add implementations for BeginWait(All) to check for the error case of a bad unit number and nonzero ID=.
  3. Rearrange and comment SetAsynchronous so that it's clear that it can be called for READ/WRITE as well as for OPEN.

The implementation remains completely synchronous, but should be conforming.
Where opportunities make sense for true asynchronous implementations of
some big block transfers without SIZE= in the future, we'll need to add
a GetAsynchronousId API to capture ID= on a READ or WRITE; add sourceFile
and sourceLine arguments to BeginWait(All) for good error reporting;
track pending operations in unit.h; and add code to force synchronization
to non-asynchronous I/O operations.

Lowering should call SetAsynchronous when ASYNCHRONOUS= appears as
a control list specifier. It should also set ID=x variables to 0
until such time as we support asynchronous operations, if ever.
This patch only removes the removed APIs from lowering.

Diff Detail

Event Timeline

klausler created this revision.May 21 2022, 10:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2022, 10:09 PM
klausler requested review of this revision.May 21 2022, 10:09 PM
vdonaldson accepted this revision.May 23 2022, 10:13 AM
This revision is now accepted and ready to land.May 23 2022, 10:13 AM
This revision was automatically updated to reflect the committed changes.