Skip to content

Commit 8c53527

Browse files
[SYCL][XPTI] Add XPTI notifications for SYCL 2020 images (#9770)
This commit adds XPTI notifications for SYCL 2020 image classes (`sampled_image` and `unsampled_image`) as well as for the associated accessor classes (`sampled_image_accessor`, `host_sampled_image_accessor`, `unsampled_image_accessor` and `host_unsampled_image_accessor`). --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 5c8bdca commit 8c53527

32 files changed

+1088
-235
lines changed

sycl/doc/design/SYCLInstrumentationUsingXPTI.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,22 @@ All trace point types in bold provide semantic information about the graph, node
287287

288288
| Trace Point Type | Parameter Description | Metadata |
289289
| :------------------------: | :-------------------- | :------- |
290-
| `offload_alloc_construct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_buffer_data_t` that marks offload buffer creation point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `xpti::trace_event_data_t` - contains information about source location.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_buffer_data_t` object, that includes buffer object ID, host pointer used to create/initialize buffer, buffer element information (type name, size), number of buffer dimensions and buffer size for each dimension. </li></div> | None |
291-
| `offload_alloc_associate` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_buffer_association_data_t` that provides association between user level buffer object and platform specific memory object</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_buffer_association_data_t` object, that includes user object ID and platform-specific representation for offload buffer. </li></div> | None |
292-
| `offload_alloc_destruct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_buffer_data_t` that marks offload buffer destruction point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_buffer_data_t` object, that includes buffer object ID. </li></div> | None |
293-
| `offload_alloc_release` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_buffer_release_data_t` that provides information about release of platform specific memory object</li> <li> **parent**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_buffer_association_data_t` object, that includes user object ID and platform-specific representation for offload buffer. </li></div> | None |
290+
| `offload_alloc_memory_object_construct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_memory_object_data_t` that marks offload buffer creation point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `xpti::trace_event_data_t` - contains information about source location.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_memory_object_data_t` object, that includes buffer object ID, host pointer used to create/initialize buffer, buffer element information (type name, size), number of buffer dimensions and buffer size for each dimension. </li></div> | None |
291+
| `offload_alloc_memory_object_associate` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_association_data_t` that provides association between user level buffer object and platform specific memory object</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_association_data_t` object, that includes user object ID and platform-specific representation for offload buffer. </li></div> | None |
292+
| `offload_alloc_memory_object_destruct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_memory_object_data_t` that marks offload buffer destruction point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_memory_object_data_t` object, that includes buffer object ID. </li></div> | None |
293+
| `offload_alloc_memory_object_release` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_memory_object_release_data_t` that provides information about release of platform specific memory object</li> <li> **parent**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_association_data_t` object, that includes user object ID and platform-specific representation for offload buffer. </li></div> | None |
294294
| `offload_alloc_accessor` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_accessor_data_t` that marks offload accessor creation point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.buffer` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_accessor_data_t` object, that includes buffer object ID, accessor handle created from specific buffer, accessor information (access target and mode). </li></div> | None |
295295

296+
## Image management stream `"sycl.experimental.image"` Notification Signatures
297+
298+
| Trace Point Type | Parameter Description | Metadata |
299+
| :------------------------: | :-------------------- | :------- |
300+
| `offload_alloc_memory_object_construct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_image_data_t` that marks offload image creation point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.image` layer.</li> <li> **event**: `xpti::trace_event_data_t` - contains information about source location.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_image_data_t` object, that includes image object ID, host pointer used to create/initialize image, number of image dimensions, the image format and sampler information (addressing mode, coordinate normalization mode, filtering mode). </li></div> | None |
301+
| `offload_alloc_memory_object_associate` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_association_data_t` that provides association between user level image object and platform specific memory object</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.image` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_association_data_t` object, that includes user object ID and platform-specific representation for offload image. </li></div> | None |
302+
| `offload_alloc_memory_object_destruct` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_image_data_t` that marks offload image destruction point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.image` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_image_data_t` object, that includes image object ID. </li></div> | None |
303+
| `offload_alloc_memory_object_release` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_association_data_t` that provides information about release of platform specific memory object</li> <li> **parent**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed.</li> <li> **user_data**: A pointer to `offload_association_data_t` object, that includes user object ID and platform-specific representation for offload image. </li></div> | None |
304+
| `offload_alloc_accessor` | <div style="text-align: left"><li>**trace_type**: `xpti::trace_point_type_t::offload_image_accessor_data_t` that marks offload image accessor creation point</li> <li> **parent**: Event ID created for all functions in the `oneapi.experimental.image` layer.</li> <li> **event**: `nullptr` - since the stream of data just captures functions being called.</li> <li> **instance**: `nullptr` since no begin-end event alignment is needed. </li> <li> **user_data**: A pointer to `offload_image_accessor_data_t` object, that includes image object ID, accessor handle created from specific image, access target (if the accessor is not a host accessor), access mode (if the accessor is to an unsampled image) and element information (type name, size). </li></div> | None |
305+
296306
## SYCL Memory Allocations Stream `"sycl.experimental.mem_alloc"` Notification Signatures
297307

298308
| Trace Point Type | Parameter Description | Metadata |

sycl/include/sycl/accessor.hpp

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <sycl/sampler.hpp>
3535

3636
#include <iterator>
37+
#include <optional>
3738
#include <type_traits>
3839

3940
#include <utility>
@@ -246,6 +247,15 @@ void __SYCL_EXPORT constructorNotification(void *BufferObj, void *AccessorObj,
246247
access::mode Mode,
247248
const code_location &CodeLoc);
248249

250+
void __SYCL_EXPORT unsampledImageConstructorNotification(
251+
void *ImageObj, void *AccessorObj, std::optional<image_target> Target,
252+
access::mode Mode, const void *Type, uint32_t ElemSize,
253+
const code_location &CodeLoc);
254+
255+
void __SYCL_EXPORT sampledImageConstructorNotification(
256+
void *ImageObj, void *AccessorObj, std::optional<image_target> Target,
257+
const void *Type, uint32_t ElemSize, const code_location &CodeLoc);
258+
249259
template <typename T>
250260
using IsPropertyListT = typename std::is_base_of<PropertyListBase, T>;
251261

@@ -3595,9 +3605,10 @@ class __SYCL_EBO unsampled_image_accessor :
35953605
using const_reference = const DataT &;
35963606

35973607
template <typename AllocatorT>
3598-
unsampled_image_accessor(unsampled_image<Dimensions, AllocatorT> &ImageRef,
3599-
handler &CommandGroupHandlerRef,
3600-
const property_list &PropList = {})
3608+
unsampled_image_accessor(
3609+
unsampled_image<Dimensions, AllocatorT> &ImageRef,
3610+
handler &CommandGroupHandlerRef, const property_list &PropList = {},
3611+
const detail::code_location CodeLoc = detail::code_location::current())
36013612
#ifdef __SYCL_DEVICE_ONLY__
36023613
{}
36033614
#else
@@ -3616,6 +3627,9 @@ class __SYCL_EBO unsampled_image_accessor :
36163627
"Device associated with command group handler does not have "
36173628
"aspect::image.");
36183629

