Skip to content

Add Fortran tests for named constants in data and firstprivate clauses#118

Open
Ryanpadrone wants to merge 7 commits intoOpenACCUserGroup:masterfrom
Ryanpadrone:namedConstant
Open

Add Fortran tests for named constants in data and firstprivate clauses#118
Ryanpadrone wants to merge 7 commits intoOpenACCUserGroup:masterfrom
Ryanpadrone:namedConstant

Conversation

@Ryanpadrone
Copy link
Copy Markdown

Feature:
OpenACC 3.4 section 1.6 clarifies that a Fortran named constant (PARAMETER) is a valid var and may appear anywhere a var is permitted in OpenACC syntax, including:
• compute clauses such as firstprivate
• data clauses such as copyin, present_or_copyin, and create

What this PR adds
– This PR introduces a new Fortran V&V test file, acc_named_constant.F90, that validates correct compiler and runtime behavior for named constants used in OpenACC clauses

These tests ensure that:

Named constants are accepted syntactically in both compute and data clauses
The constants value is correctly available on the device at runtime
Coverage includes:
--- Scalar and array named constants
--- INTEGER and REAL types
--- Compute (firstprivate) and data clause paths (copyin, create, present_or_copyin)
all named constants are used read-only, consistent with fortran semantics.
Test Coverage Summary
•T1-T2: firstprivate(PARAMETER)
verifies that scalar INTEGER and REAL named constants may appear in firstprivate clauses and are correctly initialized per device worker.
•T3: scalar named constant in copyin
Ensures named constants are treated as valid var items in data clause lists.
•T4: array named constant in firstprivate
Covers array descriptor handling in compute clauses.
•T5: array named constant in copyin
Covers array named constants in data clause lowering paths.
•T6: scalar named constant in create
Ensures named constants are accepted in data clause variants beyond copyin, and that their values are usable on the device.
•T7: scalar named constant in present_or_copyin
Extends data-clause coverage to combined/conditional data clauses, ensuring named constants are accepted and correctly usable on the device even when data presence is conditional.

–correctness is validated by device-sided computations that depend on the named constant and host-side verification results.

Compiler Results:
NVC: 25.5.0
--PASS

GCC: 15.2.0
--PASS(emits warnings about constants in clauses, but executes correctly)

CRAY: 18.0.0
--Fails at compile time (rejects named constants in clauses; behavior is non-conforming with OpenACC 3.4)

@ajarmusch ajarmusch added the v3.4 label Feb 26, 2026
@ajarmusch ajarmusch changed the title Add Fortran V&V tests for named constants in data and firstprivate clauses (OpenACC 3.4 §1.6) Add Fortran V&V tests for named constants in data and firstprivate clauses Feb 26, 2026
@ajarmusch ajarmusch changed the title Add Fortran V&V tests for named constants in data and firstprivate clauses Add Fortran tests for named constants in data and firstprivate clauses Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants