Skip to content

Commit b7fcf51

Browse files
committed
[OpenMP][OpenMPIRBuilder] Add kernel launch codegen to emitTargetCall
This patch adds code emission in emitTargetCall to call the OpenMP runtime to launch an kernel, and to call the fallback host implementation if the launch fails. Reviewed By: TIFitis, kiranchandramohan, jdoerfert Differential Revision: https://reviews.llvm.org/D155633
1 parent 90b2556 commit b7fcf51

File tree

7 files changed

+177
-39
lines changed

7 files changed

+177
-39
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,12 @@ class OpenMPIRBuilder {
20882088
/// duplicating the body code.
20892089
enum BodyGenTy { Priv, DupNoPriv, NoPriv };
20902090

2091+
/// Callback type for creating the map infos for the kernel parameters.
2092+
/// \param CodeGenIP is the insertion point where code should be generated,
2093+
/// if any.
2094+
using GenMapInfoCallbackTy =
2095+
function_ref<MapInfosTy &(InsertPointTy CodeGenIP)>;
2096+
20912097
/// Generator for '#omp target data'
20922098
///
20932099
/// \param Loc The location where the target data construct was encountered.
@@ -2108,8 +2114,7 @@ class OpenMPIRBuilder {
21082114
OpenMPIRBuilder::InsertPointTy createTargetData(
21092115
const LocationDescription &Loc, InsertPointTy AllocaIP,
21102116
InsertPointTy CodeGenIP, Value *DeviceID, Value *IfCond,
2111-
TargetDataInfo &Info,
2112-
function_ref<MapInfosTy &(InsertPointTy CodeGenIP)> GenMapInfoCB,
2117+
TargetDataInfo &Info, GenMapInfoCallbackTy GenMapInfoCB,
21132118
omp::RuntimeFunction *MapperFunc = nullptr,
21142119
function_ref<InsertPointTy(InsertPointTy CodeGenIP,
21152120
BodyGenTy BodyGenType)>
@@ -2133,10 +2138,12 @@ class OpenMPIRBuilder {
21332138
/// as arguments to the outlined function.
21342139
/// \param BodyGenCB Callback that will generate the region code.
21352140
InsertPointTy createTarget(const LocationDescription &Loc,
2141+
OpenMPIRBuilder::InsertPointTy AllocaIP,
21362142
OpenMPIRBuilder::InsertPointTy CodeGenIP,
21372143
TargetRegionEntryInfo &EntryInfo, int32_t NumTeams,
21382144
int32_t NumThreads,
21392145
SmallVectorImpl<Value *> &Inputs,
2146+
GenMapInfoCallbackTy GenMapInfoCB,
21402147
TargetBodyGenCallbackTy BodyGenCB);
21412148

21422149
/// Declarations for LLVM-IR types (simple, array, function and structure) are

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4200,8 +4200,7 @@ Constant *OpenMPIRBuilder::registerTargetRegionFunction(
42004200
OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTargetData(
42014201
const LocationDescription &Loc, InsertPointTy AllocaIP,
42024202
InsertPointTy CodeGenIP, Value *DeviceID, Value *IfCond,
4203-
TargetDataInfo &Info,
4204-
function_ref<MapInfosTy &(InsertPointTy CodeGenIP)> GenMapInfoCB,
4203+
TargetDataInfo &Info, GenMapInfoCallbackTy GenMapInfoCB,
42054204
omp::RuntimeFunction *MapperFunc,
42064205
function_ref<InsertPointTy(InsertPointTy CodeGenIP, BodyGenTy BodyGenType)>
42074206
BodyGenCB,
@@ -4419,8 +4418,9 @@ createOutlinedFunction(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder,
44194418
static void
44204419
emitTargetOutlinedFunction(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder,
44214420
TargetRegionEntryInfo &EntryInfo,
4422-
Function *&OutlinedFn, int32_t NumTeams,
4423-
int32_t NumThreads, SmallVectorImpl<Value *> &Inputs,
4421+
Function *&OutlinedFn, Constant *&OutlinedFnID,
4422+
int32_t NumTeams, int32_t NumThreads,
4423+
SmallVectorImpl<Value *> &Inputs,
44244424
OpenMPIRBuilder::TargetBodyGenCallbackTy &CBFunc) {
44254425

44264426
OpenMPIRBuilder::FunctionGenCallback &&GenerateOutlinedFunction =
@@ -4429,32 +4429,81 @@ emitTargetOutlinedFunction(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder,
44294429
CBFunc);
44304430
};
44314431

4432-
Constant *OutlinedFnID;
44334432
OMPBuilder.emitTargetRegionFunction(EntryInfo, GenerateOutlinedFunction,
44344433
NumTeams, NumThreads, true, OutlinedFn,
44354434
OutlinedFnID);
44364435
}
44374436

4438-
static void emitTargetCall(IRBuilderBase &Builder, Function *OutlinedFn,
4439-
SmallVectorImpl<Value *> &Args) {
4440-
// TODO: Add kernel launch call
4441-
Builder.CreateCall(OutlinedFn, Args);
4437+
static void emitTargetCall(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder,
4438+
OpenMPIRBuilder::InsertPointTy AllocaIP,
4439+
Function *OutlinedFn, Constant *OutlinedFnID,
4440+
int32_t NumTeams, int32_t NumThreads,
4441+
SmallVectorImpl<Value *> &Args,
4442+
OpenMPIRBuilder::GenMapInfoCallbackTy GenMapInfoCB) {
4443+
4444+
OpenMPIRBuilder::TargetDataInfo Info(
4445+
/*RequiresDevicePointerInfo=*/false,
4446+
/*SeparateBeginEndCalls=*/true);
4447+
4448+
OpenMPIRBuilder::MapInfosTy &MapInfo = GenMapInfoCB(Builder.saveIP());
4449+
OMPBuilder.emitOffloadingArrays(AllocaIP, Builder.saveIP(), MapInfo, Info,
4450+
/*IsNonContiguous=*/true);
4451+
4452+
OpenMPIRBuilder::TargetDataRTArgs RTArgs;
4453+
OMPBuilder.emitOffloadingArraysArgument(Builder, RTArgs, Info,
4454+
!MapInfo.Names.empty());
4455+
4456+
// emitKernelLaunch
4457+
auto &&EmitTargetCallFallbackCB =
4458+
[&](OpenMPIRBuilder::InsertPointTy IP) -> OpenMPIRBuilder::InsertPointTy {
4459+
Builder.restoreIP(IP);
4460+
Builder.CreateCall(OutlinedFn, Args);
4461+
return Builder.saveIP();
4462+
};
4463+
4464+
unsigned NumTargetItems = MapInfo.BasePointers.size();
4465+
// TODO: Use correct device ID
4466+
Value *DeviceID = Builder.getInt64(OMP_DEVICEID_UNDEF);
4467+
Value *NumTeamsVal = Builder.getInt32(NumTeams);
4468+
Value *NumThreadsVal = Builder.getInt32(NumThreads);
4469+
uint32_t SrcLocStrSize;
4470+
Constant *SrcLocStr = OMPBuilder.getOrCreateDefaultSrcLocStr(SrcLocStrSize);
4471+
Value *RTLoc = OMPBuilder.getOrCreateIdent(SrcLocStr, SrcLocStrSize,
4472+
llvm::omp::IdentFlag(0), 0);
4473+
// TODO: Use correct NumIterations
4474+
Value *NumIterations = Builder.getInt64(0);
4475+
// TODO: Use correct DynCGGroupMem
4476+
Value *DynCGGroupMem = Builder.getInt32(0);
4477+
4478+
bool HasNoWait = false;
4479+
4480+
OpenMPIRBuilder::TargetKernelArgs KArgs(NumTargetItems, RTArgs, NumIterations,
4481+
NumTeamsVal, NumThreadsVal,
4482+
DynCGGroupMem, HasNoWait);
4483+
4484+
Builder.restoreIP(OMPBuilder.emitKernelLaunch(
4485+
Builder, OutlinedFn, OutlinedFnID, EmitTargetCallFallbackCB, KArgs,
4486+
DeviceID, RTLoc, AllocaIP));
44424487
}
44434488

44444489
OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTarget(
4445-
const LocationDescription &Loc, OpenMPIRBuilder::InsertPointTy CodeGenIP,
4446-
TargetRegionEntryInfo &EntryInfo, int32_t NumTeams, int32_t NumThreads,
4447-
SmallVectorImpl<Value *> &Args, TargetBodyGenCallbackTy CBFunc) {
4490+
const LocationDescription &Loc, InsertPointTy AllocaIP,
4491+
InsertPointTy CodeGenIP, TargetRegionEntryInfo &EntryInfo, int32_t NumTeams,
4492+
int32_t NumThreads, SmallVectorImpl<Value *> &Args,
4493+
GenMapInfoCallbackTy GenMapInfoCB, TargetBodyGenCallbackTy CBFunc) {
44484494
if (!updateToLocation(Loc))
44494495
return InsertPointTy();
44504496

44514497
Builder.restoreIP(CodeGenIP);
44524498

44534499
Function *OutlinedFn;
4454-
emitTargetOutlinedFunction(*this, Builder, EntryInfo, OutlinedFn, NumTeams,
4455-
NumThreads, Args, CBFunc);
4500+
Constant *OutlinedFnID;
4501+
emitTargetOutlinedFunction(*this, Builder, EntryInfo, OutlinedFn,
4502+
OutlinedFnID, NumTeams, NumThreads, Args, CBFunc);
44564503
if (!Config.isTargetDevice())
4457-
emitTargetCall(Builder, OutlinedFn, Args);
4504+
emitTargetCall(*this, Builder, AllocaIP, OutlinedFn, OutlinedFnID, NumTeams,
4505+
NumThreads, Args, GenMapInfoCB);
4506+
44584507
return Builder.saveIP();
44594508
}
44604509

llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5103,6 +5103,27 @@ TEST_F(OpenMPIRBuilderTest, TargetDataRegion) {
51035103
EXPECT_FALSE(verifyModule(*M, &errs()));
51045104
}
51055105

5106+
namespace {
5107+
// Some basic handling of argument mapping for the moment
5108+
void CreateDefaultMapInfos(llvm::OpenMPIRBuilder &OmpBuilder,
5109+
llvm::SmallVectorImpl<llvm::Value *> &Args,
5110+
llvm::OpenMPIRBuilder::MapInfosTy &CombinedInfo) {
5111+
for (auto Arg : Args) {
5112+
CombinedInfo.BasePointers.emplace_back(Arg);
5113+
CombinedInfo.Pointers.emplace_back(Arg);
5114+
uint32_t SrcLocStrSize;
5115+
CombinedInfo.Names.emplace_back(OmpBuilder.getOrCreateSrcLocStr(
5116+
"Unknown loc - stub implementation", SrcLocStrSize));
5117+
CombinedInfo.Types.emplace_back(llvm::omp::OpenMPOffloadMappingFlags(
5118+
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO |
5119+
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM |
5120+
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TARGET_PARAM));
5121+
CombinedInfo.Sizes.emplace_back(OmpBuilder.Builder.getInt64(
5122+
OmpBuilder.M.getDataLayout().getTypeAllocSize(Arg->getType())));
5123+
}
5124+
}
5125+
} // namespace
5126+
51065127
TEST_F(OpenMPIRBuilderTest, TargetRegion) {
51075128
using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
51085129
OpenMPIRBuilder OMPBuilder(*M);
@@ -5134,28 +5155,52 @@ TEST_F(OpenMPIRBuilderTest, TargetRegion) {
51345155
Inputs.push_back(BPtr);
51355156
Inputs.push_back(CPtr);
51365157

5158+
llvm::OpenMPIRBuilder::MapInfosTy CombinedInfos;
5159+
auto GenMapInfoCB = [&](llvm::OpenMPIRBuilder::InsertPointTy codeGenIP)
5160+
-> llvm::OpenMPIRBuilder::MapInfosTy & {
5161+
CreateDefaultMapInfos(OMPBuilder, Inputs, CombinedInfos);
5162+
return CombinedInfos;
5163+
};
5164+
51375165
TargetRegionEntryInfo EntryInfo("func", 42, 4711, 17);
51385166
OpenMPIRBuilder::LocationDescription OmpLoc({Builder.saveIP(), DL});
5139-
Builder.restoreIP(OMPBuilder.createTarget(OmpLoc, Builder.saveIP(), EntryInfo,
5140-
-1, -1, Inputs, BodyGenCB));
5167+
Builder.restoreIP(OMPBuilder.createTarget(OmpLoc, Builder.saveIP(),
5168+
Builder.saveIP(), EntryInfo, -1, 0,
5169+
Inputs, GenMapInfoCB, BodyGenCB));
51415170
OMPBuilder.finalize();
51425171
Builder.CreateRetVoid();
51435172

5144-
// Check the outlined call
5173+
// Check the kernel launch sequence
51455174
auto Iter = F->getEntryBlock().rbegin();
5146-
CallInst *Call = dyn_cast<CallInst>(&*(++Iter));
5147-
EXPECT_NE(Call, nullptr);
5175+
EXPECT_TRUE(isa<BranchInst>(&*(Iter)));
5176+
BranchInst *Branch = dyn_cast<BranchInst>(&*(Iter));
5177+
EXPECT_TRUE(isa<CmpInst>(&*(++Iter)));
5178+
EXPECT_TRUE(isa<CallInst>(&*(++Iter)));
5179+
CallInst *Call = dyn_cast<CallInst>(&*(Iter));
5180+
5181+
// Check that the kernel launch function is called
5182+
Function *KernelLaunchFunc = Call->getCalledFunction();
5183+
EXPECT_NE(KernelLaunchFunc, nullptr);
5184+
StringRef FunctionName = KernelLaunchFunc->getName();
5185+
EXPECT_TRUE(FunctionName.startswith("__tgt_target_kernel"));
5186+
5187+
// Check the fallback call
5188+
BasicBlock *FallbackBlock = Branch->getSuccessor(0);
5189+
Iter = FallbackBlock->rbegin();
5190+
CallInst *FCall = dyn_cast<CallInst>(&*(++Iter));
5191+
EXPECT_NE(FCall, nullptr);
51485192

51495193
// Check that the correct aguments are passed in
5150-
for (auto ArgInput : zip(Call->args(), Inputs)) {
5194+
for (auto ArgInput : zip(FCall->args(), Inputs)) {
51515195
EXPECT_EQ(std::get<0>(ArgInput), std::get<1>(ArgInput));
51525196
}
51535197

51545198
// Check that the outlined function exists with the expected prefix
5155-
Function *OutlinedFunc = Call->getCalledFunction();
5199+
Function *OutlinedFunc = FCall->getCalledFunction();
51565200
EXPECT_NE(OutlinedFunc, nullptr);
5157-
StringRef FunctionName = OutlinedFunc->getName();
5158-
EXPECT_TRUE(FunctionName.startswith("__omp_offloading"));
5201+
StringRef FunctionName2 = OutlinedFunc->getName();
5202+
EXPECT_TRUE(FunctionName2.startswith("__omp_offloading"));
5203+
51595204
EXPECT_FALSE(verifyModule(*M, &errs()));
51605205
}
51615206

@@ -5174,6 +5219,13 @@ TEST_F(OpenMPIRBuilderTest, TargetRegionDevice) {
51745219
Constant::getNullValue(PointerType::get(Ctx, 0)),
51755220
Constant::getNullValue(PointerType::get(Ctx, 0))};
51765221

5222+
llvm::OpenMPIRBuilder::MapInfosTy CombinedInfos;
5223+
auto GenMapInfoCB = [&](llvm::OpenMPIRBuilder::InsertPointTy codeGenIP)
5224+
-> llvm::OpenMPIRBuilder::MapInfosTy & {
5225+
CreateDefaultMapInfos(OMPBuilder, CapturedArgs, CombinedInfos);
5226+
return CombinedInfos;
5227+
};
5228+
51775229
auto BodyGenCB = [&](OpenMPIRBuilder::InsertPointTy AllocaIP,
51785230
OpenMPIRBuilder::InsertPointTy CodeGenIP)
51795231
-> OpenMPIRBuilder::InsertPointTy {
@@ -5188,9 +5240,10 @@ TEST_F(OpenMPIRBuilderTest, TargetRegionDevice) {
51885240
TargetRegionEntryInfo EntryInfo("parent", /*DeviceID=*/1, /*FileID=*/2,
51895241
/*Line=*/3, /*Count=*/0);
51905242

5191-
Builder.restoreIP(
5192-
OMPBuilder.createTarget(Loc, EntryIP, EntryInfo, /*NumTeams=*/-1,
5193-
/*NumThreads=*/-1, CapturedArgs, BodyGenCB));
5243+
Builder.restoreIP(OMPBuilder.createTarget(
5244+
Loc, EntryIP, EntryIP, EntryInfo, /*NumTeams=*/-1,
5245+
/*NumThreads=*/0, CapturedArgs, GenMapInfoCB, BodyGenCB));
5246+
51945247
Builder.CreateRetVoid();
51955248
OMPBuilder.finalize();
51965249

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,8 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
13821382
const SmallVector<Value> &mapOperands,
13831383
const ArrayAttr &mapTypes,
13841384
const SmallVector<Value> &devPtrOperands = {},
1385-
const SmallVector<Value> &devAddrOperands = {}) {
1385+
const SmallVector<Value> &devAddrOperands = {},
1386+
bool IsTargetParams = false) {
13861387
llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder();
13871388

13881389
auto fail = [&combinedInfo]() -> void {
@@ -1417,8 +1418,14 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
14171418
llvm::OpenMPIRBuilder::DeviceInfoTy::None);
14181419
combinedInfo.Names.emplace_back(
14191420
LLVM::createMappingInformation(mapOp.getLoc(), *ompBuilder));
1420-
combinedInfo.Types.emplace_back(llvm::omp::OpenMPOffloadMappingFlags(
1421-
mapTypes[index].dyn_cast<IntegerAttr>().getInt()));
1421+
1422+
combinedInfo.Types.emplace_back(
1423+
llvm::omp::OpenMPOffloadMappingFlags(
1424+
mapTypes[index].dyn_cast<IntegerAttr>().getInt()) |
1425+
(IsTargetParams
1426+
? llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TARGET_PARAM
1427+
: llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_NONE));
1428+
14221429
combinedInfo.Sizes.emplace_back(
14231430
builder.getInt64(getSizeInBytes(DL, mapOp.getType())));
14241431
index++;
@@ -1740,11 +1747,27 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
17401747
return failure();
17411748

17421749
int32_t defaultValTeams = -1;
1743-
int32_t defaultValThreads = -1;
1750+
int32_t defaultValThreads = 0;
1751+
1752+
llvm::OpenMPIRBuilder::InsertPointTy allocaIP =
1753+
findAllocaInsertPoint(builder, moduleTranslation);
1754+
1755+
DataLayout DL = DataLayout(opInst.getParentOfType<ModuleOp>());
1756+
SmallVector<Value> mapOperands = targetOp.getMapOperands();
1757+
ArrayAttr mapTypes = targetOp.getMapTypes().value();
1758+
1759+
llvm::OpenMPIRBuilder::MapInfosTy combinedInfos;
1760+
auto genMapInfoCB = [&](llvm::OpenMPIRBuilder::InsertPointTy codeGenIP)
1761+
-> llvm::OpenMPIRBuilder::MapInfosTy & {
1762+
builder.restoreIP(codeGenIP);
1763+
genMapInfos(builder, moduleTranslation, DL, combinedInfos, mapOperands,
1764+
mapTypes, {}, {}, true);
1765+
return combinedInfos;
1766+
};
17441767

17451768
builder.restoreIP(moduleTranslation.getOpenMPBuilder()->createTarget(
1746-
ompLoc, builder.saveIP(), entryInfo, defaultValTeams, defaultValThreads,
1747-
inputs, bodyCB));
1769+
ompLoc, allocaIP, builder.saveIP(), entryInfo, defaultValTeams,
1770+
defaultValThreads, inputs, genMapInfoCB, bodyCB));
17481771

17491772
return bodyGenStatus;
17501773
}

mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module attributes {omp.is_target_device = true} {
1212
%7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
1313
llvm.store %1, %3 : !llvm.ptr<i32>
1414
llvm.store %0, %5 : !llvm.ptr<i32>
15-
omp.target {
15+
omp.target map((to -> %3 : !llvm.ptr<i32>), (to -> %5 : !llvm.ptr<i32>), (from -> %7 : !llvm.ptr<i32>)) {
1616
%8 = llvm.load %3 : !llvm.ptr<i32>
1717
%9 = llvm.load %5 : !llvm.ptr<i32>
1818
%10 = llvm.add %8, %9 : i32

mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module attributes {omp.is_target_device = false} {
1212
%7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
1313
llvm.store %1, %3 : !llvm.ptr<i32>
1414
llvm.store %0, %5 : !llvm.ptr<i32>
15-
omp.target {
15+
omp.target map((to -> %3 : !llvm.ptr<i32>), (to -> %5 : !llvm.ptr<i32>), (from -> %7 : !llvm.ptr<i32>)) {
1616
%8 = llvm.load %3 : !llvm.ptr<i32>
1717
%9 = llvm.load %5 : !llvm.ptr<i32>
1818
%10 = llvm.add %8, %9 : i32
@@ -23,7 +23,13 @@ module attributes {omp.is_target_device = false} {
2323
}
2424
}
2525

26-
// CHECK: call void @__omp_offloading_[[DEV:.*]]_[[FIL:.*]]_omp_target_region__l[[LINE:.*]](ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}})
26+
// CHECK: call i32 @__tgt_target_kernel(ptr @4, i64 -1, i32 -1, i32 0, ptr @.__omp_offloading_[[DEV:.*]]_[[FIL:.*]]_omp_target_region__l[[LINE:.*]].region_id, ptr %kernel_args)
27+
28+
// CHECK: br i1 %{{.*}}, label %omp_offload.failed, label %omp_offload.cont
29+
// CHECK: omp_offload.failed:
30+
// CHECK: call void @__omp_offloading_[[DEV]]_[[FIL]]_omp_target_region__l[[LINE]](ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}})
31+
// CHECK: omp_offload.cont:
32+
2733
// CHECK: define internal void @__omp_offloading_[[DEV]]_[[FIL]]_omp_target_region__l[[LINE]](ptr %[[ADDR_A:.*]], ptr %[[ADDR_B:.*]], ptr %[[ADDR_C:.*]])
2834
// CHECK: %[[VAL_A:.*]] = load i32, ptr %[[ADDR_A]], align 4
2935
// CHECK: %[[VAL_B:.*]] = load i32, ptr %[[ADDR_B]], align 4

mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module attributes {omp.is_target_device = false} {
1212
%7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
1313
llvm.store %1, %3 : !llvm.ptr<i32>
1414
llvm.store %0, %5 : !llvm.ptr<i32>
15-
omp.target {
15+
omp.target map((to -> %3 : !llvm.ptr<i32>), (to -> %5 : !llvm.ptr<i32>), (from -> %7 : !llvm.ptr<i32>)) {
1616
omp.parallel {
1717
%8 = llvm.load %3 : !llvm.ptr<i32>
1818
%9 = llvm.load %5 : !llvm.ptr<i32>

0 commit comments

Comments
 (0)