@@ -565,7 +565,7 @@ void OpenMPIRBuilder::getKernelArgsVector(TargetKernelArgs &KernelArgs,
565565 Flags,
566566 NumTeams3D,
567567 NumThreads3D,
568- KernelArgs.DynCGGroupMem };
568+ KernelArgs.DynCGroupMem };
569569}
570570
571571void OpenMPIRBuilder::addAttributes (omp::RuntimeFunction FnID, Function &Fn) {
@@ -8229,7 +8229,8 @@ static void emitTargetCall(
82298229 OpenMPIRBuilder::GenMapInfoCallbackTy GenMapInfoCB,
82308230 OpenMPIRBuilder::CustomMapperCallbackTy CustomMapperCB,
82318231 const SmallVector<llvm::OpenMPIRBuilder::DependData> &Dependencies,
8232- bool HasNoWait) {
8232+ bool HasNoWait, Value *DynCGroupMem,
8233+ OMPDynGroupprivateFallbackType DynCGroupMemFallback) {
82338234 // Generate a function call to the host fallback implementation of the target
82348235 // region. This is called by the host when no offload entry was generated for
82358236 // the target region and when the offloading call fails at runtime.
@@ -8365,12 +8366,13 @@ static void emitTargetCall(
83658366 /* isSigned=*/ false )
83668367 : Builder.getInt64 (0 );
83678368
8368- // TODO: Use correct DynCGGroupMem
8369- Value *DynCGGroupMem = Builder.getInt32 (0 );
8369+ // Request zero groupprivate bytes by default.
8370+ if (!DynCGroupMem)
8371+ DynCGroupMem = Builder.getInt32 (0 );
83708372
83718373 KArgs = OpenMPIRBuilder::TargetKernelArgs (
8372- NumTargetItems, RTArgs, TripCount, NumTeamsC, NumThreadsC,
8373- DynCGGroupMem, HasNoWait, OMPDynGroupprivateFallbackType::Abort );
8374+ NumTargetItems, RTArgs, TripCount, NumTeamsC, NumThreadsC, DynCGroupMem,
8375+ HasNoWait, DynCGroupMemFallback );
83748376
83758377 // Assume no error was returned because TaskBodyCB and
83768378 // EmitTargetCallFallbackCB don't produce any.
@@ -8419,7 +8421,8 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createTarget(
84198421 OpenMPIRBuilder::TargetBodyGenCallbackTy CBFunc,
84208422 OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy ArgAccessorFuncCB,
84218423 CustomMapperCallbackTy CustomMapperCB,
8422- const SmallVector<DependData> &Dependencies, bool HasNowait) {
8424+ const SmallVector<DependData> &Dependencies, bool HasNowait,
8425+ Value *DynCGroupMem, OMPDynGroupprivateFallbackType DynCGroupMemFallback) {
84238426
84248427 if (!updateToLocation (Loc))
84258428 return InsertPointTy ();
@@ -8442,7 +8445,8 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createTarget(
84428445 if (!Config.isTargetDevice ())
84438446 emitTargetCall (*this , Builder, AllocaIP, Info, DefaultAttrs, RuntimeAttrs,
84448447 IfCond, OutlinedFn, OutlinedFnID, Inputs, GenMapInfoCB,
8445- CustomMapperCB, Dependencies, HasNowait);
8448+ CustomMapperCB, Dependencies, HasNowait, DynCGroupMem,
8449+ DynCGroupMemFallback);
84468450 return Builder.saveIP ();
84478451}
84488452
0 commit comments