24 Commits

Author SHA1 Message Date
erichkeane
0a2b6f6c1c [OpenACC] Fix 'copyout' allowed modifiers alwaysin vs alwaysout
While doing lowering, I discovered that the restriction onthe allowed
modifiers for 'copyout' didn't make sense! After discussion on the
OpenACC standards mailing list I discovered that this was a copy/paste
error during standardization that they intend to fix, and really meant
for copyout to allow alwaysout instead of alwaysin.

When implementing, I blindly followed the standard :)

This patch corrects the implementation to do what was meant.
2025-06-26 10:26:20 -07:00
erichkeane
d47401e376 [OpenACC] Start enforcing 'device_type' clause values
Researching in prep of doing the implementation for lowering, I found
that the source of the valid identifiers list from flang is in the
frontend.  This patch adds the same list to the frontend, but does it as
a sema diagnostic, so we still parse it as an identifier/identifier-like
thing, but then diagnose it as invalid later.
2025-04-09 14:55:50 -07:00
erichkeane
6263de90df [OpenACC] Implement 'modifier-list' sema/AST
OpenACC 3.3-NEXT has changed the way tags for copy, copyin, copyout, and
create clauses are specified, and end up adding a few extras, and
permits them as a list.  This patch encodes these as bitmask enum so
they can be stored succinctly, but still diagnose reasonably.
2025-04-04 12:32:33 -07:00
erichkeane
bb8a7a7349 [OpenACC] Implement 'pqr-list' has at least one 1 item.
OpenACC Github PR#499 defines the pqr-list as having at least 1 item. We
already handle that for all but 'wait', so this patch just does the work
to add it for 'wait', plus adds tests.
2025-04-02 13:33:18 -07:00
erichkeane
7d89ebfd5f [OpenACC] Implement 'reduction' for combined constructs.
Once again, this is a clause on a combined construct that does almost
exactly what the loop/compute construct version does, only with some sl
ightly different evaluation rules/sema rules as it doesn't have to
consider the parent, just the 'combined' construct.  The two sets of
rules for reduction on loop and compute are fine together, so this
ensures they are all enforced for this too.

