[all-commits] [llvm/llvm-project] 6dd639: [CIR][OpenACC] Implement 'routine' lowering + seq ...

Erich Keane via All-commits all-commits at lists.llvm.org
Tue Dec 2 11:55:37 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dd639ec9e7aeb957ec0b2bc0830ecdf6ce5efaa
      https://github.com/llvm/llvm-project/commit/6dd639ec9e7aeb957ec0b2bc0830ecdf6ce5efaa
  Author: Erich Keane <ekeane at nvidia.com>
  Date:   2025-12-02 (Tue, 02 Dec 2025)

  Changed paths:
    M clang/include/clang/AST/ASTConsumer.h
    M clang/include/clang/CIR/CIRGenerator.h
    M clang/include/clang/Sema/SemaOpenACC.h
    M clang/lib/CIR/CodeGen/CIRGenDeclOpenACC.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.h
    M clang/lib/CIR/CodeGen/CIRGenerator.cpp
    M clang/lib/CIR/FrontendAction/CIRGenAction.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaOpenACC.cpp
    R clang/test/CIR/CodeGenOpenACC/openacc-not-implemented-global.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-anon-ns.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-globals.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-globals2.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-locals.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-members.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-ns.cpp
    A clang/test/CIR/CodeGenOpenACC/routine-templ.cpp
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp

  Log Message:
  -----------
  [CIR][OpenACC] Implement 'routine' lowering + seq clause (#170207)

The 'routine' construct just adds a acc.routine element to the global
module, which contains all of the information about the directive. it
contains a reference to the function, which also contains a reference to
the acc.routine, which this generates.

This handles both the implicit-func version (where the routine is
    spelled without parens, and just applies to the next function) and
the explicit-func version (where the routine is spelled with the func
    name in parens).

The AST stores the directive in an OpenACCRoutineDeclAttr in the
implicit case, so we can emit that when we hit the function declaration.
The explicit case is held in an OpenACCRoutineAnnotAttr on the function,
however, when we emit the function we haven't necessarily seen the
construct yet, so we can't depend on that attribute. Instead, we save up
the list in Sema so that we can emit them all at the end.

This results in the tests getting really hard to read (because ordering
is a little awkward based on spelling, with no way to fix it), so we
instead split the tests up based on topic.

One last thing: Flang spends some time determining if the clause lists
of two routines on the same function are identical, and omits the
duplicates. However, it seems to do a poor job on this when the ordering
isn't the same, or references are slightly different. This patch doesn't
bother trying that, and instead emits all, trusting the ACC dialect to
remove duplicates/handle duplicates gracefully.

Note; This doesn't cause emission of functions that would otherwise not
be emitted, but DOES emit routine references based on which function
they are attached to.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list