[Bug fortran/72741] Fortran OpenACC routine directive doesn't properly handle clauses specifying the level of parallelism
cesar at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 9 16:43:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72741
--- Comment #4 from cesar at gcc dot gnu.org ---
I could be mistaken, but I don't think there's anything we can do about that
test case because fortran doesn't have file scope. Specifically, in your
example,
SUBROUTINE r_w
IMPLICIT NONE
INTEGER :: i
!$ACC ROUTINE WORKER
!$ACC LOOP
DO i = 1, 12345
END DO
END SUBROUTINE r_w
PROGRAM main
IMPLICIT NONE
EXTERNAL :: r_w
!$ACC ROUTINE (r_w) GANG
!$ACC PARALLEL
CALL r_w
!$ACC END PARALLEL
END PROGRAM main
from program main's perspective, r_w should be an acc routine with a gang
attribute, but that's only because the end user included an explicit 'external'
function declaration. I'm not sure how to catch mismatched function
declarations in fortran, especially if lto is not enabled. If lto is enabled,
we could add some more checking in pass oacc_device_lower. But I don't think
there's anything else to do in the fortran front end.
It should be noted that if the user wants to avoid these types of problems, acc
routines should be placed inside modules. That way, each procedure sees the
same acc routine attributes.
More information about the Gcc-bugs
mailing list