3630+
detail::unsampledImageConstructorNotification(
3631+
detail::getSyclObjImpl(ImageRef).get(), this->impl.get(), AccessTarget,
3632+
AccessMode, (const void *)typeid(DataT).name(), sizeof(DataT), CodeLoc);
36193633
detail::associateWithHandler(CommandGroupHandlerRef, this, AccessTarget);
36203634
GDBMethodsAnchor();
36213635
}
@@ -3734,14 +3748,19 @@ class __SYCL_EBO host_unsampled_image_accessor
37343748
template <typename AllocatorT>
37353749
host_unsampled_image_accessor(
37363750
unsampled_image<Dimensions, AllocatorT> &ImageRef,
3737-
const property_list &PropList = {})
3751+
const property_list &PropList = {},
3752+
const detail::code_location CodeLoc = detail::code_location::current())
37383753
: base_class(detail::convertToArrayOfN<3, 1>(ImageRef.get_range()),
37393754
AccessMode, detail::getSyclObjImpl(ImageRef).get(),
37403755
Dimensions, ImageRef.getElementSize(),
37413756
{ImageRef.getRowPitch(), ImageRef.getSlicePitch(), 0},
37423757
ImageRef.getChannelType(), ImageRef.getChannelOrder(),
37433758
PropList) {
37443759
addHostUnsampledImageAccessorAndWait(base_class::impl.get());
3760+
3761+
detail::unsampledImageConstructorNotification(
3762+
detail::getSyclObjImpl(ImageRef).get(), this->impl.get(), std::nullopt,
3763+
AccessMode, (const void *)typeid(DataT).name(), sizeof(DataT), CodeLoc);
37453764
}
37463765

