Skip to content

Commit f4ed64f

Browse files
dhruvachakronlieb
authored andcommitted
[OpenMP] [OMPT] Use asynchrnous data transfer mode if only callbacks are activated (without tracing).
Change-Id: Ic3497768afefa9fa1c98b4defcfc7fd7a6dfdd7f
1 parent dcac304 commit f4ed64f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,7 +3070,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
30703070

30713071
// For large transfers use synchronous behavior.
30723072
// If OMPT is enabled or synchronous behavior is explicitly requested:
3073-
if (ompt::CallbacksInitialized || OMPX_ForceSyncRegions ||
3073+
if (ompt::TracingActive || OMPX_ForceSyncRegions ||
30743074
Size >= OMPX_MaxAsyncCopyBytes) {
30753075
if (AsyncInfoWrapper.hasQueue())
30763076
if (auto Err = synchronize(AsyncInfoWrapper))
@@ -3134,7 +3134,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
31343134

31353135
// For large transfers use synchronous behavior.
31363136
// If OMPT is enabled or synchronous behavior is explicitly requested:
3137-
if (ompt::CallbacksInitialized || OMPX_ForceSyncRegions ||
3137+
if (ompt::TracingActive || OMPX_ForceSyncRegions ||
31383138
Size >= OMPX_MaxAsyncCopyBytes) {
31393139
if (AsyncInfoWrapper.hasQueue())
31403140
if (auto Err = synchronize(AsyncInfoWrapper))
@@ -3189,7 +3189,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
31893189

31903190
// For large transfers use synchronous behavior.
31913191
// If OMPT is enabled or synchronous behavior is explicitly requested:
3192-
if (ompt::CallbacksInitialized || OMPX_ForceSyncRegions ||
3192+
if (ompt::TracingActive || OMPX_ForceSyncRegions ||
31933193
Size >= OMPX_MaxAsyncCopyBytes) {
31943194
if (AsyncInfoWrapper.hasQueue())
31953195
if (auto Err = synchronize(AsyncInfoWrapper))

openmp/libomptarget/src/device.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "device.h"
1414
#include "OffloadEntry.h"
15+
#include "OmptTracing.h"
1516
#include "OpenMP/Mapping.h"
1617
#include "OpenMP/OMPT/Callback.h"
1718
#include "OpenMP/OMPT/Interface.h"
@@ -174,7 +175,7 @@ int32_t DeviceTy::submitData(void *TgtPtrBegin, void *HstPtrBegin, int64_t Size,
174175
/*CodePtr=*/OMPT_GET_RETURN_ADDRESS);)
175176

176177
#ifdef OMPT_SUPPORT
177-
if (ForceSynchronousTargetRegions || !AsyncInfo || ompt::CallbacksInitialized)
178+
if (ForceSynchronousTargetRegions || !AsyncInfo || ompt::TracingActive)
178179
#else
179180
if (ForceSynchronousTargetRegions || !AsyncInfo)
180181
#endif
@@ -206,7 +207,7 @@ int32_t DeviceTy::retrieveData(void *HstPtrBegin, void *TgtPtrBegin,
206207
/*CodePtr=*/OMPT_GET_RETURN_ADDRESS);)
207208

208209
#ifdef OMPT_SUPPORT
209-
if (ForceSynchronousTargetRegions || ompt::CallbacksInitialized)
210+
if (ForceSynchronousTargetRegions || ompt::TracingActive)
210211
#else
211212
if (ForceSynchronousTargetRegions)
212213
#endif
@@ -237,8 +238,7 @@ int32_t DeviceTy::dataExchange(void *SrcPtr, DeviceTy &DstDev, void *DstPtr,
237238
/*CodePtr=*/OMPT_GET_RETURN_ADDRESS);)
238239

239240
#ifdef OMPT_SUPPORT
240-
if (ForceSynchronousTargetRegions || !AsyncInfo ||
241-
ompt::CallbacksInitialized) {
241+
if (ForceSynchronousTargetRegions || !AsyncInfo || ompt::TracingActive) {
242242
#else
243243
if (ForceSynchronousTargetRegions || !AsyncInfo) {
244244
#endif
@@ -277,7 +277,7 @@ int32_t DeviceTy::launchKernel(void *TgtEntryPtr, void **TgtVarsPtr,
277277
AsyncInfoTy &AsyncInfo) {
278278
if (ForceSynchronousTargetRegions || !RTL->launch_kernel ||
279279
#ifdef OMPT_SUPPORT
280-
ompt::CallbacksInitialized ||
280+
ompt::TracingActive ||
281281
#endif
282282
!RTL->synchronize)
283283
return RTL->launch_kernel_sync(RTLDeviceID, TgtEntryPtr, TgtVarsPtr,

0 commit comments

Comments
 (0)