21
21
namespace ur ::level_zero {
22
22
23
23
ur_result_t urContextCreate (
24
- uint32_t DeviceCount, // /< [in] the number of devices given in phDevices
25
- const ur_device_handle_t
26
- *Devices, // /< [in][range(0, DeviceCount)] array of handle of devices.
27
- const ur_context_properties_t
28
- *Properties, // /< [in][optional] pointer to context creation properties.
29
- ur_context_handle_t
30
- *RetContext // /< [out] pointer to handle of context object created
31
- ) {
24
+ // / [in] the number of devices given in phDevices
25
+ uint32_t DeviceCount,
26
+ // / [in][range(0, DeviceCount)] array of handle of devices.
27
+ const ur_device_handle_t *Devices,
28
+ // / [in][optional] pointer to context creation properties.
29
+ const ur_context_properties_t *Properties,
30
+ // / [out] pointer to handle of context object created
31
+ ur_context_handle_t *RetContext ) {
32
32
std::ignore = Properties;
33
33
34
34
ur_platform_handle_t Platform = Devices[0 ]->Platform ;
@@ -58,16 +58,16 @@ ur_result_t urContextCreate(
58
58
}
59
59
60
60
ur_result_t urContextRetain (
61
- ur_context_handle_t
62
- Context // /< [in] handle of the context to get a reference of.
63
- ) {
61
+
62
+ // / [in] handle of the context to get a reference of.
63
+ ur_context_handle_t Context ) {
64
64
Context->RefCount .increment ();
65
65
return UR_RESULT_SUCCESS;
66
66
}
67
67
68
68
ur_result_t urContextRelease (
69
- ur_context_handle_t Context // /< [in] handle of the context to release.
70
- ) {
69
+ // / [in] handle of the context to release.
70
+ ur_context_handle_t Context ) {
71
71
ur_platform_handle_t Plt = Context->getPlatform ();
72
72
std::unique_lock<ur_shared_mutex> ContextsLock (Plt->ContextsMutex ,
73
73
std::defer_lock);
@@ -90,18 +90,20 @@ static const bool UseMemcpy2DOperations = [] {
90
90
}();
91
91
92
92
ur_result_t urContextGetInfo (
93
- ur_context_handle_t Context, // /< [in] handle of the context
94
- ur_context_info_t ContextInfoType, // /< [in] type of the info to retrieve
95
- size_t PropSize, // /< [in] the number of bytes of memory pointed to by
96
- // /< pContextInfo.
97
- void *ContextInfo, // /< [out][optional] array of bytes holding the info.
98
- // /< if propSize is not equal to or greater than the
99
- // /< real number of bytes needed to return the info then
100
- // /< the ::UR_RESULT_ERROR_INVALID_SIZE error is
101
- // /< returned and pContextInfo is not used.
102
- size_t *PropSizeRet // /< [out][optional] pointer to the actual size in
103
- // /< bytes of data queried by ContextInfoType.
104
- ) {
93
+ // / [in] handle of the context
94
+ ur_context_handle_t Context,
95
+ // / [in] type of the info to retrieve
96
+ ur_context_info_t ContextInfoType,
97
+ // / [in] the number of bytes of memory pointed to by pContextInfo.
98
+ size_t PropSize,
99
+ // / [out][optional] array of bytes holding the info. if propSize is not
100
+ // / equal to or greater than the real number of bytes needed to return the
101
+ // / info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and
102
+ // / pContextInfo is not used.
103
+ void *ContextInfo,
104
+ // / [out][optional] pointer to the actual size in bytes of data queried by
105
+ // / ContextInfoType.
106
+ size_t *PropSizeRet) {
105
107
std::shared_lock<ur_shared_mutex> Lock (Context->Mutex );
106
108
UrReturnHelper ReturnValue (PropSize, ContextInfo, PropSizeRet);
107
109
switch (
@@ -141,22 +143,22 @@ ur_result_t urContextGetInfo(
141
143
}
142
144
143
145
ur_result_t urContextGetNativeHandle (
144
- ur_context_handle_t Context, // /< [in] handle of the context.
145
- ur_native_handle_t *NativeContext // /< [out] a pointer to the native
146
- // /< handle of the context.
147
- ) {
146
+ // / [in] handle of the context.
147
+ ur_context_handle_t Context,
148
+ // / [out] a pointer to the native handle of the context.
149
+ ur_native_handle_t *NativeContext ) {
148
150
*NativeContext = reinterpret_cast <ur_native_handle_t >(Context->ZeContext );
149
151
return UR_RESULT_SUCCESS;
150
152
}
151
153
152
154
ur_result_t urContextCreateWithNativeHandle (
153
155
ur_native_handle_t
154
- NativeContext, // /< [in] the native handle of the context.
156
+ // / [in] the native handle of the context.
157
+ NativeContext,
155
158
ur_adapter_handle_t , uint32_t NumDevices, const ur_device_handle_t *Devices,
156
159
const ur_context_native_properties_t *Properties,
157
- ur_context_handle_t
158
- *Context // /< [out] pointer to the handle of the context object created.
159
- ) {
160
+ // / [out] pointer to the handle of the context object created.
161
+ ur_context_handle_t *Context) {
160
162
bool OwnNativeHandle = Properties->isNativeHandleOwned ;
161
163
try {
162
164
ze_context_handle_t ZeContext =
@@ -174,12 +176,12 @@ ur_result_t urContextCreateWithNativeHandle(
174
176
}
175
177
176
178
ur_result_t urContextSetExtendedDeleter (
177
- ur_context_handle_t Context, // /< [in] handle of the context.
178
- ur_context_extended_deleter_t
179
- Deleter, // /< [in] Function pointer to extended deleter.
180
- void *UserData // /< [in][out][optional] pointer to data to be passed to
181
- // /< callback.
182
- ) {
179
+ // / [in] handle of the context.
180
+ ur_context_handle_t Context,
181
+ // / [in] Function pointer to extended deleter.
182
+ ur_context_extended_deleter_t Deleter,
183
+ // / [in][out][optional] pointer to data to be passed to callback.
184
+ void *UserData ) {
183
185
std::ignore = Context;
184
186
std::ignore = Deleter;
185
187
std::ignore = UserData;
0 commit comments