diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2023-11-29 14:49:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 14:49:13 -0800 |
commit | fae233c63f93b4b6f9693685abe6c7d24393682f (patch) | |
tree | b090300b7d6e759027ba9639e6f5078f91aa3957 /openmp | |
parent | 0737be349d1be99ca34d9b99fbd3e0cf10d6481e (diff) | |
download | llvm-fae233c63f93b4b6f9693685abe6c7d24393682f.zip llvm-fae233c63f93b4b6f9693685abe6c7d24393682f.tar.gz llvm-fae233c63f93b4b6f9693685abe6c7d24393682f.tar.bz2 |
[OpenMP] Avoid initializing the KernelLaunchEnvironment if possible (#73864)
If we don't have a team reduction we don't need a kernel launch
environment (for now). In that case we can avoid the cost.
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp index 477e0ca..2ba9aca 100644 --- a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp +++ b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp @@ -464,6 +464,10 @@ GenericKernelTy::getKernelLaunchEnvironment( if (isCtorOrDtor() || RecordReplay.isReplaying()) return nullptr; + if (!KernelEnvironment.Configuration.ReductionDataSize || + !KernelEnvironment.Configuration.ReductionBufferLength) + return reinterpret_cast<KernelLaunchEnvironmentTy *>(~0); + // TODO: Check if the kernel needs a launch environment. auto AllocOrErr = GenericDevice.dataAlloc(sizeof(KernelLaunchEnvironmentTy), /*HostPtr=*/nullptr, @@ -478,8 +482,7 @@ GenericKernelTy::getKernelLaunchEnvironment( /// async data transfer. auto &LocalKLE = (*AsyncInfoWrapper).KernelLaunchEnvironment; LocalKLE = KernelLaunchEnvironment; - if (KernelEnvironment.Configuration.ReductionDataSize && - KernelEnvironment.Configuration.ReductionBufferLength) { + { auto AllocOrErr = GenericDevice.dataAlloc( KernelEnvironment.Configuration.ReductionDataSize * KernelEnvironment.Configuration.ReductionBufferLength, |