[llvm] fdac7d0 - [OpenMPIRBuilder] NFC: Improve description of IsTargetDevice and IsGPU (#79322)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 04:51:46 PST 2024


Author: Sergio Afonso
Date: 2024-01-30T12:51:42Z
New Revision: fdac7d0b6f74f919d319b31a0680c77f66732586

URL: https://github.com/llvm/llvm-project/commit/fdac7d0b6f74f919d319b31a0680c77f66732586
DIFF: https://github.com/llvm/llvm-project/commit/fdac7d0b6f74f919d319b31a0680c77f66732586.diff

LOG: [OpenMPIRBuilder] NFC: Improve description of IsTargetDevice and IsGPU (#79322)

This patch tries to better explain the differences between the
`IsTargetDevice` and `IsGPU` flags of the `OpenMPIRBuilderConfig`.

Added: 
    

Modified: 
    llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 669104307fa0..2288969ecc95 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -83,11 +83,20 @@ BasicBlock *splitBBWithSuffix(IRBuilderBase &Builder, bool CreateBranch,
 /// are ones that are not dependent on the configuration.
 class OpenMPIRBuilderConfig {
 public:
-  /// Flag for specifying if the compilation is done for embedded device code
-  /// or host code.
+  /// Flag to define whether to generate code for the role of the OpenMP host
+  /// (if set to false) or device (if set to true) in an offloading context. It
+  /// is set when the -fopenmp-is-target-device compiler frontend option is
+  /// specified.
   std::optional<bool> IsTargetDevice;
 
-  /// Flag for specifying if the compilation is done for an accelerator.
+  /// Flag for specifying if the compilation is done for an accelerator. It is
+  /// set according to the architecture of the target triple and currently only
+  /// true when targeting AMDGPU or NVPTX. Today, these targets can only perform
+  /// the role of an OpenMP target device, so `IsTargetDevice` must also be true
+  /// if `IsGPU` is true. This restriction might be lifted if an accelerator-
+  /// like target with the ability to work as the OpenMP host is added, or if
+  /// the capabilities of the currently supported GPU architectures are
+  /// expanded.
   std::optional<bool> IsGPU;
 
   // Flag for specifying if offloading is mandatory.


        


More information about the llvm-commits mailing list