Skip to content

Commit 0a56569

Browse files
aarongreigkbenzie
authored andcommitted
Address review feedback
1 parent 56476fd commit 0a56569

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

include/ur_api.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -743,21 +743,14 @@ urLoaderConfigSetCodeLocationCallback(
743743
void *pUserData ///< [in][out][optional] pointer to data to be passed to callback.
744744
);
745745

746-
///////////////////////////////////////////////////////////////////////////////
747-
/// @brief Callback to replace or instrument generic mock functionality in the
748-
/// mock adapter.
749-
typedef ur_result_t (*ur_mock_callback_t)(
750-
void *pParams ///< [in][out] Pointer to the appropriate param struct for the function
751-
);
752-
753746
///////////////////////////////////////////////////////////////////////////////
754747
/// @brief The only adapter reported with mock enabled will be the mock adapter.
755748
///
756749
/// @details
757750
/// - The mock adapter will default to returning ::UR_RESULT_SUCCESS for all
758751
/// entry points. It will also create and correctly reference count dummy
759752
/// handles where appropriate. Its behaviour can be modified by linking
760-
/// the ::ur_mock_headers library and using the callbacks object.
753+
/// the ::ur_mock_headers library and using the mock::callbacks object.
761754
///
762755
/// @returns
763756
/// - ::UR_RESULT_SUCCESS

scripts/core/INTRO.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ given entry point can only have one of each kind of callback associated with
280280
it, multiple structs with the same function/mode combination will override
281281
eachother.
282282

283-
The callback signature defined by ``${x}_mock_callback_t`` takes a single
283+
The callback signature defined by ``ur_mock_callback_t`` takes a single
284284
``void *`` parameter. When calling a user callback the layer will pack the
285285
entry point's parameters into the appropriate ``_params_t`` struct (e.g.
286286
``ur_adapter_get_params_t``) and pass a pointer to that struct into the

scripts/core/loader.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#
12
# Copyright (C) 2022-2023 Intel Corporation
23
#
34
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -186,19 +187,10 @@ params:
186187
name: pUserData
187188
desc: "[in][out][optional] pointer to data to be passed to callback."
188189
--- #--------------------------------------------------------------------------
189-
type: fptr_typedef
190-
desc: "Callback to replace or instrument generic mock functionality in the mock adapter."
191-
name: $x_mock_callback_t
192-
return: $x_result_t
193-
params:
194-
- type: void*
195-
name: pParams
196-
desc: "[in][out] Pointer to the appropriate param struct for the function"
197-
--- #--------------------------------------------------------------------------
198190
type: function
199191
desc: "The only adapter reported with mock enabled will be the mock adapter."
200192
details:
201-
- "The mock adapter will default to returning $X_RESULT_SUCCESS for all entry points. It will also create and correctly reference count dummy handles where appropriate. Its behaviour can be modified by linking the $x_mock_headers library and using the callbacks object."
193+
- "The mock adapter will default to returning $X_RESULT_SUCCESS for all entry points. It will also create and correctly reference count dummy handles where appropriate. Its behaviour can be modified by linking the $x_mock_headers library and using the mock::callbacks object."
202194
class: $xLoaderConfig
203195
loader_only: True
204196
name: "SetMockingEnabled"

source/loader/ur_libapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ ur_result_t UR_APICALL urLoaderConfigSetCodeLocationCallback(
199199
/// - The mock adapter will default to returning ::UR_RESULT_SUCCESS for all
200200
/// entry points. It will also create and correctly reference count dummy
201201
/// handles where appropriate. Its behaviour can be modified by linking
202-
/// the ::ur_mock_headers library and using the callbacks object.
202+
/// the ::ur_mock_headers library and using the mock::callbacks object.
203203
///
204204
/// @returns
205205
/// - ::UR_RESULT_SUCCESS

source/mock/ur_mock_helpers.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include <unordered_map>
2121
#include <vector>
2222

23+
// This is the callback function we accept to override or instrument
24+
// entry-points. pParams is expected to be a pointer to the appropriate params_t
25+
// struct for the given entry point.
26+
typedef ur_result_t (*ur_mock_callback_t)(void *pParams);
27+
2328
namespace mock {
2429

2530
struct dummy_handle_t_ {

source/ur_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ ur_result_t UR_APICALL urLoaderConfigSetCodeLocationCallback(
188188
/// - The mock adapter will default to returning ::UR_RESULT_SUCCESS for all
189189
/// entry points. It will also create and correctly reference count dummy
190190
/// handles where appropriate. Its behaviour can be modified by linking
191-
/// the ::ur_mock_headers library and using the callbacks object.
191+
/// the ::ur_mock_headers library and using the mock::callbacks object.
192192
///
193193
/// @returns
194194
/// - ::UR_RESULT_SUCCESS

0 commit comments

Comments
 (0)