@@ -214,37 +214,6 @@ void AiuptiActivityProfilerSession::handleRuntimeActivity(
214214 runtime_activity->log (*logger);
215215}
216216
217- // Finds the first number in the string after an underscore or hyphen
218- // and replaces it with "[N]". The replaced number is returned so that
219- // it can be preservered in the fn_idx metadata field
220- inline std::string extractInvocationNumber (std::string& str) {
221- size_t start = 0 ;
222- while (start < str.size () - 1 ) {
223- size_t sep_idx = str.find_first_of (" _-" , start);
224- // If no underscore or hyphen is found, return empty string
225- if (sep_idx == std::string::npos || sep_idx + 1 >= str.size ())
226- return " " ;
227- size_t end = str.find_first_not_of (" 0123456789" , sep_idx + 1 );
228- // If all remaining characters are digits, replace them with "[N]"
229- if (end == std::string::npos) {
230- std::string num = str.substr (sep_idx + 1 );
231- str.replace (sep_idx + 1 , std::string::npos, " [N]" );
232- return num;
233- }
234- // If the next character is not a digit, search for the next underscore or
235- // hyphen
236- if (end - sep_idx == 1 ) {
237- start = sep_idx + 1 ;
238- continue ;
239- }
240- // Replace the found number following the underscore or hyphen with "[N]"
241- std::string num = str.substr (sep_idx + 1 , end - sep_idx - 1 );
242- str.replace (sep_idx + 1 , end - sep_idx, " [N]" );
243- return num;
244- }
245- return " " ;
246- }
247-
248217void AiuptiActivityProfilerSession::handleKernelActivity (
249218 const AIUpti_ActivityCompute* activity,
250219 ActivityLogger* logger) {
@@ -253,10 +222,8 @@ void AiuptiActivityProfilerSession::handleKernelActivity(
253222 cpuCorrelationMap_[activity->correlation_id ] = 0 ; // fake add correlation
254223 const ITraceActivity* linked =
255224 linkedActivity (activity->correlation_id , cpuCorrelationMap_);
256- std::string name = activity->name ;
257- std::string num = extractInvocationNumber (name);
258225 traceBuffer_.emplace_activity (
259- traceBuffer_.span , ActivityType::CONCURRENT_KERNEL, name);
226+ traceBuffer_.span , ActivityType::CONCURRENT_KERNEL, activity-> name );
260227 auto & kernel_activity = traceBuffer_.activities .back ();
261228 kernel_activity->startTime = activity->start ;
262229 kernel_activity->endTime = activity->end ;
@@ -275,8 +242,6 @@ void AiuptiActivityProfilerSession::handleKernelActivity(
275242 kernel_activity->addMetadataQuoted (
276243 " context" , std::to_string (activity->context_id ));
277244 kernel_activity->addMetadata (" correlation" , activity->correlation_id );
278- if (num != " " )
279- kernel_activity->addMetadata (" fn_idx" , num);
280245
281246 recordStream (kernel_activity->device , kernel_activity->resource );
282247
0 commit comments