Skip to content

Conversation

@everythingfunctional
Copy link
Member

@everythingfunctional everythingfunctional commented Dec 19, 2024

Description

Updates the collective interfaces and implementations to match the latest PRIF 0.5 revision.

Largely rewrites all the relevant test code.

This PR was begun by @everythingfunctional and has been continued by @bonachea.

Fixes #69
Fixes #132
Fixes #144
Fixes #151
Fixes #152
Fixes #153
Fixes #154
Fixes #155
Fixes #159

Status:

  • Ready for review!
  • Passes testing on Flang {19.1.1, 20.1.0}, gfortran {13.3, 14.2}
  • The (deprecated) Flang -Ofast option has been replaced with -O3, and flags specific to flang-19 have been hoisted out of install.sh into CI input.
  • One co-reduce subtest remains disabled, due to missing compiler support for parameterized derived types in both flang 20 and gfortran 14.2. This is mostly notable because this test is (a simplified version of) the example code presented in the prif_co_reduce section of PRIF 0.5 spec. However there's probably nothing further we can do about this other than filing compiler bugs.
  • prif_co_{min,max,sum} do not support long double (or long double complex), nor do they support integer types wider than 64-bit. However those types seem sufficiently unimportant in practice that I think we should just open an issue and defer it indefinitely.

@rouson
Copy link
Collaborator

rouson commented Dec 23, 2024

@everythingfunctional flang supports kind type parameters for derived types but not length type parameters. Does Caffeine use length type parameters?

@everythingfunctional
Copy link
Member Author

Does Caffeine use length type parameters?

One of the tests was trying to demonstrate how co_reduce could be used with derived types with length type parameters. Otherwise Caffeine does not use length type parameters.

@bonachea bonachea mentioned this pull request Dec 28, 2024
Copy link
Member

@bonachea bonachea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, although there's obviously still a ways to go before it reaches feature parity with PRIF 0.4 / main

@bonachea
Copy link
Member

Brad's version at 171bf08 rebased onto main and conflicts resolved manually

@bonachea bonachea force-pushed the update-collectives branch 2 times, most recently from e2140ff to 94f2c07 Compare March 25, 2025 23:34
@bonachea bonachea requested review from ktras and rouson March 26, 2025 01:54
@bonachea bonachea marked this pull request as ready for review March 26, 2025 01:54
@bonachea
Copy link
Member

Now also fixes #159, completing the Collectives Subroutines

@bonachea bonachea changed the title Update collectives Update collective subroutines to match PRIF 0.5 Mar 27, 2025
everythingfunctional and others added 11 commits March 31, 2025 14:11
test(collectives): outline simpler test suite

chore: remove old collective implementations

chore: update interfaces of collectives

feat(co_broadcast): use wrapper to make contiguous

feat: re-implement co_sum

feat: create implementation of co_reduce

feat: create co_min implementation

feat: create implementation for co_max
These now pass using our flang-new snapshot on perlmutter:

flang version 21.0.0git (git@github.com:llvm/llvm-project.git 5929de8c7731748bf58ad9b1fedfed75e7aae455)

co_sum test remains broken at runtime.
Fix a critical bug in char_max_wrapper

Fixes #151
Fixes #152
Be more explicit and add more sanity-check assertions
`-mmlir -allow-assumed-rank` are unnecessary in current versions of flang-21
that we are using/requiring.

`-Ofast` is a deprecated option that causes our build to spew spurious warnings.
More importantly, it appears responsible for ICEs with the code on this branch.

Resolves #196
* Workaround a lack of F18 intrinsic REDUCE() in gfortran (13)
… derived types

Our test of prif_co_reduce over an array of parameterized derived type appears
to require compiler support that is lacking in both recent flang and gfortran.
Disable it gated by an optional command-line define HAVE_PARAM_DERIVED

Add comments.
@bonachea bonachea force-pushed the update-collectives branch from 155d529 to eb8500e Compare March 31, 2025 21:17
@bonachea
Copy link
Member

Rebased to pickup CI changes on main

bonachea added 5 commits April 3, 2025 13:28
Also fix flang detection, which only happenned to work when the
flang install appeared in a directory containing the string `llvm`
Eliminate code duplication and rename local variables for clarity
There are ZERO changes in this commit, just file renames
bonachea and others added 2 commits April 4, 2025 18:38
Co-authored-by: Katherine Rasmussen <krasmussen@lbl.gov>
For unrelated reasons we no longer support the gfortran version 11 that
motivated this now-obsolete workaround.
Copy link
Collaborator

@ktras ktras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the response to feedback.

@bonachea bonachea merged commit 603bd0d into main Apr 5, 2025
16 checks passed
@bonachea bonachea deleted the update-collectives branch April 5, 2025 01:40
bonachea added a commit to bonachea/caffeine that referenced this pull request Apr 5, 2025
PR BerkeleyLab#158 brings the collectives into compliance with PRIF 0.5.

As such prif.F90 is now believed to contain correct interfaces backed by
linkable procedures for every entry point specified in PRIF 0.5.

Some procedures still throw an unimplemented error if invoked
at runtime (see docs/implementation-status.md for the latest on
implementation status), but the interfaces are complete.

Resolves issue BerkeleyLab#157
bonachea added a commit to bonachea/caffeine that referenced this pull request Apr 5, 2025
PR BerkeleyLab#158 brought the collectives interface into compliance with PRIF 0.5.

As such the prif.F90 provided by Caffeine is now believed to contain correct
interfaces for every entry point specified in PRIF 0.5, and all are backed by
linkable procedures.

Some procedures still throw an unimplemented error if invoked at runtime (see
docs/implementation-status.md for the latest on implementation status), but the
interfaces are complete.

Resolves issue BerkeleyLab#157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment