Skip to content

Commit fcf9dd9

Browse files
committed
Cleanup documentation and comments
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 9f113b3 commit fcf9dd9

3 files changed

Lines changed: 15 additions & 20 deletions

File tree

include/loader/ze_loader.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,19 @@ ZE_DLLEXPORT bool ZE_APICALL
9595
zelCheckIsLoaderInTearDown();
9696

9797
///////////////////////////////////////////////////////////////////////////////
98-
/// @brief Exported function for registering a callback to indicate teardown.
99-
/// @details The callback function will be invoked when the loader is in teardown.
100-
///
98+
/// @brief Exported function for registering a teardown callback.
99+
/// @details The provided application callback will be invoked when the loader enters teardown.
100+
/// The loader's callback and the index for this application's callback reference are returned for later reference.
101+
/// The loader's callback will be invoked when the application is torndown to inform the loader that the application
102+
/// is being torn down and cannot be called to inform the loader of its teardown.
101103
typedef void (*zel_loader_teardown_callback_t)();
102104
typedef void (*zel_application_teardown_callback_t)(uint32_t index);
103105

104106
ZE_DLLEXPORT ze_result_t ZE_APICALL
105107
zelRegisterTeardownCallback(
106-
zel_loader_teardown_callback_t application_callback, // [in] Pointer to the user's application callback function
107-
zel_application_teardown_callback_t *loader_callback, // [out] Pointer to the L0 Loader's callback function
108-
uint32_t *index // [out] Index of the callback function
108+
zel_loader_teardown_callback_t application_callback, // [in] Application's callback function to be called during loader teardown
109+
zel_application_teardown_callback_t *loader_callback, // [out] Pointer to the loader's callback function
110+
uint32_t *index // [out] Index assigned to the registered callback
109111
);
110112

111113
///////////////////////////////////////////////////////////////////////////////

source/lib/ze_lib.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ namespace ze_lib
2929
bool delayContextDestruction = false;
3030
bool loaderTeardownCallbackReceived = false;
3131
void staticLoaderTeardownCallback() {
32-
printf("ze_lib Static Teardown Callback\n");
3332
loaderTeardownCallbackReceived = true;
3433
}
3534
#endif
3635
void applicationTeardownCallback(uint32_t index) {
37-
printf("ze_lib Application Teardown Callback %d\n", index);
3836
if (ze_lib::context->teardownCallbacks.find(index) != ze_lib::context->teardownCallbacks.end()) {
3937
ze_lib::context->teardownCallbacks.erase(index);
4038
}
@@ -50,9 +48,6 @@ namespace ze_lib
5048
///////////////////////////////////////////////////////////////////////////////
5149
__zedlllocal context_t::~context_t()
5250
{
53-
if (debugTraceEnabled) {
54-
debug_trace_message("ze_lib Context Destructor", "");
55-
}
5651
#ifdef DYNAMIC_LOAD_LOADER
5752
if (!loaderTeardownCallbackReceived) {
5853
loaderTeardownCallback(loaderTeardownCallbackIndex);
@@ -372,8 +367,8 @@ namespace ze_lib
372367
}
373368
// Get the function pointer for zelRegisterTeardownCallback from the loader
374369
typedef ze_result_t (ZE_APICALL *zelRegisterTeardownCallback_t)(
375-
zel_loader_teardown_callback_t,
376-
zel_application_teardown_callback_t*,
370+
zel_loader_teardown_callback_t,
371+
zel_application_teardown_callback_t*,
377372
uint32_t*);
378373
auto pfnZelRegisterTeardownCallback = reinterpret_cast<zelRegisterTeardownCallback_t>(
379374
GET_FUNCTION_PTR(loader, "zelRegisterTeardownCallback"));
@@ -518,11 +513,11 @@ void stabilityCheck(std::promise<int> stabilityPromise) {
518513
}
519514
#endif
520515

521-
ZE_DLLEXPORT ze_result_t ZE_APICALL
516+
ze_result_t ZE_APICALL
522517
zelRegisterTeardownCallback(
523-
zel_loader_teardown_callback_t application_callback, // [in] Pointer to the user's application callback function
524-
zel_application_teardown_callback_t *loader_callback, // [out] Pointer to the L0 Loader's callback function
525-
uint32_t *index // [out] Index of the callback function
518+
zel_loader_teardown_callback_t application_callback, // [in] Application's callback function to be called during loader teardown
519+
zel_application_teardown_callback_t *loader_callback, // [out] Pointer to the loader's callback function
520+
uint32_t *index // [out] Index assigned to the registered callback
526521
) {
527522
ze_result_t result = ZE_RESULT_SUCCESS;
528523
if (nullptr == application_callback) {

source/lib/ze_lib.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717
#include "layers/zel_tracing_api.h"
1818
#include "layers/zel_tracing_ddi.h"
1919
#include "../utils/logging.h"
20+
#include "loader/ze_loader.h"
2021
#include "ze_util.h"
2122
#include <vector>
2223
#include <mutex>
2324
#include <atomic>
2425
#include <typeinfo>
2526
#include <iostream>
2627

27-
typedef void (*zel_loader_teardown_callback_t)();
28-
typedef void (*zel_application_teardown_callback_t)(uint32_t index);
29-
3028
namespace ze_lib
3129
{
3230
///////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)