Skip to content

Commit 4f02965

Browse files
authored
[Offload] Store kernel name in GenericKernelTy (#142799)
GenericKernelTy has a pointer to the name that was used to create it. However, the name passed in as an argument may not outlive the kernel. Instead, GenericKernelTy now contains a std::string, and copies the name into there.
1 parent e63de82 commit 4f02965

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

offload/plugins-nextgen/common/include/PluginInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ struct GenericKernelTy {
317317
AsyncInfoWrapperTy &AsyncInfoWrapper) const = 0;
318318

319319
/// Get the kernel name.
320-
const char *getName() const { return Name; }
320+
const char *getName() const { return Name.c_str(); }
321321

322322
/// Get the kernel image.
323323
DeviceImageTy &getImage() const {
@@ -413,7 +413,7 @@ struct GenericKernelTy {
413413
}
414414

415415
/// The kernel name.
416-
const char *Name;
416+
std::string Name;
417417

418418
/// The image that contains this kernel.
419419
DeviceImageTy *ImagePtr = nullptr;

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ Error GenericKernelTy::init(GenericDeviceTy &GenericDevice,
456456
KernelEnvironment = KernelEnvironmentTy{};
457457
DP("Failed to read kernel environment for '%s' Using default Bare (0) "
458458
"execution mode\n",
459-
Name);
459+
getName());
460460
}
461461

462462
// Max = Config.Max > 0 ? min(Config.Max, Device.Max) : Device.Max;

0 commit comments

Comments
 (0)