[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.
This commit is contained in:
Ross Brunton
2025-07-02 14:11:05 +01:00
committed by GitHub
parent e63de82d90
commit 4f02965ae2
2 changed files with 3 additions and 3 deletions

View File

@@ -317,7 +317,7 @@ struct GenericKernelTy {
AsyncInfoWrapperTy &AsyncInfoWrapper) const = 0;
/// Get the kernel name.
const char *getName() const { return Name; }
const char *getName() const { return Name.c_str(); }
/// Get the kernel image.
DeviceImageTy &getImage() const {
@@ -413,7 +413,7 @@ private:
}
/// The kernel name.
const char *Name;
std::string Name;
/// The image that contains this kernel.
DeviceImageTy *ImagePtr = nullptr;

View File

@@ -456,7 +456,7 @@ Error GenericKernelTy::init(GenericDeviceTy &GenericDevice,
KernelEnvironment = KernelEnvironmentTy{};
DP("Failed to read kernel environment for '%s' Using default Bare (0) "
"execution mode\n",
Name);
getName());
}
// Max = Config.Max > 0 ? min(Config.Max, Device.Max) : Device.Max;