Skip to content

Commit d13a577

Browse files
authored
[SYCL][NFC] Use raw ptr to kernel_impl in the emitKernelInstrumentationData (#20258)
Minor refactoring to do use raw `const kernel_impl *` instead of `const std::shared_ptr<kernel_impl>&`.
1 parent 82ad61d commit d13a577

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

sycl/source/detail/graph/graph_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ ur_exp_command_buffer_sync_point_t exec_graph_impl::enqueueNodeDirect(
739739
CGExec->MFunctionName.c_str(),
740740
CGExec->MLine, CGExec->MColumn);
741741
std::tie(CmdTraceEvent, InstanceID) = emitKernelInstrumentationData(
742-
StreamID, CGExec->MSyclKernel, CodeLoc, CGExec->MIsTopCodeLoc,
742+
StreamID, CGExec->MSyclKernel.get(), CodeLoc, CGExec->MIsTopCodeLoc,
743743
CGExec->MDeviceKernelInfo, nullptr, CGExec->MNDRDesc,
744744
CGExec->MKernelBundle.get(), CGExec->MArgs);
745745
if (CmdTraceEvent)

sycl/source/detail/scheduler/commands.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,10 +1970,11 @@ ExecCGCommand::ExecCGCommand(
19701970
}
19711971

19721972
#ifdef XPTI_ENABLE_INSTRUMENTATION
1973-
std::string instrumentationGetKernelName(
1974-
const std::shared_ptr<detail::kernel_impl> &SyclKernel,
1975-
const std::string_view FunctionName, const std::string_view SyclKernelName,
1976-
void *&Address, std::optional<bool> &FromSource) {
1973+
std::string instrumentationGetKernelName(const kernel_impl *SyclKernel,
1974+
const std::string_view FunctionName,
1975+
const std::string_view SyclKernelName,
1976+
void *&Address,
1977+
std::optional<bool> &FromSource) {
19771978
std::string KernelName;
19781979
if (SyclKernel && SyclKernel->isCreatedFromSource()) {
19791980
FromSource = true;
@@ -1990,8 +1991,8 @@ std::string instrumentationGetKernelName(
19901991
void instrumentationAddExtraKernelMetadata(
19911992
xpti_td *&CmdTraceEvent, const NDRDescT &NDRDesc,
19921993
detail::kernel_bundle_impl *KernelBundleImplPtr,
1993-
DeviceKernelInfo &DeviceKernelInfo,
1994-
const std::shared_ptr<detail::kernel_impl> &SyclKernel, queue_impl *Queue,
1994+
DeviceKernelInfo &DeviceKernelInfo, const kernel_impl *SyclKernel,
1995+
queue_impl *Queue,
19951996
std::vector<ArgDesc> &CGArgs) // CGArgs are not const since they could be
19961997
// sorted in this function
19971998
{
@@ -2091,8 +2092,7 @@ void instrumentationFillCommonData(
20912092

20922093
#ifdef XPTI_ENABLE_INSTRUMENTATION
20932094
std::pair<xpti_td *, uint64_t> emitKernelInstrumentationData(
2094-
xpti::stream_id_t StreamID,
2095-
const std::shared_ptr<detail::kernel_impl> &SyclKernel,
2095+
xpti::stream_id_t StreamID, const kernel_impl *SyclKernel,
20962096
const detail::code_location &CodeLoc, bool IsTopCodeLoc,
20972097
DeviceKernelInfo &DeviceKernelInfo, queue_impl *Queue,
20982098
const NDRDescT &NDRDesc, detail::kernel_bundle_impl *KernelBundleImplPtr,
@@ -2163,7 +2163,7 @@ void ExecCGCommand::emitInstrumentationData() {
21632163
auto KernelCG =
21642164
reinterpret_cast<detail::CGExecKernel *>(MCommandGroup.get());
21652165
KernelName = instrumentationGetKernelName(
2166-
KernelCG->MSyclKernel, MCommandGroup->MFunctionName,
2166+
KernelCG->MSyclKernel.get(), MCommandGroup->MFunctionName,
21672167
KernelCG->getKernelName(), MAddress, FromSource);
21682168
} break;
21692169
default:
@@ -2192,8 +2192,8 @@ void ExecCGCommand::emitInstrumentationData() {
21922192
reinterpret_cast<detail::CGExecKernel *>(MCommandGroup.get());
21932193
instrumentationAddExtraKernelMetadata(
21942194
CmdTraceEvent, KernelCG->MNDRDesc, KernelCG->getKernelBundle().get(),
2195-
KernelCG->MDeviceKernelInfo, KernelCG->MSyclKernel, MQueue.get(),
2196-
KernelCG->MArgs);
2195+
KernelCG->MDeviceKernelInfo, KernelCG->MSyclKernel.get(),
2196+
MQueue.get(), KernelCG->MArgs);
21972197
}
21982198

21992199
xptiNotifySubscribers(

sycl/source/detail/scheduler/commands.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,7 @@ class ExecCGCommand : public Command {
688688
// Very close to ExecCGCommand::emitInstrumentationData content.
689689
#ifdef XPTI_ENABLE_INSTRUMENTATION
690690
std::pair<xpti_td *, uint64_t> emitKernelInstrumentationData(
691-
xpti::stream_id_t StreamID,
692-
const std::shared_ptr<detail::kernel_impl> &SyclKernel,
691+
xpti::stream_id_t StreamID, const kernel_impl *SyclKernel,
693692
const detail::code_location &CodeLoc, bool IsTopCodeLoc,
694693
DeviceKernelInfo &DeviceKernelInfo, queue_impl *Queue,
695694
const NDRDescT &NDRDesc, detail::kernel_bundle_impl *KernelBundleImplPtr,

sycl/source/handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ event handler::finalize() {
670670
const bool xptiEnabled = xptiCheckTraceEnabled(StreamID);
671671
if (xptiEnabled) {
672672
std::tie(CmdTraceEvent, InstanceID) = emitKernelInstrumentationData(
673-
StreamID, MKernel, MCodeLoc, impl->MIsTopCodeLoc,
673+
StreamID, MKernel.get(), MCodeLoc, impl->MIsTopCodeLoc,
674674
*impl->MKernelData.getDeviceKernelInfoPtr(),
675675
impl->get_queue_or_null(), impl->MKernelData.getNDRDesc(),
676676
KernelBundleImpPtr, impl->MKernelData.getArgs());

0 commit comments

Comments
 (0)