@@ -136,13 +136,15 @@ struct DemangleHandle {
136
136
137
137
~DemangleHandle () { std::free (p); }
138
138
};
139
- static std::string demangleKernelName (std::string Name) {
139
+ static std::string demangleKernelName (const std::string_view Name) {
140
140
int Status = -1 ; // some arbitrary value to eliminate the compiler warning
141
- DemangleHandle result (abi::__cxa_demangle (Name.c_str (), NULL , NULL , &Status));
142
- return (Status == 0 ) ? result.p : Name;
141
+ DemangleHandle result (abi::__cxa_demangle (Name.data (), NULL , NULL , &Status));
142
+ return (Status == 0 ) ? result.p : std::string ( Name) ;
143
143
}
144
144
#else
145
- static std::string demangleKernelName (std::string Name) { return Name; }
145
+ static std::string demangleKernelName (const std::string_view Name) {
146
+ return std::string (Name);
147
+ }
146
148
#endif
147
149
148
150
static std::string accessModeToString (access::mode Mode) {
@@ -1961,7 +1963,7 @@ ExecCGCommand::ExecCGCommand(
1961
1963
#ifdef XPTI_ENABLE_INSTRUMENTATION
1962
1964
std::string instrumentationGetKernelName (
1963
1965
const std::shared_ptr<detail::kernel_impl> &SyclKernel,
1964
- const std::string & FunctionName, const std::string & SyclKernelName,
1966
+ const std::string_view FunctionName, const std::string_view SyclKernelName,
1965
1967
void *&Address, std::optional<bool > &FromSource) {
1966
1968
std::string KernelName;
1967
1969
if (SyclKernel && SyclKernel->isCreatedFromSource ()) {
@@ -2049,17 +2051,17 @@ void instrumentationFillCommonData(const std::string &KernelName,
2049
2051
xpti::payload_t Payload;
2050
2052
if (!FileName.empty ()) {
2051
2053
// File name has a valid string
2052
- Payload = xpti::payload_t (FuncName. empty () ? KernelName. c_str ()
2053
- : FuncName.c_str (),
2054
- FileName.c_str (), Line, Column, Address);
2054
+ Payload =
2055
+ xpti::payload_t (FuncName. empty () ? KernelName. data () : FuncName.data (),
2056
+ FileName.data (), Line, Column, Address);
2055
2057
HasSourceInfo = true ;
2056
2058
} else if (Address) {
2057
2059
// We have a valid function name and an address
2058
- Payload = xpti::payload_t (KernelName.c_str (), Address);
2060
+ Payload = xpti::payload_t (KernelName.data (), Address);
2059
2061
} else {
2060
2062
// In any case, we will have a valid function name and we'll use that to
2061
2063
// create the hash
2062
- Payload = xpti::payload_t (KernelName.c_str ());
2064
+ Payload = xpti::payload_t (KernelName.data ());
2063
2065
}
2064
2066
2065
2067
uint64_t CGKernelInstanceNo;
@@ -2096,7 +2098,7 @@ void instrumentationFillCommonData(const std::string &KernelName,
2096
2098
std::pair<xpti_td *, uint64_t > emitKernelInstrumentationData (
2097
2099
int32_t StreamID, const std::shared_ptr<detail::kernel_impl> &SyclKernel,
2098
2100
const detail::code_location &CodeLoc, bool IsTopCodeLoc,
2099
- const std::string & SyclKernelName, const QueueImplPtr &Queue,
2101
+ const std::string_view SyclKernelName, const QueueImplPtr &Queue,
2100
2102
const NDRDescT &NDRDesc,
2101
2103
const std::shared_ptr<detail::kernel_bundle_impl> &KernelBundleImplPtr,
2102
2104
std::vector<ArgDesc> &CGArgs) {
@@ -2109,8 +2111,7 @@ std::pair<xpti_td *, uint64_t> emitKernelInstrumentationData(
2109
2111
void *Address = nullptr ;
2110
2112
std::optional<bool > FromSource;
2111
2113
std::string KernelName = instrumentationGetKernelName (
2112
- SyclKernel, std::string (CodeLoc.functionName ()), SyclKernelName, Address,
2113
- FromSource);
2114
+ SyclKernel, CodeLoc.functionName (), SyclKernelName, Address, FromSource);
2114
2115
2115
2116
auto &[CmdTraceEvent, InstanceID] = XptiObjects;
2116
2117
@@ -2135,9 +2136,9 @@ std::pair<xpti_td *, uint64_t> emitKernelInstrumentationData(
2135
2136
if (Queue.get ())
2136
2137
xpti::framework::stash_tuple (XPTI_QUEUE_INSTANCE_ID_KEY,
2137
2138
getQueueID (Queue));
2138
- instrumentationAddExtraKernelMetadata (CmdTraceEvent, NDRDesc,
2139
- KernelBundleImplPtr, SyclKernelName ,
2140
- SyclKernel, Queue, CGArgs);
2139
+ instrumentationAddExtraKernelMetadata (
2140
+ CmdTraceEvent, NDRDesc, KernelBundleImplPtr ,
2141
+ std::string (SyclKernelName), SyclKernel, Queue, CGArgs);
2141
2142
2142
2143
xptiNotifySubscribers (
2143
2144
StreamID, NotificationTraceType, detail::GSYCLGraphEvent, CmdTraceEvent,
0 commit comments