Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][XPTI] Improvements to allow framework/app software level layers to provide code locations for sycl generated XPTI events. #15190

Merged
merged 11 commits into from
Oct 7, 2024
Merged
3 changes: 3 additions & 0 deletions sycl/include/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ class __SYCL_EXPORT tls_code_loc_t {
/// @return The code location information saved in the TLS slot. If not TLS
/// entry has been set up, a default coe location is returned.
const detail::code_location &query();
/// @brief Returns true if the TLS slot was cleared when this object was
/// cunstructed.
gzadica1 marked this conversation as resolved.
Show resolved Hide resolved
bool isToplevel() const { return !MLocalScope; }

private:
// The flag that is used to determine if the object is in a local scope or in
Expand Down
64 changes: 32 additions & 32 deletions sycl/include/sycl/ext/oneapi/bindless_images.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ inline event queue::ext_oneapi_copy(
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
return submit(
[&](handler &CGH) { CGH.ext_oneapi_copy(Src, Dest, DestImgDesc); },
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1383,7 +1383,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcExtent, Dest, DestOffset,
DestImgDesc, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1396,7 +1396,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_copy(Src, Dest, DestImgDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1412,7 +1412,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcExtent, Dest, DestOffset,
DestImgDesc, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1425,7 +1425,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_copy(Src, Dest, DestImgDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1441,7 +1441,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcExtent, Dest, DestOffset,
DestImgDesc, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1451,7 +1451,7 @@ inline event queue::ext_oneapi_copy(
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
return submit(
[&](handler &CGH) { CGH.ext_oneapi_copy(Src, Dest, SrcImgDesc); },
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1466,7 +1466,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcImgDesc, Dest, DestOffset,
DestExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1479,7 +1479,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_copy(Src, Dest, SrcImgDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1496,7 +1496,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcImgDesc, Dest, DestOffset,
DestExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1509,7 +1509,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_copy(Src, Dest, SrcImgDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1526,7 +1526,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, SrcImgDesc, Dest, DestOffset,
DestExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1538,7 +1538,7 @@ inline event queue::ext_oneapi_copy(
[&](handler &CGH) {
CGH.ext_oneapi_copy(Src, Dest, DeviceImgDesc, DeviceRowPitch);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1553,7 +1553,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, Dest, DestOffset, DeviceImgDesc,
DeviceRowPitch, HostExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1567,7 +1567,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_copy(Src, Dest, DeviceImgDesc, DeviceRowPitch);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1581,7 +1581,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_copy(Src, Dest, ImageDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1595,7 +1595,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_copy(Src, Dest, ImageDesc);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1606,7 +1606,7 @@ inline event queue::ext_oneapi_copy(
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
return submit(
[&](handler &CGH) { CGH.ext_oneapi_copy(Src, Dest, ImageDesc); },
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1622,7 +1622,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, Dest, DestOffset, DeviceImgDesc,
DeviceRowPitch, HostExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1636,7 +1636,7 @@ inline event queue::ext_oneapi_copy(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_copy(Src, Dest, DeviceImgDesc, DeviceRowPitch);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_copy(
Expand All @@ -1652,7 +1652,7 @@ inline event queue::ext_oneapi_copy(
CGH.ext_oneapi_copy(Src, SrcOffset, Dest, DestOffset, DeviceImgDesc,
DeviceRowPitch, HostExtent, CopyExtent);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_wait_external_semaphore(
Expand All @@ -1664,7 +1664,7 @@ inline event queue::ext_oneapi_wait_external_semaphore(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_wait_external_semaphore(SemaphoreHandle);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_wait_external_semaphore(
Expand All @@ -1676,7 +1676,7 @@ inline event queue::ext_oneapi_wait_external_semaphore(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_wait_external_semaphore(SemaphoreHandle);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_wait_external_semaphore(
Expand All @@ -1687,7 +1687,7 @@ inline event queue::ext_oneapi_wait_external_semaphore(
[&](handler &CGH) {
CGH.ext_oneapi_wait_external_semaphore(SemaphoreHandle, WaitValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_wait_external_semaphore(
Expand All @@ -1699,7 +1699,7 @@ inline event queue::ext_oneapi_wait_external_semaphore(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_wait_external_semaphore(SemaphoreHandle, WaitValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_wait_external_semaphore(
Expand All @@ -1712,7 +1712,7 @@ inline event queue::ext_oneapi_wait_external_semaphore(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_wait_external_semaphore(SemaphoreHandle, WaitValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1723,7 +1723,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
[&](handler &CGH) {
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1735,7 +1735,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1747,7 +1747,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1758,7 +1758,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
[&](handler &CGH) {
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle, SignalValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1771,7 +1771,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
CGH.depends_on(DepEvent);
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle, SignalValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

inline event queue::ext_oneapi_signal_external_semaphore(
Expand All @@ -1784,7 +1784,7 @@ inline event queue::ext_oneapi_signal_external_semaphore(
CGH.depends_on(DepEvents);
CGH.ext_oneapi_signal_external_semaphore(SemaphoreHandle, SignalValue);
},
CodeLoc);
TlsCodeLocCapture.query());
}

} // namespace _V1
Expand Down
6 changes: 5 additions & 1 deletion sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,10 @@ class __SYCL_EXPORT handler {

/// Saves the location of user's code passed in \p CodeLoc for future usage in
/// finalize() method.
void saveCodeLoc(detail::code_location CodeLoc) { MCodeLoc = CodeLoc; }
void saveCodeLoc(detail::code_location CodeLoc, bool IsTopCodeLoc) {
MCodeLoc = CodeLoc;
MIsTopCodeLoc = IsTopCodeLoc;
}

/// Constructs CG object of specific type, passes it to Scheduler and
/// returns sycl::event object representing the command group.
Expand Down Expand Up @@ -3365,6 +3368,7 @@ class __SYCL_EXPORT handler {
std::unique_ptr<detail::HostKernelBase> MHostKernel;

detail::code_location MCodeLoc = {};
bool MIsTopCodeLoc = true;
sergey-semenov marked this conversation as resolved.
Show resolved Hide resolved
bool MIsFinalized = false;
event MLastEvent;

Expand Down
Loading