[flang-commits] [flang] [flang] Allow acc cache directive inside acc routine (PR #184213)

Razvan Lupusoru via flang-commits flang-commits at lists.llvm.org
Mon Mar 2 13:52:54 PST 2026


razvanlupusoru wrote:

The following document should be updated to note this extension: https://github.com/llvm/llvm-project/blob/main/flang/docs/OpenACC.md

Also, I question whether we should even have a semantic check about this in the first place. Clang-CIR chose to allow "orphaned" `acc cache` without further checking. This is useful because implicit `acc routine` might be applied later. Additionally, I believe your extension won't work when `acc routine` is not declared within the body of the function eg something like:
```
  subroutine routine_with_cache()
    real(8), dimension(N) :: local_arr
    integer :: j
    !$acc cache(local_arr)
    !$acc loop
    do j = 1, N
      local_arr(j) = a(j)
    end do
  end subroutine
  
  !$acc routine(routine_with_cache) vector
```


https://github.com/llvm/llvm-project/pull/184213


More information about the flang-commits mailing list