The 'gangs' 'num_gangs' 'reduction' diagnostic (Dim>1) had to be applied
to num_gangs as well, as it previously wasn't permissible to get in this
situation, but we now can.
2024-12-09 14:06:44 -08:00
erichkeane
009b5e8e59 [OpenACC] 'vector' clause implementation for combined constructs
Similar to 'worker', the 'vector' clause has some rules that needed to
be applied on its argument legality that for combined constructs need to
look at the current construct, not the 'effective' parent construct.
Additionally, it has some interaction with `vector_length` that needed
to be encoded as well.  This patch implements it.
2024-12-06 09:06:57 -08:00
erichkeane
cb6a02abe2 [OpenACC] Implement 'worker' clause for combined constructs
This is very similar to 'gang', except with fewer restrictions, and only an
interaction with 'num_workers', plus disallowing 'gang' and 'worker' in
its associated statement.  This patch implements this, the same as how
'gang' implemented it.
2024-12-05 10:43:52 -08:00
erichkeane
3a4b9f3891 [OpenACC] Implement 'gang' clause for Combined Constructs
This one is a bit complicated, as it has some interesting interactions,
as 'gang' Sema is required to look at its containing compute construct.
Except in the case of a combined construct, they are the same. This
resulted in a large refactor of the checking code for CheckGangExpr,
plus some additional work on the diagnostics for its interaction with
'num_gangs' and 'vector'/'worker'.
2024-12-05 06:35:36 -08:00
erichkeane
eb257fe37b [OpenACC] Enable 3 more clauses for combined constructs.
'num_gangs', 'num_workers', and 'vector_length' are similar to
eachother, and are all the same implementation as for compute
constructs, so this patch just enables them and adds the necessary
testing to ensure they work correctly.  These will get more complicated
when they get combined with 'gang', 'worker', 'vector' and 'reduction',
but those restrictions will be implemented when those clauses are
enabled.
2024-12-03 09:31:40 -08:00
erichkeane
0aa7892772 [OpenACC] Implement 'tile' for combined constructs
Like collapse, this clause has only mild changes that need to be made.
Most of the associated work for the RAII container was already done
previously, so this is mostly just updating the diagnostics to properly
emit the right construct.
2024-12-02 13:31:36 -08:00
erichkeane
0aef005c94 [OpenACC] Implement 'collapse' for combined constructs.
Most of the restrictions on 'collapse' involve the contents of the loop,
so this extends enforcement of all of that to all combined construct
loops, and alters the diagnostics to better reflect the construct it is
associated with.
2024-12-02 12:49:49 -08:00
erichkeane
1f2aeef97b [OpenACC] Enable copy/create clauses for combined constructs
This is the last set of 'no op' changes, and are all incredibly similar,
so they are being done together.  They work the exact same for combined
constructs as they do for compute constructs, so this adds tests and
enables them.
2024-12-02 11:15:35 -08:00
erichkeane
8c1bd9792b [OpenACC] Expose 'no_create' clause in combined constructs
Once again, not much work besides ensuring they are supposed to work the
same.
2024-11-27 12:03:48 -08:00
erichkeane
bbbaeb5584 [OpenACC] Enable 'attach' clause for combined constructs
Once again, this clause has the same implementation for compute
constructs as combined, so this adds the tests and enables it.
2024-11-27 09:55:19 -08:00
erichkeane
969b7658fe [OpenACC] Enable 'wait' for combined constructs
Once again a situation where the combined and compute do the exact same
thing as far as Sema/AST/etc is concerned, so this patch adds tests and
enables it.
2024-11-27 08:32:33 -08:00
erichkeane
8d6c73cbf5 [OpenACC] enable 'deviceptr' for combined constructs.
This is another clause whose implementation is identical for combined
constructs as with compute constructs, so this adds tests and enables
it.
2024-11-27 07:04:15 -08:00
erichkeane
78c7024640 [OpenACC] Implement 'present' for combined constructs.
This is another clause where the parsing does all the required
enforcement besides the construct it appertains to, so this patch
removes the restriction and adds sufficient test coverage for combined
constructs.
2024-11-26 10:49:41 -08:00
erichkeane
1b44c3a142 [OpenACC] enable 'async' clause for combined constructs
No additional work required over what we did for other constructs, so
this is just adding the tests and enabling the clauses.
2024-11-14 11:18:06 -08:00
erichkeane
1cd981a5f3 [OpenACC] Implement private/firstprivate for combined constructs
This is another pair of clauses where the work is already done from
previous constructs, so this just has to allow them and include tests
for them. This patch adds testing, does a few little cleanup bits on the
clause checking, and enables these.
2024-11-14 09:57:39 -08:00
erichkeane
b7f7e64548 [OpenACC] Implement 'default' clause for Combined Constructs
This clause takes one of two fixed values, and can apply to all three of
the combined constructs. Tests/etc are all exactly like the compute
constructs, so committing them all here.
2024-11-14 06:41:10 -08:00
erichkeane
95fa5f39a0 [OpenACC] Fix ast-print test that failed due to copy/paste error 2024-11-13 13:02:13 -08:00
erichkeane
fa20b5d30d [OpenACC] 'if' and 'self' clause implementation for Combined Constructs
These two are identical to how they work for compute constructs, so this
patch enables them and ensures there is sufficient testing.
2024-11-13 12:42:53 -08:00
erichkeane
6b2de10c68 [OpenACC] implement 'device_type' for combined constructs
This clause is pretty small/doesn't do much semantic-analysis-wise, , other than
have two spellings and disallow certain clauses after it. However, as
most of those aren't implemented yet, the diagnostic is left as a TODO.
2024-11-13 09:57:40 -08:00
erichkeane
3169a38ddf [OpenACC] Add ast-print test for combined constructs 2024-11-13 07:11:56 -08:00