[all-commits] [llvm/llvm-project] 74c2b4: [OpenACC][CIR] Implement 'device_type' clause lowe...

Erich Keane via All-commits all-commits at lists.llvm.org
Thu Apr 10 12:38:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 74c2b41feb72698ea79b6bdc2dc566d0a25a68b0
      https://github.com/llvm/llvm-project/commit/74c2b41feb72698ea79b6bdc2dc566d0a25a68b0
  Author: Erich Keane <ekeane at nvidia.com>
  Date:   2025-04-10 (Thu, 10 Apr 2025)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
    M clang/test/CIR/CodeGenOpenACC/init.c
    M clang/test/CIR/CodeGenOpenACC/shutdown.c

  Log Message:
  -----------
  [OpenACC][CIR] Implement 'device_type' clause lowering for 'init'/'sh… (#135102)

…utdown'

This patch emits the lowering for 'device_type' on an 'init' or
'shutdown'. This one is fairly unique, as these directives have it as an
attribute, rather than as a component of the individual operands, like
the rest of the constructs.

So this patch implements the lowering as an attribute.

In order to do tis, a few refactorings had to happen: First, the
'emitOpenACCOp' functions needed to pick up th edirective kind/location
so that the NYI diagnostic could be reasonable.

Second, and most impactful, the `applyAttributes` function ends up
needing to encode some of the appertainment rules, thanks to the way the
OpenACC-MLIR operands get their attributes attached. Since they each use
a special function (rather than something that can be legalized at
runtime), the forms of 'setDefaultAttr' is only valid for some ops. SO
this patch uses some `if constexpr` and a small type-trait to help
legalize these.



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