-
Notifications
You must be signed in to change notification settings - Fork 60
[PTI-LIB] Define Callback API and make it work for two domains #97
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,227 @@ | ||||||||||||
//============================================================== | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused about the file name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that was a suggestion from @jmellorcrummey - to name it in a way to pronounce that these callbacks are synchronous. may be I misunderstood There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the idea, but I think using the abbreviation |
||||||||||||
// Copyright (C) Intel Corporation | ||||||||||||
// | ||||||||||||
// SPDX-License-Identifier: MIT | ||||||||||||
// ============================================================= | ||||||||||||
|
||||||||||||
#ifndef PTI_SYNC_CALLBACK_H_ | ||||||||||||
#define PTI_SYNC_CALLBACK_H_ | ||||||||||||
|
||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
So we don't have implicit dependencies on other header files. |
||||||||||||
#include "pti/pti_metrics.h" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we include metrics in callbacks if metrics is going to be a user of the callbacks? |
||||||||||||
#include "pti/pti_view.h" | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* This file contains APIs that so far experimental in PTI | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* APIs and data structures in this file are work-in-progress and subject to change! | ||||||||||||
Comment on lines
+14
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* | ||||||||||||
* All in this file concerns Callback API | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* Callback API is useful for many things, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* including to the implementation of MetricsScope functionality that wants to subscribe for | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* kernel append to command list .. and may be to other events. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* | ||||||||||||
* So MetricsScope API is the first user of [for now internal] Callback API | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Because the callback API isn't internal now, right? Due to this PR? |
||||||||||||
* | ||||||||||||
*/ | ||||||||||||
|
||||||||||||
|
||||||||||||
/* clang-format off */ | ||||||||||||
#if defined(__cplusplus) | ||||||||||||
extern "C" { | ||||||||||||
#endif | ||||||||||||
|
||||||||||||
typedef uint32_t pti_callback_subscriber_handle; | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it too late to make this a opaque pointer? Could avoid mistakes with invalid domain handles. |
||||||||||||
|
||||||||||||
#define PTI_CALLBACK_SUBSCRIBER_HANDLE_INVALID 0 | ||||||||||||
|
||||||||||||
typedef enum _pti_callback_domain { | ||||||||||||
PTI_CB_DOMAIN_INVALID = 0, | ||||||||||||
PTI_CB_DOMAIN_DRIVER_CONTEXT_CREATED = 1, //!< Not implememted yet | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
And below. Implemented is spelled wrong in almost all these comments. |
||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
PTI_CB_DOMAIN_DRIVER_MODULE_LOADED = 2, //!< Not implememted yet | ||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
PTI_CB_DOMAIN_DRIVER_MODULE_UNLOADED = 3, //!< Not implememted yet | ||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
PTI_CB_DOMAIN_DRIVER_GPU_OPERATION_APPENDED = 4, //!< This also serves as PTI_CB_DOMAIN_DRIVER_GPU_OPERATION_DISPATCHED | ||||||||||||
//!< when appended to Immediate Command List, | ||||||||||||
//!< which means no separate callback PTI_CB_DOMAIN_DRIVER_GPU_OPERATION_DISPATCHED | ||||||||||||
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for my understanding: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right. there still be event on the completion. |
||||||||||||
PTI_CB_DOMAIN_DRIVER_GPU_OPERATION_DISPATCHED = 5, //!< Not implememted yet | ||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
PTI_CB_DOMAIN_DRIVER_GPU_OPERATION_COMPLETED = 6, | ||||||||||||
PTI_CB_DOMAIN_DRIVER_HOST_SYNCHRONIZATION = 7, //!< Not implememted yet | ||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
|
||||||||||||
PTI_CB_DOMAIN_DRIVER_API = 1023, //!< Not implemeted yet, | ||||||||||||
//!< attempt to enable it will return PTI_ERROR_NOT_IMPLEMENTED | ||||||||||||
//!< Callback created for all Driver APIs | ||||||||||||
Comment on lines
+53
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you intend to have something like a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
May be one day we might want to add Callbacks to "user"-side /runtime APIs, that many users directly us - e.g. think oneCCL. |
||||||||||||
// below domains to inform user about PTI internal events | ||||||||||||
PTI_CB_DOMAIN_INTERNAL_THREADS = 1024, //!< Not implemeted yet | ||||||||||||
PTI_CB_DOMAIN_INTERNAL_EVENT = 1025, //!< Not implemeted yet | ||||||||||||
|
||||||||||||
PTI_CB_DOMAIN_MAX = 0x7fffffff | ||||||||||||
} pti_callback_domain; | ||||||||||||
|
||||||||||||
typedef enum _pti_callback_phase { | ||||||||||||
PTI_CB_PHASE_INVALID = 0, | ||||||||||||
PTI_CB_PHASE_API_ENTER = 1, | ||||||||||||
PTI_CB_PHASE_API_EXIT = 2, | ||||||||||||
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could there be any case where something like |
||||||||||||
PTI_CB_PHASE_INTERNAL_THREAD_START = 3, | ||||||||||||
PTI_CB_PHASE_INTERNAL_THREAD_END = 4, | ||||||||||||
PTI_CB_PHASE_INTERNAL_EVENT = 5, | ||||||||||||
|
||||||||||||
PTI_CB_PHASE_MAX = 0x7fffffff | ||||||||||||
} pti_callback_phase; | ||||||||||||
|
||||||||||||
typedef enum _pti_backend_command_list_type { | ||||||||||||
PTI_BACKEND_COMMAND_LIST_TYPE_UNKNOWN = (1<<0), | ||||||||||||
PTI_BACKEND_COMMAND_LIST_TYPE_IMMEDIATE = (1<<1), | ||||||||||||
PTI_BACKEND_COMMAND_LIST_TYPE_MUTABLE = (1<<2), | ||||||||||||
|
||||||||||||
PTI_BACKEND_COMMAND_LIST_TYPE_MAX = 0x7fffffff | ||||||||||||
} pti_backend_command_list_type; | ||||||||||||
|
||||||||||||
typedef void* pti_backend_command_list_t; //!< Backend command list handle | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe organize in a difference place. Like, keep the enums together and the handles separately. |
||||||||||||
|
||||||||||||
/** | ||||||||||||
* A user can subscribe to notifications about non-standard situation from PTI | ||||||||||||
* when it collects or processes the data | ||||||||||||
*/ | ||||||||||||
typedef enum _pti_internal_event_type { | ||||||||||||
PTI_INTERNAL_EVENT_TYPE_INFO = 0, | ||||||||||||
PTI_INTERNAL_EVENT_TYPE_WARNING = 1, // one or few records data inconsistences, or other | ||||||||||||
// collection is safe to continue | ||||||||||||
PTI_INTERNAL_EVENT_TYPE_CRITICAL = 2, // critical error after which further collected data are invalid | ||||||||||||
|
||||||||||||
PTI_INTERNAL_EVENT_TYPE_MAX = 0x7fffffff | ||||||||||||
} pti_internal_event_type; | ||||||||||||
|
||||||||||||
typedef enum _pti_gpu_operation_kind { | ||||||||||||
PTI_GPU_OPERATION_KIND_INVALID = 0, | ||||||||||||
PTI_GPU_OPERATION_KIND_KERNEL = 1, | ||||||||||||
PTI_GPU_OPERATION_KIND_MEMORY = 2, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the memory operation kind contain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are only for GPU ops. I guess we need others for malloc/free There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At a first step, I'm totally fine with omitting an operation kind for allocations. That's exactly what we are considering at the moment during completely reworking one of our adapters as well. |
||||||||||||
PTI_GPU_OPERATION_KIND_OTHER = 3, | ||||||||||||
|
||||||||||||
PTI_OPERATION_KIND_MAX = 0x7fffffff | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
for consistency. |
||||||||||||
} pti_gpu_operation_kind; | ||||||||||||
|
||||||||||||
typedef struct _pti_gpu_op_details { | ||||||||||||
pti_gpu_operation_kind _operation_kind; //<! Kind of the operation: kernel, mem op | ||||||||||||
uint64_t _operation_id; //<! GPU kernel or memory operation instance ID, | ||||||||||||
//<! unique throughout the process | ||||||||||||
uint64_t _kernel_handle; //!< a handle uniquly identifying kernel object as | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
//!< contained in the module at the specific offset | ||||||||||||
//!< it will be zero in case of not defined or | ||||||||||||
//!< for a memory operations | ||||||||||||
Comment on lines
+110
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest introducing a variable for the undefined / invalid case, in case you ever want to change the value. This also has the benefit that tools can use this variable to write "cleaner" code. Maybe something like: #define PTI_INVALID_KERNEL_HANDLE (0x7fffffff) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see suggestion above but "a memory operations" should be just memory operations |
||||||||||||
const char* _name; //!< symbolic name of a kernel or memcpy operation | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would the name of the memcpy operation look like? |
||||||||||||
} pti_gpu_op_details; | ||||||||||||
|
||||||||||||
typedef struct _pti_callback_gpu_op_data { | ||||||||||||
pti_callback_domain _domain; // domain of the callback | ||||||||||||
pti_backend_command_list_type _cmd_list_properties; //!< Immediate command list, Command Queue execute,.. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent capitalization, above in the comments, Immediate command list is capitalized as Immediate Command Lists. However, here is lower case. Probably should make it lowercase everywhere or capitalize everywhere. (likely lowercase) |
||||||||||||
pti_backend_command_list_t _cmd_list_handle; //!< Device back-end command list handle | ||||||||||||
pti_backend_queue_t _queue_handle; //!< Device back-end queue handle | ||||||||||||
pti_device_handle_t _device_handle; //!< Device handle, | ||||||||||||
pti_callback_phase _phase; //!< Could be ONLY_NOTIFY or API Call ENTER/EXIT | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||
uint32_t _return_code; // will be valid only for L0 API EXIT, for others will be nullptr | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||
uint32_t _correlation_id; // ID that corresponds to the same call reported by View API records | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems to be a switch from |
||||||||||||
uint32_t _operation_count; // number of operations submitted to the GPU, | ||||||||||||
// non-zero only for DOMAIN_DRIVER_GPU_OPERATION_LAUNCH, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see DOMAIN_DRIVER_GPU_OPERATION_LAUNCH in the API? maybe?
Suggested change
|
||||||||||||
// or API related to GPU operation submission | ||||||||||||
pti_gpu_op_details* _operation_details; // not Null only for DOMAIN_DRIVER_GPU_OPERATION_LAUNCH, | ||||||||||||
// or API related to GPU operation submission. | ||||||||||||
} pti_callback_gpu_op_data; | ||||||||||||
|
||||||||||||
typedef struct _pti_internal_callback_data { | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is inconsistently named with Should it be |
||||||||||||
pti_callback_domain _domain; // domain of the callback | ||||||||||||
pti_callback_phase _phase; // THREAD START/END or INTERNAL EVENT | ||||||||||||
uint32_t _detail; // depending on the domain should be casted/interpreted | ||||||||||||
// as a purpose of an internal PTI thread or | ||||||||||||
// pti_internal_event_type | ||||||||||||
Comment on lines
+136
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Is there any way to get the internal PTI thread purpose? |
||||||||||||
const char* _message; // explains details | ||||||||||||
} pti_internal_callback_data; | ||||||||||||
|
||||||||||||
typedef void (*pti_callback_function)( | ||||||||||||
pti_callback_domain domain, | ||||||||||||
pti_api_group_id driver_api_group_id, // driver API group ID, keep it to distinguish between L0 and OpenCL | ||||||||||||
// although the current implementation is only for L0 | ||||||||||||
Comment on lines
+144
to
+145
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this always the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest just dropping the |
||||||||||||
uint32_t driver_api_id, | ||||||||||||
pti_backend_ctx_t backend_context, //!< Driver (L0) level context handle | ||||||||||||
void* cb_data, //!< depending on the domain it should be type-casted to the pointer | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since both pti_callback_base { pti_callback_base* cb_data then cast based on the value of cb_data->domain? struct _pti_callback_gpu_op_data { then I think you can remove domain from the callback too but not sure about that |
||||||||||||
//!< to either pti_callback_gpu_op_data, pti_internal_callback_data | ||||||||||||
//!< or to others to be defined | ||||||||||||
void* global_user_data, //!< Any global data defined by user returned | ||||||||||||
//!< to every callback from a same subscriber | ||||||||||||
void** instance_user_data); //!< Data that could be passed between ENTER and EXIT | ||||||||||||
//!< phases of one API call | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Callback API functions | ||||||||||||
* None of the PTI API functions should be called from a Callback function | ||||||||||||
* Exceptions are the helper functions that returns character representation of enums | ||||||||||||
*/ | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Initialize Callback subscriber | ||||||||||||
* | ||||||||||||
* @param subscriber - subscriber handle | ||||||||||||
* @param callback - pointer to the callback function | ||||||||||||
* @param user_data - user data to be passed to the callback function | ||||||||||||
* @return pti_result | ||||||||||||
*/ | ||||||||||||
pti_result PTI_EXPORT | ||||||||||||
ptiCallbackSubscribe(pti_callback_subscriber_handle* subscriber, | ||||||||||||
pti_callback_function callback, | ||||||||||||
void* user_data); | ||||||||||||
Comment on lines
+170
to
+173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just as a question out of curiosity. Do you plan to support more than one subscriber at a time? Having the option to attach multiple subscribers can have its benefit, with the main drawback obviously being the potential overhead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Current design/implementation supports multiple subscribers. Right - having multiple ones would bring additional overhead,. plus we also need explain how they should work together. |
||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Unsubscribe Callback subscriber, this unsubscribes from all domains, disables callback, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* clean all resources related to the subscriber handle and invalidate the handle | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
*/ | ||||||||||||
pti_result PTI_EXPORT | ||||||||||||
ptiCallbackUnsubscribe(pti_callback_subscriber_handle subscriber); | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Enables callbacks on specific domain | ||||||||||||
* | ||||||||||||
* @param subscriber - subscriber handle | ||||||||||||
* @param domain - domain to enable | ||||||||||||
* @param enter_cb - indicate if callback called on enter/start: 0-no, 1-yes; used only for domains with 2 sites | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no/yes should probably be an enum. The API is ambiguous this way. |
||||||||||||
* @param exit_cb - indicates if callback called on exit/end: 0-no, 1-yes; used only for domains with 2 sites | ||||||||||||
Comment on lines
+187
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One should probably document which domains support these two parameters. What would happen if one passes |
||||||||||||
* @return pti_result | ||||||||||||
*/ | ||||||||||||
pti_result PTI_EXPORT | ||||||||||||
ptiCallbackEnableDomain(pti_callback_subscriber_handle subscriber, | ||||||||||||
pti_callback_domain domain, | ||||||||||||
uint32_t enter_cb, | ||||||||||||
uint32_t exit_cb); | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Disables callbacks for specific domain | ||||||||||||
*/ | ||||||||||||
pti_result PTI_EXPORT | ||||||||||||
ptiCallbackDisableDomain(pti_callback_subscriber_handle subscriber, | ||||||||||||
pti_callback_domain domain); | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Disables the callback of the subscriber for all domains | ||||||||||||
*/ | ||||||||||||
pti_result PTI_EXPORT | ||||||||||||
ptiCallbackDisableAllDomains(pti_callback_subscriber_handle subscriber); | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Helper function to return stringified enum members for pti_callback_domain | ||||||||||||
* | ||||||||||||
* @return const char* | ||||||||||||
*/ | ||||||||||||
PTI_EXPORT const char* ptiCallbackDomainTypeToString(pti_callback_domain domain); | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* @brief Helper function to return stringified enum members for pti_callback_phase | ||||||||||||
* | ||||||||||||
* @return const char* | ||||||||||||
*/ | ||||||||||||
PTI_EXPORT const char* ptiCallbackPhaseTypeToString(pti_callback_phase phase); | ||||||||||||
|
||||||||||||
#if defined(__cplusplus) | ||||||||||||
} | ||||||||||||
#endif | ||||||||||||
#endif // PTI_SYNC_CALLBACK_H_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(PTI_Samples_CALLBACK CXX) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE "Release") | ||
endif() | ||
|
||
# TODO: find_package(IntelSYCL)? | ||
include(CheckCXXCompilerFlag) | ||
check_cxx_compiler_flag("-fsycl" has_sycl) | ||
|
||
if (NOT has_sycl) | ||
message(WARNING "${PROJECT_NAME} requires a sycl compatible compiler") | ||
return() | ||
endif() | ||
|
||
add_executable(callback main.cc) | ||
|
||
target_link_options(callback PUBLIC -fsycl -gline-tables-only) | ||
target_compile_options(callback PUBLIC -fsycl -gline-tables-only) | ||
|
||
target_include_directories(callback PRIVATE "${PROJECT_SOURCE_DIR}/../samples_utilities") | ||
|
||
target_link_libraries(callback PRIVATE LevelZero::level-zero) | ||
|
||
# Allow building in-source and out-of-source | ||
if (NOT TARGET Pti::pti_view) | ||
find_package(Pti REQUIRED) | ||
endif() | ||
|
||
target_link_libraries(callback PUBLIC Pti::pti_view) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a shorter name for the error is actually helpful here.
If developers are interested in having a string description of their error code, one could think about implementing a function like
const char* ptiGetErrorMessage(...)
, similar to CUPTI: https://docs.nvidia.com/cupti/api/group__CUPTI__RESULT__API.html