37473766
/* -- common interface members -- */
@@ -3852,9 +3871,10 @@ class __SYCL_EBO sampled_image_accessor :
38523871
using const_reference = const DataT &;
38533872

38543873
template <typename AllocatorT>
3855-
sampled_image_accessor(sampled_image<Dimensions, AllocatorT> &ImageRef,
3856-
handler &CommandGroupHandlerRef,
3857-
const property_list &PropList = {})
3874+
sampled_image_accessor(
3875+
sampled_image<Dimensions, AllocatorT> &ImageRef,
3876+
handler &CommandGroupHandlerRef, const property_list &PropList = {},
3877+
const detail::code_location CodeLoc = detail::code_location::current())
38583878
#ifdef __SYCL_DEVICE_ONLY__
38593879
{}
38603880
#else
@@ -3873,6 +3893,9 @@ class __SYCL_EBO sampled_image_accessor :
38733893
"Device associated with command group handler does not have "
38743894
"aspect::image.");
38753895

3896+
detail::sampledImageConstructorNotification(
3897+
detail::getSyclObjImpl(ImageRef).get(), this->impl.get(), AccessTarget,
3898+
(const void *)typeid(DataT).name(), sizeof(DataT), CodeLoc);
38763899
detail::associateWithHandler(CommandGroupHandlerRef, this, AccessTarget);
38773900
GDBMethodsAnchor();
38783901
}
@@ -3965,15 +3988,21 @@ class __SYCL_EBO host_sampled_image_accessor
39653988
using const_reference = const DataT &;
39663989

39673990
template <typename AllocatorT>
3968-
host_sampled_image_accessor(sampled_image<Dimensions, AllocatorT> &ImageRef,
3969-
const property_list &PropList = {})
3991+
host_sampled_image_accessor(
3992+
sampled_image<Dimensions, AllocatorT> &ImageRef,
3993+
const property_list &PropList = {},
3994+
const detail::code_location CodeLoc = detail::code_location::current())
39703995
: base_class(detail::convertToArrayOfN<3, 1>(ImageRef.get_range()),
39713996
detail::getSyclObjImpl(ImageRef).get(), Dimensions,
39723997
ImageRef.getElementSize(),
39733998
{ImageRef.getRowPitch(), ImageRef.getSlicePitch(), 0},
39743999
ImageRef.getChannelType(), ImageRef.getChannelOrder(),
39754000
ImageRef.getSampler(), PropList) {
39764001
addHostSampledImageAccessorAndWait(base_class::impl.get());
4002+
4003+
detail::sampledImageConstructorNotification(
4004+
detail::getSyclObjImpl(ImageRef).get(), this->impl.get(), std::nullopt,
4005+
(const void *)typeid(DataT).name(), sizeof(DataT), CodeLoc);
39774006
}
39784007

39794008
/* -- common interface members -- */

0 commit comments

Comments
 (0)