1 /*
2 *
3 * Copyright (C) 2019-2021 Intel Corporation
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * @file zes_libapi.cpp
8 *
9 * @brief C++ static library for zes
10 *
11 */
12 #include "ze_lib.h"
13
14 extern "C" {
15
16 ///////////////////////////////////////////////////////////////////////////////
17 /// @brief Get properties about the device
18 ///
19 /// @details
20 /// - The application may call this function from simultaneous threads.
21 /// - The implementation of this function should be lock-free.
22 ///
23 /// @returns
24 /// - ::ZE_RESULT_SUCCESS
25 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
26 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
27 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
28 /// + `nullptr == hDevice`
29 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
30 /// + `nullptr == pProperties`
31 ze_result_t ZE_APICALL
zesDeviceGetProperties(zes_device_handle_t hDevice,zes_device_properties_t * pProperties)32 zesDeviceGetProperties(
33 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
34 zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device.
35 )
36 {
37 auto pfnGetProperties = ze_lib::context->zesDdiTable.Device.pfnGetProperties;
38 if( nullptr == pfnGetProperties )
39 return ZE_RESULT_ERROR_UNINITIALIZED;
40
41 return pfnGetProperties( hDevice, pProperties );
42 }
43
44 ///////////////////////////////////////////////////////////////////////////////
45 /// @brief Get information about the state of the device - if a reset is
46 /// required, reasons for the reset and if the device has been repaired
47 ///
48 /// @details
49 /// - The application may call this function from simultaneous threads.
50 /// - The implementation of this function should be lock-free.
51 ///
52 /// @returns
53 /// - ::ZE_RESULT_SUCCESS
54 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
55 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
56 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
57 /// + `nullptr == hDevice`
58 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
59 /// + `nullptr == pState`
60 ze_result_t ZE_APICALL
zesDeviceGetState(zes_device_handle_t hDevice,zes_device_state_t * pState)61 zesDeviceGetState(
62 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
63 zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device.
64 )
65 {
66 auto pfnGetState = ze_lib::context->zesDdiTable.Device.pfnGetState;
67 if( nullptr == pfnGetState )
68 return ZE_RESULT_ERROR_UNINITIALIZED;
69
70 return pfnGetState( hDevice, pState );
71 }
72
73 ///////////////////////////////////////////////////////////////////////////////
74 /// @brief Reset device
75 ///
76 /// @details
77 /// - Performs a PCI bus reset of the device. This will result in all
78 /// current device state being lost.
79 /// - All applications using the device should be stopped before calling
80 /// this function.
81 /// - If the force argument is specified, all applications using the device
82 /// will be forcibly killed.
83 /// - The function will block until the device has restarted or a timeout
84 /// occurred waiting for the reset to complete.
85 ///
86 /// @returns
87 /// - ::ZE_RESULT_SUCCESS
88 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
89 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
90 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
91 /// + `nullptr == hDevice`
92 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
93 /// + User does not have permissions to perform this operation.
94 /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE - "Reset cannot be performed because applications are using this device."
95 /// - ::ZE_RESULT_ERROR_UNKNOWN - "There were problems unloading the device driver, performing a bus reset or reloading the device driver."
96 ze_result_t ZE_APICALL
zesDeviceReset(zes_device_handle_t hDevice,ze_bool_t force)97 zesDeviceReset(
98 zes_device_handle_t hDevice, ///< [in] Sysman handle for the device
99 ze_bool_t force ///< [in] If set to true, all applications that are currently using the
100 ///< device will be forcibly killed.
101 )
102 {
103 auto pfnReset = ze_lib::context->zesDdiTable.Device.pfnReset;
104 if( nullptr == pfnReset )
105 return ZE_RESULT_ERROR_UNINITIALIZED;
106
107 return pfnReset( hDevice, force );
108 }
109
110 ///////////////////////////////////////////////////////////////////////////////
111 /// @brief Get information about host processes using the device
112 ///
113 /// @details
114 /// - The number of processes connected to the device is dynamic. This means
115 /// that between a call to determine the value of pCount and the
116 /// subsequent call, the number of processes may have increased or
117 /// decreased. It is recommended that a large array be passed in so as to
118 /// avoid receiving the error ::ZE_RESULT_ERROR_INVALID_SIZE. Also, always
119 /// check the returned value in pCount since it may be less than the
120 /// earlier call to get the required array size.
121 /// - The application may call this function from simultaneous threads.
122 /// - The implementation of this function should be lock-free.
123 ///
124 /// @returns
125 /// - ::ZE_RESULT_SUCCESS
126 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
127 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
128 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
129 /// + `nullptr == hDevice`
130 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
131 /// + `nullptr == pCount`
132 /// - ::ZE_RESULT_ERROR_INVALID_SIZE
133 /// + The provided value of pCount is not big enough to store information about all the processes currently attached to the device.
134 ze_result_t ZE_APICALL
zesDeviceProcessesGetState(zes_device_handle_t hDevice,uint32_t * pCount,zes_process_state_t * pProcesses)135 zesDeviceProcessesGetState(
136 zes_device_handle_t hDevice, ///< [in] Sysman handle for the device
137 uint32_t* pCount, ///< [in,out] pointer to the number of processes.
138 ///< if count is zero, then the driver shall update the value with the
139 ///< total number of processes currently attached to the device.
140 ///< if count is greater than the number of processes currently attached to
141 ///< the device, then the driver shall update the value with the correct
142 ///< number of processes.
143 zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information.
144 ///< if count is less than the number of processes currently attached to
145 ///< the device, then the driver shall only retrieve information about that
146 ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE.
147 )
148 {
149 auto pfnProcessesGetState = ze_lib::context->zesDdiTable.Device.pfnProcessesGetState;
150 if( nullptr == pfnProcessesGetState )
151 return ZE_RESULT_ERROR_UNINITIALIZED;
152
153 return pfnProcessesGetState( hDevice, pCount, pProcesses );
154 }
155
156 ///////////////////////////////////////////////////////////////////////////////
157 /// @brief Get PCI properties - address, max speed
158 ///
159 /// @details
160 /// - The application may call this function from simultaneous threads.
161 /// - The implementation of this function should be lock-free.
162 ///
163 /// @returns
164 /// - ::ZE_RESULT_SUCCESS
165 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
166 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
167 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
168 /// + `nullptr == hDevice`
169 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
170 /// + `nullptr == pProperties`
171 ze_result_t ZE_APICALL
zesDevicePciGetProperties(zes_device_handle_t hDevice,zes_pci_properties_t * pProperties)172 zesDevicePciGetProperties(
173 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
174 zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties.
175 )
176 {
177 auto pfnPciGetProperties = ze_lib::context->zesDdiTable.Device.pfnPciGetProperties;
178 if( nullptr == pfnPciGetProperties )
179 return ZE_RESULT_ERROR_UNINITIALIZED;
180
181 return pfnPciGetProperties( hDevice, pProperties );
182 }
183
184 ///////////////////////////////////////////////////////////////////////////////
185 /// @brief Get current PCI state - current speed
186 ///
187 /// @details
188 /// - The application may call this function from simultaneous threads.
189 /// - The implementation of this function should be lock-free.
190 ///
191 /// @returns
192 /// - ::ZE_RESULT_SUCCESS
193 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
194 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
195 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
196 /// + `nullptr == hDevice`
197 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
198 /// + `nullptr == pState`
199 ze_result_t ZE_APICALL
zesDevicePciGetState(zes_device_handle_t hDevice,zes_pci_state_t * pState)200 zesDevicePciGetState(
201 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
202 zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties.
203 )
204 {
205 auto pfnPciGetState = ze_lib::context->zesDdiTable.Device.pfnPciGetState;
206 if( nullptr == pfnPciGetState )
207 return ZE_RESULT_ERROR_UNINITIALIZED;
208
209 return pfnPciGetState( hDevice, pState );
210 }
211
212 ///////////////////////////////////////////////////////////////////////////////
213 /// @brief Get information about each configured bar
214 ///
215 /// @details
216 /// - The application may call this function from simultaneous threads.
217 /// - The implementation of this function should be lock-free.
218 ///
219 /// @returns
220 /// - ::ZE_RESULT_SUCCESS
221 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
222 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
223 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
224 /// + `nullptr == hDevice`
225 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
226 /// + `nullptr == pCount`
227 ze_result_t ZE_APICALL
zesDevicePciGetBars(zes_device_handle_t hDevice,uint32_t * pCount,zes_pci_bar_properties_t * pProperties)228 zesDevicePciGetBars(
229 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
230 uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars.
231 ///< if count is zero, then the driver shall update the value with the
232 ///< total number of PCI bars that are setup.
233 ///< if count is greater than the number of PCI bars that are setup, then
234 ///< the driver shall update the value with the correct number of PCI bars.
235 zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup
236 ///< PCI bars.
237 ///< if count is less than the number of PCI bars that are setup, then the
238 ///< driver shall only retrieve information about that number of PCI bars.
239 )
240 {
241 auto pfnPciGetBars = ze_lib::context->zesDdiTable.Device.pfnPciGetBars;
242 if( nullptr == pfnPciGetBars )
243 return ZE_RESULT_ERROR_UNINITIALIZED;
244
245 return pfnPciGetBars( hDevice, pCount, pProperties );
246 }
247
248 ///////////////////////////////////////////////////////////////////////////////
249 /// @brief Get PCI stats - bandwidth, number of packets, number of replays
250 ///
251 /// @details
252 /// - The application may call this function from simultaneous threads.
253 /// - The implementation of this function should be lock-free.
254 ///
255 /// @returns
256 /// - ::ZE_RESULT_SUCCESS
257 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
258 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
259 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
260 /// + `nullptr == hDevice`
261 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
262 /// + `nullptr == pStats`
263 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
264 /// + User does not have permissions to query this telemetry.
265 ze_result_t ZE_APICALL
zesDevicePciGetStats(zes_device_handle_t hDevice,zes_pci_stats_t * pStats)266 zesDevicePciGetStats(
267 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
268 zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats.
269 )
270 {
271 auto pfnPciGetStats = ze_lib::context->zesDdiTable.Device.pfnPciGetStats;
272 if( nullptr == pfnPciGetStats )
273 return ZE_RESULT_ERROR_UNINITIALIZED;
274
275 return pfnPciGetStats( hDevice, pStats );
276 }
277
278 ///////////////////////////////////////////////////////////////////////////////
279 /// @brief Get handle of diagnostics test suites
280 ///
281 /// @details
282 /// - The application may call this function from simultaneous threads.
283 /// - The implementation of this function should be lock-free.
284 ///
285 /// @returns
286 /// - ::ZE_RESULT_SUCCESS
287 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
288 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
289 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
290 /// + `nullptr == hDevice`
291 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
292 /// + `nullptr == pCount`
293 ze_result_t ZE_APICALL
zesDeviceEnumDiagnosticTestSuites(zes_device_handle_t hDevice,uint32_t * pCount,zes_diag_handle_t * phDiagnostics)294 zesDeviceEnumDiagnosticTestSuites(
295 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
296 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
297 ///< if count is zero, then the driver shall update the value with the
298 ///< total number of components of this type that are available.
299 ///< if count is greater than the number of components of this type that
300 ///< are available, then the driver shall update the value with the correct
301 ///< number of components.
302 zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of
303 ///< this type.
304 ///< if count is less than the number of components of this type that are
305 ///< available, then the driver shall only retrieve that number of
306 ///< component handles.
307 )
308 {
309 auto pfnEnumDiagnosticTestSuites = ze_lib::context->zesDdiTable.Device.pfnEnumDiagnosticTestSuites;
310 if( nullptr == pfnEnumDiagnosticTestSuites )
311 return ZE_RESULT_ERROR_UNINITIALIZED;
312
313 return pfnEnumDiagnosticTestSuites( hDevice, pCount, phDiagnostics );
314 }
315
316 ///////////////////////////////////////////////////////////////////////////////
317 /// @brief Get properties of a diagnostics test suite
318 ///
319 /// @details
320 /// - The application may call this function from simultaneous threads.
321 /// - The implementation of this function should be lock-free.
322 ///
323 /// @returns
324 /// - ::ZE_RESULT_SUCCESS
325 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
326 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
327 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
328 /// + `nullptr == hDiagnostics`
329 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
330 /// + `nullptr == pProperties`
331 ze_result_t ZE_APICALL
zesDiagnosticsGetProperties(zes_diag_handle_t hDiagnostics,zes_diag_properties_t * pProperties)332 zesDiagnosticsGetProperties(
333 zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component.
334 zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test
335 ///< suite
336 )
337 {
338 auto pfnGetProperties = ze_lib::context->zesDdiTable.Diagnostics.pfnGetProperties;
339 if( nullptr == pfnGetProperties )
340 return ZE_RESULT_ERROR_UNINITIALIZED;
341
342 return pfnGetProperties( hDiagnostics, pProperties );
343 }
344
345 ///////////////////////////////////////////////////////////////////////////////
346 /// @brief Get individual tests that can be run separately. Not all test suites
347 /// permit running individual tests - check
348 /// ::zes_diag_properties_t.haveTests
349 ///
350 /// @details
351 /// - The list of available tests is returned in order of increasing test
352 /// index ::zes_diag_test_t.index.
353 /// - The application may call this function from simultaneous threads.
354 /// - The implementation of this function should be lock-free.
355 ///
356 /// @returns
357 /// - ::ZE_RESULT_SUCCESS
358 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
359 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
360 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
361 /// + `nullptr == hDiagnostics`
362 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
363 /// + `nullptr == pCount`
364 ze_result_t ZE_APICALL
zesDiagnosticsGetTests(zes_diag_handle_t hDiagnostics,uint32_t * pCount,zes_diag_test_t * pTests)365 zesDiagnosticsGetTests(
366 zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component.
367 uint32_t* pCount, ///< [in,out] pointer to the number of tests.
368 ///< if count is zero, then the driver shall update the value with the
369 ///< total number of tests that are available.
370 ///< if count is greater than the number of tests that are available, then
371 ///< the driver shall update the value with the correct number of tests.
372 zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about
373 ///< individual tests sorted by increasing value of ::zes_diag_test_t.index.
374 ///< if count is less than the number of tests that are available, then the
375 ///< driver shall only retrieve that number of tests.
376 )
377 {
378 auto pfnGetTests = ze_lib::context->zesDdiTable.Diagnostics.pfnGetTests;
379 if( nullptr == pfnGetTests )
380 return ZE_RESULT_ERROR_UNINITIALIZED;
381
382 return pfnGetTests( hDiagnostics, pCount, pTests );
383 }
384
385 ///////////////////////////////////////////////////////////////////////////////
386 /// @brief Run a diagnostics test suite, either all tests or a subset of tests.
387 ///
388 /// @details
389 /// - WARNING: Running diagnostics may destroy current device state
390 /// information. Gracefully close any running workloads before initiating.
391 /// - To run all tests in a test suite, set start =
392 /// ::ZES_DIAG_FIRST_TEST_INDEX and end = ::ZES_DIAG_LAST_TEST_INDEX.
393 /// - If the test suite permits running individual tests,
394 /// ::zes_diag_properties_t.haveTests will be true. In this case, the
395 /// function ::zesDiagnosticsGetTests() can be called to get the list of
396 /// tests and corresponding indices that can be supplied to the arguments
397 /// start and end in this function.
398 /// - This function will block until the diagnostics have completed and
399 /// force reset based on result
400 ///
401 /// @returns
402 /// - ::ZE_RESULT_SUCCESS
403 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
404 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
405 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
406 /// + `nullptr == hDiagnostics`
407 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
408 /// + `nullptr == pResult`
409 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
410 /// + User does not have permissions to perform diagnostics.
411 ze_result_t ZE_APICALL
zesDiagnosticsRunTests(zes_diag_handle_t hDiagnostics,uint32_t startIndex,uint32_t endIndex,zes_diag_result_t * pResult)412 zesDiagnosticsRunTests(
413 zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component.
414 uint32_t startIndex, ///< [in] The index of the first test to run. Set to
415 ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning.
416 uint32_t endIndex, ///< [in] The index of the last test to run. Set to
417 ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test.
418 zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics
419 )
420 {
421 auto pfnRunTests = ze_lib::context->zesDdiTable.Diagnostics.pfnRunTests;
422 if( nullptr == pfnRunTests )
423 return ZE_RESULT_ERROR_UNINITIALIZED;
424
425 return pfnRunTests( hDiagnostics, startIndex, endIndex, pResult );
426 }
427
428 ///////////////////////////////////////////////////////////////////////////////
429 /// @brief Get handle of engine groups
430 ///
431 /// @details
432 /// - The application may call this function from simultaneous threads.
433 /// - The implementation of this function should be lock-free.
434 ///
435 /// @returns
436 /// - ::ZE_RESULT_SUCCESS
437 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
438 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
439 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
440 /// + `nullptr == hDevice`
441 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
442 /// + `nullptr == pCount`
443 ze_result_t ZE_APICALL
zesDeviceEnumEngineGroups(zes_device_handle_t hDevice,uint32_t * pCount,zes_engine_handle_t * phEngine)444 zesDeviceEnumEngineGroups(
445 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
446 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
447 ///< if count is zero, then the driver shall update the value with the
448 ///< total number of components of this type that are available.
449 ///< if count is greater than the number of components of this type that
450 ///< are available, then the driver shall update the value with the correct
451 ///< number of components.
452 zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of
453 ///< this type.
454 ///< if count is less than the number of components of this type that are
455 ///< available, then the driver shall only retrieve that number of
456 ///< component handles.
457 )
458 {
459 auto pfnEnumEngineGroups = ze_lib::context->zesDdiTable.Device.pfnEnumEngineGroups;
460 if( nullptr == pfnEnumEngineGroups )
461 return ZE_RESULT_ERROR_UNINITIALIZED;
462
463 return pfnEnumEngineGroups( hDevice, pCount, phEngine );
464 }
465
466 ///////////////////////////////////////////////////////////////////////////////
467 /// @brief Get engine group properties
468 ///
469 /// @details
470 /// - The application may call this function from simultaneous threads.
471 /// - The implementation of this function should be lock-free.
472 ///
473 /// @returns
474 /// - ::ZE_RESULT_SUCCESS
475 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
476 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
477 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
478 /// + `nullptr == hEngine`
479 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
480 /// + `nullptr == pProperties`
481 ze_result_t ZE_APICALL
zesEngineGetProperties(zes_engine_handle_t hEngine,zes_engine_properties_t * pProperties)482 zesEngineGetProperties(
483 zes_engine_handle_t hEngine, ///< [in] Handle for the component.
484 zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group.
485 )
486 {
487 auto pfnGetProperties = ze_lib::context->zesDdiTable.Engine.pfnGetProperties;
488 if( nullptr == pfnGetProperties )
489 return ZE_RESULT_ERROR_UNINITIALIZED;
490
491 return pfnGetProperties( hEngine, pProperties );
492 }
493
494 ///////////////////////////////////////////////////////////////////////////////
495 /// @brief Get the activity stats for an engine group
496 ///
497 /// @details
498 /// - The application may call this function from simultaneous threads.
499 /// - The implementation of this function should be lock-free.
500 ///
501 /// @returns
502 /// - ::ZE_RESULT_SUCCESS
503 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
504 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
505 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
506 /// + `nullptr == hEngine`
507 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
508 /// + `nullptr == pStats`
509 ze_result_t ZE_APICALL
zesEngineGetActivity(zes_engine_handle_t hEngine,zes_engine_stats_t * pStats)510 zesEngineGetActivity(
511 zes_engine_handle_t hEngine, ///< [in] Handle for the component.
512 zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity
513 ///< counters.
514 )
515 {
516 auto pfnGetActivity = ze_lib::context->zesDdiTable.Engine.pfnGetActivity;
517 if( nullptr == pfnGetActivity )
518 return ZE_RESULT_ERROR_UNINITIALIZED;
519
520 return pfnGetActivity( hEngine, pStats );
521 }
522
523 ///////////////////////////////////////////////////////////////////////////////
524 /// @brief Specify the list of events to listen to for a given device
525 ///
526 /// @details
527 /// - The application may call this function from simultaneous threads.
528 /// - The implementation of this function should be lock-free.
529 ///
530 /// @returns
531 /// - ::ZE_RESULT_SUCCESS
532 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
533 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
534 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
535 /// + `nullptr == hDevice`
536 /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
537 /// + `0x7fff < events`
538 ze_result_t ZE_APICALL
zesDeviceEventRegister(zes_device_handle_t hDevice,zes_event_type_flags_t events)539 zesDeviceEventRegister(
540 zes_device_handle_t hDevice, ///< [in] The device handle.
541 zes_event_type_flags_t events ///< [in] List of events to listen to.
542 )
543 {
544 auto pfnEventRegister = ze_lib::context->zesDdiTable.Device.pfnEventRegister;
545 if( nullptr == pfnEventRegister )
546 return ZE_RESULT_ERROR_UNINITIALIZED;
547
548 return pfnEventRegister( hDevice, events );
549 }
550
551 ///////////////////////////////////////////////////////////////////////////////
552 /// @brief Wait for events to be received from a one or more devices.
553 ///
554 /// @details
555 /// - The application may call this function from simultaneous threads.
556 /// - The implementation of this function should be lock-free.
557 ///
558 /// @returns
559 /// - ::ZE_RESULT_SUCCESS
560 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
561 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
562 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
563 /// + `nullptr == hDriver`
564 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
565 /// + `nullptr == phDevices`
566 /// + `nullptr == pNumDeviceEvents`
567 /// + `nullptr == pEvents`
568 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
569 /// + User does not have permissions to listen to events.
570 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
571 /// + One or more of the supplied device handles belongs to a different driver.
572 ze_result_t ZE_APICALL
zesDriverEventListen(ze_driver_handle_t hDriver,uint32_t timeout,uint32_t count,zes_device_handle_t * phDevices,uint32_t * pNumDeviceEvents,zes_event_type_flags_t * pEvents)573 zesDriverEventListen(
574 ze_driver_handle_t hDriver, ///< [in] handle of the driver instance
575 uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to
576 ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY;
577 ///< if zero, then will check status and return immediately;
578 ///< if UINT32_MAX, then function will not return until events arrive.
579 uint32_t count, ///< [in] Number of device handles in phDevices.
580 zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only
581 ///< devices from the provided driver handle can be specified in this list.
582 uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that
583 ///< generated events. If non-zero, check pEvents to determine the devices
584 ///< and events that were received.
585 zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each
586 ///< device listened in phDevices.
587 ///< This array must be at least as big as count.
588 ///< For every device handle in phDevices, this will provide the events
589 ///< that occurred for that device at the same position in this array. If
590 ///< no event was received for a given device, the corresponding array
591 ///< entry will be zero.
592 )
593 {
594 auto pfnEventListen = ze_lib::context->zesDdiTable.Driver.pfnEventListen;
595 if( nullptr == pfnEventListen )
596 return ZE_RESULT_ERROR_UNINITIALIZED;
597
598 return pfnEventListen( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents );
599 }
600
601 ///////////////////////////////////////////////////////////////////////////////
602 /// @brief Wait for events to be received from a one or more devices.
603 ///
604 /// @details
605 /// - The application may call this function from simultaneous threads.
606 /// - The implementation of this function should be lock-free.
607 ///
608 /// @returns
609 /// - ::ZE_RESULT_SUCCESS
610 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
611 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
612 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
613 /// + `nullptr == hDriver`
614 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
615 /// + `nullptr == phDevices`
616 /// + `nullptr == pNumDeviceEvents`
617 /// + `nullptr == pEvents`
618 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
619 /// + User does not have permissions to listen to events.
620 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
621 /// + One or more of the supplied device handles belongs to a different driver.
622 ze_result_t ZE_APICALL
zesDriverEventListenEx(ze_driver_handle_t hDriver,uint64_t timeout,uint32_t count,zes_device_handle_t * phDevices,uint32_t * pNumDeviceEvents,zes_event_type_flags_t * pEvents)623 zesDriverEventListenEx(
624 ze_driver_handle_t hDriver, ///< [in] handle of the driver instance
625 uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to
626 ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY;
627 ///< if zero, then will check status and return immediately;
628 ///< if UINT64_MAX, then function will not return until events arrive.
629 uint32_t count, ///< [in] Number of device handles in phDevices.
630 zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only
631 ///< devices from the provided driver handle can be specified in this list.
632 uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that
633 ///< generated events. If non-zero, check pEvents to determine the devices
634 ///< and events that were received.
635 zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each
636 ///< device listened in phDevices.
637 ///< This array must be at least as big as count.
638 ///< For every device handle in phDevices, this will provide the events
639 ///< that occurred for that device at the same position in this array. If
640 ///< no event was received for a given device, the corresponding array
641 ///< entry will be zero.
642 )
643 {
644 auto pfnEventListenEx = ze_lib::context->zesDdiTable.Driver.pfnEventListenEx;
645 if( nullptr == pfnEventListenEx )
646 return ZE_RESULT_ERROR_UNINITIALIZED;
647
648 return pfnEventListenEx( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents );
649 }
650
651 ///////////////////////////////////////////////////////////////////////////////
652 /// @brief Get handle of Fabric ports in a device
653 ///
654 /// @details
655 /// - The application may call this function from simultaneous threads.
656 /// - The implementation of this function should be lock-free.
657 ///
658 /// @returns
659 /// - ::ZE_RESULT_SUCCESS
660 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
661 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
662 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
663 /// + `nullptr == hDevice`
664 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
665 /// + `nullptr == pCount`
666 ze_result_t ZE_APICALL
zesDeviceEnumFabricPorts(zes_device_handle_t hDevice,uint32_t * pCount,zes_fabric_port_handle_t * phPort)667 zesDeviceEnumFabricPorts(
668 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
669 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
670 ///< if count is zero, then the driver shall update the value with the
671 ///< total number of components of this type that are available.
672 ///< if count is greater than the number of components of this type that
673 ///< are available, then the driver shall update the value with the correct
674 ///< number of components.
675 zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of
676 ///< this type.
677 ///< if count is less than the number of components of this type that are
678 ///< available, then the driver shall only retrieve that number of
679 ///< component handles.
680 )
681 {
682 auto pfnEnumFabricPorts = ze_lib::context->zesDdiTable.Device.pfnEnumFabricPorts;
683 if( nullptr == pfnEnumFabricPorts )
684 return ZE_RESULT_ERROR_UNINITIALIZED;
685
686 return pfnEnumFabricPorts( hDevice, pCount, phPort );
687 }
688
689 ///////////////////////////////////////////////////////////////////////////////
690 /// @brief Get Fabric port properties
691 ///
692 /// @details
693 /// - The application may call this function from simultaneous threads.
694 /// - The implementation of this function should be lock-free.
695 ///
696 /// @returns
697 /// - ::ZE_RESULT_SUCCESS
698 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
699 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
700 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
701 /// + `nullptr == hPort`
702 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
703 /// + `nullptr == pProperties`
704 ze_result_t ZE_APICALL
zesFabricPortGetProperties(zes_fabric_port_handle_t hPort,zes_fabric_port_properties_t * pProperties)705 zesFabricPortGetProperties(
706 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
707 zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port.
708 )
709 {
710 auto pfnGetProperties = ze_lib::context->zesDdiTable.FabricPort.pfnGetProperties;
711 if( nullptr == pfnGetProperties )
712 return ZE_RESULT_ERROR_UNINITIALIZED;
713
714 return pfnGetProperties( hPort, pProperties );
715 }
716
717 ///////////////////////////////////////////////////////////////////////////////
718 /// @brief Get Fabric port link type
719 ///
720 /// @details
721 /// - The application may call this function from simultaneous threads.
722 /// - The implementation of this function should be lock-free.
723 ///
724 /// @returns
725 /// - ::ZE_RESULT_SUCCESS
726 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
727 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
728 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
729 /// + `nullptr == hPort`
730 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
731 /// + `nullptr == pLinkType`
732 ze_result_t ZE_APICALL
zesFabricPortGetLinkType(zes_fabric_port_handle_t hPort,zes_fabric_link_type_t * pLinkType)733 zesFabricPortGetLinkType(
734 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
735 zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric
736 ///< port.
737 )
738 {
739 auto pfnGetLinkType = ze_lib::context->zesDdiTable.FabricPort.pfnGetLinkType;
740 if( nullptr == pfnGetLinkType )
741 return ZE_RESULT_ERROR_UNINITIALIZED;
742
743 return pfnGetLinkType( hPort, pLinkType );
744 }
745
746 ///////////////////////////////////////////////////////////////////////////////
747 /// @brief Get Fabric port configuration
748 ///
749 /// @details
750 /// - The application may call this function from simultaneous threads.
751 /// - The implementation of this function should be lock-free.
752 ///
753 /// @returns
754 /// - ::ZE_RESULT_SUCCESS
755 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
756 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
757 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
758 /// + `nullptr == hPort`
759 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
760 /// + `nullptr == pConfig`
761 ze_result_t ZE_APICALL
zesFabricPortGetConfig(zes_fabric_port_handle_t hPort,zes_fabric_port_config_t * pConfig)762 zesFabricPortGetConfig(
763 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
764 zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port.
765 )
766 {
767 auto pfnGetConfig = ze_lib::context->zesDdiTable.FabricPort.pfnGetConfig;
768 if( nullptr == pfnGetConfig )
769 return ZE_RESULT_ERROR_UNINITIALIZED;
770
771 return pfnGetConfig( hPort, pConfig );
772 }
773
774 ///////////////////////////////////////////////////////////////////////////////
775 /// @brief Set Fabric port configuration
776 ///
777 /// @details
778 /// - The application may call this function from simultaneous threads.
779 /// - The implementation of this function should be lock-free.
780 ///
781 /// @returns
782 /// - ::ZE_RESULT_SUCCESS
783 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
784 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
785 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
786 /// + `nullptr == hPort`
787 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
788 /// + `nullptr == pConfig`
789 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
790 /// + User does not have permissions to make these modifications.
791 ze_result_t ZE_APICALL
zesFabricPortSetConfig(zes_fabric_port_handle_t hPort,const zes_fabric_port_config_t * pConfig)792 zesFabricPortSetConfig(
793 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
794 const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port.
795 )
796 {
797 auto pfnSetConfig = ze_lib::context->zesDdiTable.FabricPort.pfnSetConfig;
798 if( nullptr == pfnSetConfig )
799 return ZE_RESULT_ERROR_UNINITIALIZED;
800
801 return pfnSetConfig( hPort, pConfig );
802 }
803
804 ///////////////////////////////////////////////////////////////////////////////
805 /// @brief Get Fabric port state - status (health/degraded/failed/disabled),
806 /// reasons for link degradation or instability, current rx/tx speed
807 ///
808 /// @details
809 /// - The application may call this function from simultaneous threads.
810 /// - The implementation of this function should be lock-free.
811 ///
812 /// @returns
813 /// - ::ZE_RESULT_SUCCESS
814 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
815 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
816 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
817 /// + `nullptr == hPort`
818 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
819 /// + `nullptr == pState`
820 ze_result_t ZE_APICALL
zesFabricPortGetState(zes_fabric_port_handle_t hPort,zes_fabric_port_state_t * pState)821 zesFabricPortGetState(
822 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
823 zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port
824 )
825 {
826 auto pfnGetState = ze_lib::context->zesDdiTable.FabricPort.pfnGetState;
827 if( nullptr == pfnGetState )
828 return ZE_RESULT_ERROR_UNINITIALIZED;
829
830 return pfnGetState( hPort, pState );
831 }
832
833 ///////////////////////////////////////////////////////////////////////////////
834 /// @brief Get Fabric port throughput
835 ///
836 /// @details
837 /// - The application may call this function from simultaneous threads.
838 /// - The implementation of this function should be lock-free.
839 ///
840 /// @returns
841 /// - ::ZE_RESULT_SUCCESS
842 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
843 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
844 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
845 /// + `nullptr == hPort`
846 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
847 /// + `nullptr == pThroughput`
848 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
849 /// + User does not have permissions to query this telemetry.
850 ze_result_t ZE_APICALL
zesFabricPortGetThroughput(zes_fabric_port_handle_t hPort,zes_fabric_port_throughput_t * pThroughput)851 zesFabricPortGetThroughput(
852 zes_fabric_port_handle_t hPort, ///< [in] Handle for the component.
853 zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters.
854 )
855 {
856 auto pfnGetThroughput = ze_lib::context->zesDdiTable.FabricPort.pfnGetThroughput;
857 if( nullptr == pfnGetThroughput )
858 return ZE_RESULT_ERROR_UNINITIALIZED;
859
860 return pfnGetThroughput( hPort, pThroughput );
861 }
862
863 ///////////////////////////////////////////////////////////////////////////////
864 /// @brief Get handle of fans
865 ///
866 /// @details
867 /// - The application may call this function from simultaneous threads.
868 /// - The implementation of this function should be lock-free.
869 ///
870 /// @returns
871 /// - ::ZE_RESULT_SUCCESS
872 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
873 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
874 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
875 /// + `nullptr == hDevice`
876 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
877 /// + `nullptr == pCount`
878 ze_result_t ZE_APICALL
zesDeviceEnumFans(zes_device_handle_t hDevice,uint32_t * pCount,zes_fan_handle_t * phFan)879 zesDeviceEnumFans(
880 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
881 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
882 ///< if count is zero, then the driver shall update the value with the
883 ///< total number of components of this type that are available.
884 ///< if count is greater than the number of components of this type that
885 ///< are available, then the driver shall update the value with the correct
886 ///< number of components.
887 zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of
888 ///< this type.
889 ///< if count is less than the number of components of this type that are
890 ///< available, then the driver shall only retrieve that number of
891 ///< component handles.
892 )
893 {
894 auto pfnEnumFans = ze_lib::context->zesDdiTable.Device.pfnEnumFans;
895 if( nullptr == pfnEnumFans )
896 return ZE_RESULT_ERROR_UNINITIALIZED;
897
898 return pfnEnumFans( hDevice, pCount, phFan );
899 }
900
901 ///////////////////////////////////////////////////////////////////////////////
902 /// @brief Get fan properties
903 ///
904 /// @details
905 /// - The application may call this function from simultaneous threads.
906 /// - The implementation of this function should be lock-free.
907 ///
908 /// @returns
909 /// - ::ZE_RESULT_SUCCESS
910 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
911 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
912 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
913 /// + `nullptr == hFan`
914 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
915 /// + `nullptr == pProperties`
916 ze_result_t ZE_APICALL
zesFanGetProperties(zes_fan_handle_t hFan,zes_fan_properties_t * pProperties)917 zesFanGetProperties(
918 zes_fan_handle_t hFan, ///< [in] Handle for the component.
919 zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan.
920 )
921 {
922 auto pfnGetProperties = ze_lib::context->zesDdiTable.Fan.pfnGetProperties;
923 if( nullptr == pfnGetProperties )
924 return ZE_RESULT_ERROR_UNINITIALIZED;
925
926 return pfnGetProperties( hFan, pProperties );
927 }
928
929 ///////////////////////////////////////////////////////////////////////////////
930 /// @brief Get fan configurations and the current fan speed mode (default, fixed,
931 /// temp-speed table)
932 ///
933 /// @details
934 /// - The application may call this function from simultaneous threads.
935 /// - The implementation of this function should be lock-free.
936 ///
937 /// @returns
938 /// - ::ZE_RESULT_SUCCESS
939 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
940 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
941 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
942 /// + `nullptr == hFan`
943 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
944 /// + `nullptr == pConfig`
945 ze_result_t ZE_APICALL
zesFanGetConfig(zes_fan_handle_t hFan,zes_fan_config_t * pConfig)946 zesFanGetConfig(
947 zes_fan_handle_t hFan, ///< [in] Handle for the component.
948 zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan.
949 )
950 {
951 auto pfnGetConfig = ze_lib::context->zesDdiTable.Fan.pfnGetConfig;
952 if( nullptr == pfnGetConfig )
953 return ZE_RESULT_ERROR_UNINITIALIZED;
954
955 return pfnGetConfig( hFan, pConfig );
956 }
957
958 ///////////////////////////////////////////////////////////////////////////////
959 /// @brief Configure the fan to run with hardware factory settings (set mode to
960 /// ::ZES_FAN_SPEED_MODE_DEFAULT)
961 ///
962 /// @details
963 /// - The application may call this function from simultaneous threads.
964 /// - The implementation of this function should be lock-free.
965 ///
966 /// @returns
967 /// - ::ZE_RESULT_SUCCESS
968 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
969 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
970 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
971 /// + `nullptr == hFan`
972 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
973 /// + User does not have permissions to make these modifications.
974 ze_result_t ZE_APICALL
zesFanSetDefaultMode(zes_fan_handle_t hFan)975 zesFanSetDefaultMode(
976 zes_fan_handle_t hFan ///< [in] Handle for the component.
977 )
978 {
979 auto pfnSetDefaultMode = ze_lib::context->zesDdiTable.Fan.pfnSetDefaultMode;
980 if( nullptr == pfnSetDefaultMode )
981 return ZE_RESULT_ERROR_UNINITIALIZED;
982
983 return pfnSetDefaultMode( hFan );
984 }
985
986 ///////////////////////////////////////////////////////////////////////////////
987 /// @brief Configure the fan to rotate at a fixed speed (set mode to
988 /// ::ZES_FAN_SPEED_MODE_FIXED)
989 ///
990 /// @details
991 /// - The application may call this function from simultaneous threads.
992 /// - The implementation of this function should be lock-free.
993 ///
994 /// @returns
995 /// - ::ZE_RESULT_SUCCESS
996 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
997 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
998 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
999 /// + `nullptr == hFan`
1000 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1001 /// + `nullptr == speed`
1002 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1003 /// + User does not have permissions to make these modifications.
1004 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1005 /// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::zes_fan_properties_t.supportedModes and ::zes_fan_properties_t.supportedUnits.
1006 ze_result_t ZE_APICALL
zesFanSetFixedSpeedMode(zes_fan_handle_t hFan,const zes_fan_speed_t * speed)1007 zesFanSetFixedSpeedMode(
1008 zes_fan_handle_t hFan, ///< [in] Handle for the component.
1009 const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting
1010 )
1011 {
1012 auto pfnSetFixedSpeedMode = ze_lib::context->zesDdiTable.Fan.pfnSetFixedSpeedMode;
1013 if( nullptr == pfnSetFixedSpeedMode )
1014 return ZE_RESULT_ERROR_UNINITIALIZED;
1015
1016 return pfnSetFixedSpeedMode( hFan, speed );
1017 }
1018
1019 ///////////////////////////////////////////////////////////////////////////////
1020 /// @brief Configure the fan to adjust speed based on a temperature/speed table
1021 /// (set mode to ::ZES_FAN_SPEED_MODE_TABLE)
1022 ///
1023 /// @details
1024 /// - The application may call this function from simultaneous threads.
1025 /// - The implementation of this function should be lock-free.
1026 ///
1027 /// @returns
1028 /// - ::ZE_RESULT_SUCCESS
1029 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1030 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1031 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1032 /// + `nullptr == hFan`
1033 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1034 /// + `nullptr == speedTable`
1035 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1036 /// + User does not have permissions to make these modifications.
1037 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
1038 /// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest.
1039 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1040 /// + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::zes_fan_properties_t.supportedModes and ::zes_fan_properties_t.supportedUnits.
1041 ze_result_t ZE_APICALL
zesFanSetSpeedTableMode(zes_fan_handle_t hFan,const zes_fan_speed_table_t * speedTable)1042 zesFanSetSpeedTableMode(
1043 zes_fan_handle_t hFan, ///< [in] Handle for the component.
1044 const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs.
1045 )
1046 {
1047 auto pfnSetSpeedTableMode = ze_lib::context->zesDdiTable.Fan.pfnSetSpeedTableMode;
1048 if( nullptr == pfnSetSpeedTableMode )
1049 return ZE_RESULT_ERROR_UNINITIALIZED;
1050
1051 return pfnSetSpeedTableMode( hFan, speedTable );
1052 }
1053
1054 ///////////////////////////////////////////////////////////////////////////////
1055 /// @brief Get current state of a fan - current mode and speed
1056 ///
1057 /// @details
1058 /// - The application may call this function from simultaneous threads.
1059 /// - The implementation of this function should be lock-free.
1060 ///
1061 /// @returns
1062 /// - ::ZE_RESULT_SUCCESS
1063 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1064 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1065 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1066 /// + `nullptr == hFan`
1067 /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
1068 /// + `::ZES_FAN_SPEED_UNITS_PERCENT < units`
1069 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1070 /// + `nullptr == pSpeed`
1071 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1072 /// + The requested fan speed units are not supported. See ::zes_fan_properties_t.supportedUnits.
1073 ze_result_t ZE_APICALL
zesFanGetState(zes_fan_handle_t hFan,zes_fan_speed_units_t units,int32_t * pSpeed)1074 zesFanGetState(
1075 zes_fan_handle_t hFan, ///< [in] Handle for the component.
1076 zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned.
1077 int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units
1078 ///< requested. A value of -1 indicates that the fan speed cannot be
1079 ///< measured.
1080 )
1081 {
1082 auto pfnGetState = ze_lib::context->zesDdiTable.Fan.pfnGetState;
1083 if( nullptr == pfnGetState )
1084 return ZE_RESULT_ERROR_UNINITIALIZED;
1085
1086 return pfnGetState( hFan, units, pSpeed );
1087 }
1088
1089 ///////////////////////////////////////////////////////////////////////////////
1090 /// @brief Get handle of firmwares
1091 ///
1092 /// @details
1093 /// - The application may call this function from simultaneous threads.
1094 /// - The implementation of this function should be lock-free.
1095 ///
1096 /// @returns
1097 /// - ::ZE_RESULT_SUCCESS
1098 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1099 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1100 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1101 /// + `nullptr == hDevice`
1102 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1103 /// + `nullptr == pCount`
1104 ze_result_t ZE_APICALL
zesDeviceEnumFirmwares(zes_device_handle_t hDevice,uint32_t * pCount,zes_firmware_handle_t * phFirmware)1105 zesDeviceEnumFirmwares(
1106 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
1107 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
1108 ///< if count is zero, then the driver shall update the value with the
1109 ///< total number of components of this type that are available.
1110 ///< if count is greater than the number of components of this type that
1111 ///< are available, then the driver shall update the value with the correct
1112 ///< number of components.
1113 zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of
1114 ///< this type.
1115 ///< if count is less than the number of components of this type that are
1116 ///< available, then the driver shall only retrieve that number of
1117 ///< component handles.
1118 )
1119 {
1120 auto pfnEnumFirmwares = ze_lib::context->zesDdiTable.Device.pfnEnumFirmwares;
1121 if( nullptr == pfnEnumFirmwares )
1122 return ZE_RESULT_ERROR_UNINITIALIZED;
1123
1124 return pfnEnumFirmwares( hDevice, pCount, phFirmware );
1125 }
1126
1127 ///////////////////////////////////////////////////////////////////////////////
1128 /// @brief Get firmware properties
1129 ///
1130 /// @details
1131 /// - The application may call this function from simultaneous threads.
1132 /// - The implementation of this function should be lock-free.
1133 ///
1134 /// @returns
1135 /// - ::ZE_RESULT_SUCCESS
1136 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1137 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1138 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1139 /// + `nullptr == hFirmware`
1140 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1141 /// + `nullptr == pProperties`
1142 ze_result_t ZE_APICALL
zesFirmwareGetProperties(zes_firmware_handle_t hFirmware,zes_firmware_properties_t * pProperties)1143 zesFirmwareGetProperties(
1144 zes_firmware_handle_t hFirmware, ///< [in] Handle for the component.
1145 zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the
1146 ///< firmware
1147 )
1148 {
1149 auto pfnGetProperties = ze_lib::context->zesDdiTable.Firmware.pfnGetProperties;
1150 if( nullptr == pfnGetProperties )
1151 return ZE_RESULT_ERROR_UNINITIALIZED;
1152
1153 return pfnGetProperties( hFirmware, pProperties );
1154 }
1155
1156 ///////////////////////////////////////////////////////////////////////////////
1157 /// @brief Flash a new firmware image
1158 ///
1159 /// @details
1160 /// - The application may call this function from simultaneous threads.
1161 /// - The implementation of this function should be lock-free.
1162 ///
1163 /// @returns
1164 /// - ::ZE_RESULT_SUCCESS
1165 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1166 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1167 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1168 /// + `nullptr == hFirmware`
1169 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1170 /// + `nullptr == pImage`
1171 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1172 /// + User does not have permissions to perform this operation.
1173 ze_result_t ZE_APICALL
zesFirmwareFlash(zes_firmware_handle_t hFirmware,void * pImage,uint32_t size)1174 zesFirmwareFlash(
1175 zes_firmware_handle_t hFirmware, ///< [in] Handle for the component.
1176 void* pImage, ///< [in] Image of the new firmware to flash.
1177 uint32_t size ///< [in] Size of the flash image.
1178 )
1179 {
1180 auto pfnFlash = ze_lib::context->zesDdiTable.Firmware.pfnFlash;
1181 if( nullptr == pfnFlash )
1182 return ZE_RESULT_ERROR_UNINITIALIZED;
1183
1184 return pfnFlash( hFirmware, pImage, size );
1185 }
1186
1187 ///////////////////////////////////////////////////////////////////////////////
1188 /// @brief Get handle of frequency domains
1189 ///
1190 /// @details
1191 /// - The application may call this function from simultaneous threads.
1192 /// - The implementation of this function should be lock-free.
1193 ///
1194 /// @returns
1195 /// - ::ZE_RESULT_SUCCESS
1196 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1197 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1198 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1199 /// + `nullptr == hDevice`
1200 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1201 /// + `nullptr == pCount`
1202 ze_result_t ZE_APICALL
zesDeviceEnumFrequencyDomains(zes_device_handle_t hDevice,uint32_t * pCount,zes_freq_handle_t * phFrequency)1203 zesDeviceEnumFrequencyDomains(
1204 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
1205 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
1206 ///< if count is zero, then the driver shall update the value with the
1207 ///< total number of components of this type that are available.
1208 ///< if count is greater than the number of components of this type that
1209 ///< are available, then the driver shall update the value with the correct
1210 ///< number of components.
1211 zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of
1212 ///< this type.
1213 ///< if count is less than the number of components of this type that are
1214 ///< available, then the driver shall only retrieve that number of
1215 ///< component handles.
1216 )
1217 {
1218 auto pfnEnumFrequencyDomains = ze_lib::context->zesDdiTable.Device.pfnEnumFrequencyDomains;
1219 if( nullptr == pfnEnumFrequencyDomains )
1220 return ZE_RESULT_ERROR_UNINITIALIZED;
1221
1222 return pfnEnumFrequencyDomains( hDevice, pCount, phFrequency );
1223 }
1224
1225 ///////////////////////////////////////////////////////////////////////////////
1226 /// @brief Get frequency properties - available frequencies
1227 ///
1228 /// @details
1229 /// - The application may call this function from simultaneous threads.
1230 /// - The implementation of this function should be lock-free.
1231 ///
1232 /// @returns
1233 /// - ::ZE_RESULT_SUCCESS
1234 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1235 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1236 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1237 /// + `nullptr == hFrequency`
1238 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1239 /// + `nullptr == pProperties`
1240 ze_result_t ZE_APICALL
zesFrequencyGetProperties(zes_freq_handle_t hFrequency,zes_freq_properties_t * pProperties)1241 zesFrequencyGetProperties(
1242 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1243 zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain.
1244 )
1245 {
1246 auto pfnGetProperties = ze_lib::context->zesDdiTable.Frequency.pfnGetProperties;
1247 if( nullptr == pfnGetProperties )
1248 return ZE_RESULT_ERROR_UNINITIALIZED;
1249
1250 return pfnGetProperties( hFrequency, pProperties );
1251 }
1252
1253 ///////////////////////////////////////////////////////////////////////////////
1254 /// @brief Get available non-overclocked hardware clock frequencies for the
1255 /// frequency domain
1256 ///
1257 /// @details
1258 /// - The list of available frequencies is returned in order of slowest to
1259 /// fastest.
1260 /// - The application may call this function from simultaneous threads.
1261 /// - The implementation of this function should be lock-free.
1262 ///
1263 /// @returns
1264 /// - ::ZE_RESULT_SUCCESS
1265 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1266 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1267 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1268 /// + `nullptr == hFrequency`
1269 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1270 /// + `nullptr == pCount`
1271 ze_result_t ZE_APICALL
zesFrequencyGetAvailableClocks(zes_freq_handle_t hFrequency,uint32_t * pCount,double * phFrequency)1272 zesFrequencyGetAvailableClocks(
1273 zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device.
1274 uint32_t* pCount, ///< [in,out] pointer to the number of frequencies.
1275 ///< if count is zero, then the driver shall update the value with the
1276 ///< total number of frequencies that are available.
1277 ///< if count is greater than the number of frequencies that are available,
1278 ///< then the driver shall update the value with the correct number of frequencies.
1279 double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of
1280 ///< MHz and sorted from slowest to fastest.
1281 ///< if count is less than the number of frequencies that are available,
1282 ///< then the driver shall only retrieve that number of frequencies.
1283 )
1284 {
1285 auto pfnGetAvailableClocks = ze_lib::context->zesDdiTable.Frequency.pfnGetAvailableClocks;
1286 if( nullptr == pfnGetAvailableClocks )
1287 return ZE_RESULT_ERROR_UNINITIALIZED;
1288
1289 return pfnGetAvailableClocks( hFrequency, pCount, phFrequency );
1290 }
1291
1292 ///////////////////////////////////////////////////////////////////////////////
1293 /// @brief Get current frequency limits
1294 ///
1295 /// @details
1296 /// - The application may call this function from simultaneous threads.
1297 /// - The implementation of this function should be lock-free.
1298 ///
1299 /// @returns
1300 /// - ::ZE_RESULT_SUCCESS
1301 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1302 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1303 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1304 /// + `nullptr == hFrequency`
1305 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1306 /// + `nullptr == pLimits`
1307 ze_result_t ZE_APICALL
zesFrequencyGetRange(zes_freq_handle_t hFrequency,zes_freq_range_t * pLimits)1308 zesFrequencyGetRange(
1309 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1310 zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the
1311 ///< specified domain.
1312 )
1313 {
1314 auto pfnGetRange = ze_lib::context->zesDdiTable.Frequency.pfnGetRange;
1315 if( nullptr == pfnGetRange )
1316 return ZE_RESULT_ERROR_UNINITIALIZED;
1317
1318 return pfnGetRange( hFrequency, pLimits );
1319 }
1320
1321 ///////////////////////////////////////////////////////////////////////////////
1322 /// @brief Set frequency range between which the hardware can operate.
1323 ///
1324 /// @details
1325 /// - The application may call this function from simultaneous threads.
1326 /// - The implementation of this function should be lock-free.
1327 ///
1328 /// @returns
1329 /// - ::ZE_RESULT_SUCCESS
1330 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1331 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1332 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1333 /// + `nullptr == hFrequency`
1334 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1335 /// + `nullptr == pLimits`
1336 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1337 /// + User does not have permissions to make these modifications.
1338 ze_result_t ZE_APICALL
zesFrequencySetRange(zes_freq_handle_t hFrequency,const zes_freq_range_t * pLimits)1339 zesFrequencySetRange(
1340 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1341 const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the
1342 ///< specified domain.
1343 )
1344 {
1345 auto pfnSetRange = ze_lib::context->zesDdiTable.Frequency.pfnSetRange;
1346 if( nullptr == pfnSetRange )
1347 return ZE_RESULT_ERROR_UNINITIALIZED;
1348
1349 return pfnSetRange( hFrequency, pLimits );
1350 }
1351
1352 ///////////////////////////////////////////////////////////////////////////////
1353 /// @brief Get current frequency state - frequency request, actual frequency, TDP
1354 /// limits
1355 ///
1356 /// @details
1357 /// - The application may call this function from simultaneous threads.
1358 /// - The implementation of this function should be lock-free.
1359 ///
1360 /// @returns
1361 /// - ::ZE_RESULT_SUCCESS
1362 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1363 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1364 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1365 /// + `nullptr == hFrequency`
1366 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1367 /// + `nullptr == pState`
1368 ze_result_t ZE_APICALL
zesFrequencyGetState(zes_freq_handle_t hFrequency,zes_freq_state_t * pState)1369 zesFrequencyGetState(
1370 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1371 zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain.
1372 )
1373 {
1374 auto pfnGetState = ze_lib::context->zesDdiTable.Frequency.pfnGetState;
1375 if( nullptr == pfnGetState )
1376 return ZE_RESULT_ERROR_UNINITIALIZED;
1377
1378 return pfnGetState( hFrequency, pState );
1379 }
1380
1381 ///////////////////////////////////////////////////////////////////////////////
1382 /// @brief Get frequency throttle time
1383 ///
1384 /// @details
1385 /// - The application may call this function from simultaneous threads.
1386 /// - The implementation of this function should be lock-free.
1387 ///
1388 /// @returns
1389 /// - ::ZE_RESULT_SUCCESS
1390 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1391 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1392 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1393 /// + `nullptr == hFrequency`
1394 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1395 /// + `nullptr == pThrottleTime`
1396 ze_result_t ZE_APICALL
zesFrequencyGetThrottleTime(zes_freq_handle_t hFrequency,zes_freq_throttle_time_t * pThrottleTime)1397 zesFrequencyGetThrottleTime(
1398 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1399 zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the
1400 ///< specified domain.
1401 )
1402 {
1403 auto pfnGetThrottleTime = ze_lib::context->zesDdiTable.Frequency.pfnGetThrottleTime;
1404 if( nullptr == pfnGetThrottleTime )
1405 return ZE_RESULT_ERROR_UNINITIALIZED;
1406
1407 return pfnGetThrottleTime( hFrequency, pThrottleTime );
1408 }
1409
1410 ///////////////////////////////////////////////////////////////////////////////
1411 /// @brief Get the overclocking capabilities.
1412 ///
1413 /// @details
1414 /// - The application may call this function from simultaneous threads.
1415 /// - The implementation of this function should be lock-free.
1416 ///
1417 /// @returns
1418 /// - ::ZE_RESULT_SUCCESS
1419 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1420 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1421 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1422 /// + `nullptr == hFrequency`
1423 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1424 /// + `nullptr == pOcCapabilities`
1425 ze_result_t ZE_APICALL
zesFrequencyOcGetCapabilities(zes_freq_handle_t hFrequency,zes_oc_capabilities_t * pOcCapabilities)1426 zesFrequencyOcGetCapabilities(
1427 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1428 zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure
1429 ///< ::zes_oc_capabilities_t.
1430 )
1431 {
1432 auto pfnOcGetCapabilities = ze_lib::context->zesDdiTable.Frequency.pfnOcGetCapabilities;
1433 if( nullptr == pfnOcGetCapabilities )
1434 return ZE_RESULT_ERROR_UNINITIALIZED;
1435
1436 return pfnOcGetCapabilities( hFrequency, pOcCapabilities );
1437 }
1438
1439 ///////////////////////////////////////////////////////////////////////////////
1440 /// @brief Get the current overclocking frequency target, if extended moded is
1441 /// supported, will returned in 1 Mhz granularity.
1442 ///
1443 /// @details
1444 /// - The application may call this function from simultaneous threads.
1445 /// - The implementation of this function should be lock-free.
1446 ///
1447 /// @returns
1448 /// - ::ZE_RESULT_SUCCESS
1449 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1450 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1451 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1452 /// + `nullptr == hFrequency`
1453 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1454 /// + `nullptr == pCurrentOcFrequency`
1455 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1456 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1457 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1458 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1459 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1460 /// + Overclocking feature is locked on this frequency domain
1461 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1462 /// + User does not have permissions to make these modifications.
1463 ze_result_t ZE_APICALL
zesFrequencyOcGetFrequencyTarget(zes_freq_handle_t hFrequency,double * pCurrentOcFrequency)1464 zesFrequencyOcGetFrequencyTarget(
1465 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1466 double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported,
1467 ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This
1468 ///< cannot be greater than ::zes_oc_capabilities_t.maxOcFrequency.
1469 )
1470 {
1471 auto pfnOcGetFrequencyTarget = ze_lib::context->zesDdiTable.Frequency.pfnOcGetFrequencyTarget;
1472 if( nullptr == pfnOcGetFrequencyTarget )
1473 return ZE_RESULT_ERROR_UNINITIALIZED;
1474
1475 return pfnOcGetFrequencyTarget( hFrequency, pCurrentOcFrequency );
1476 }
1477
1478 ///////////////////////////////////////////////////////////////////////////////
1479 /// @brief Set the current overclocking frequency target, if extended moded is
1480 /// supported, can be set in 1 Mhz granularity.
1481 ///
1482 /// @details
1483 /// - The application may call this function from simultaneous threads.
1484 /// - The implementation of this function should be lock-free.
1485 ///
1486 /// @returns
1487 /// - ::ZE_RESULT_SUCCESS
1488 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1489 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1490 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1491 /// + `nullptr == hFrequency`
1492 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1493 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1494 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1495 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1496 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1497 /// + Overclocking feature is locked on this frequency domain
1498 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1499 /// + User does not have permissions to make these modifications.
1500 ze_result_t ZE_APICALL
zesFrequencyOcSetFrequencyTarget(zes_freq_handle_t hFrequency,double CurrentOcFrequency)1501 zesFrequencyOcSetFrequencyTarget(
1502 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1503 double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it
1504 ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This
1505 ///< cannot be greater than ::zes_oc_capabilities_t.maxOcFrequency.
1506 )
1507 {
1508 auto pfnOcSetFrequencyTarget = ze_lib::context->zesDdiTable.Frequency.pfnOcSetFrequencyTarget;
1509 if( nullptr == pfnOcSetFrequencyTarget )
1510 return ZE_RESULT_ERROR_UNINITIALIZED;
1511
1512 return pfnOcSetFrequencyTarget( hFrequency, CurrentOcFrequency );
1513 }
1514
1515 ///////////////////////////////////////////////////////////////////////////////
1516 /// @brief Get the current overclocking voltage settings.
1517 ///
1518 /// @details
1519 /// - The application may call this function from simultaneous threads.
1520 /// - The implementation of this function should be lock-free.
1521 ///
1522 /// @returns
1523 /// - ::ZE_RESULT_SUCCESS
1524 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1525 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1526 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1527 /// + `nullptr == hFrequency`
1528 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1529 /// + `nullptr == pCurrentVoltageTarget`
1530 /// + `nullptr == pCurrentVoltageOffset`
1531 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1532 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1533 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1534 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1535 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1536 /// + Overclocking feature is locked on this frequency domain
1537 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1538 /// + User does not have permissions to make these modifications.
1539 ze_result_t ZE_APICALL
zesFrequencyOcGetVoltageTarget(zes_freq_handle_t hFrequency,double * pCurrentVoltageTarget,double * pCurrentVoltageOffset)1540 zesFrequencyOcGetVoltageTarget(
1541 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1542 double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than
1543 ///< ::zes_oc_capabilities_t.maxOcVoltage.
1544 double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the
1545 ///< voltage/frequency curve, include the new overclock voltageTarget. It
1546 ///< can be in the range (::zes_oc_capabilities_t.minOcVoltageOffset,
1547 ///< ::zes_oc_capabilities_t.maxOcVoltageOffset).
1548 )
1549 {
1550 auto pfnOcGetVoltageTarget = ze_lib::context->zesDdiTable.Frequency.pfnOcGetVoltageTarget;
1551 if( nullptr == pfnOcGetVoltageTarget )
1552 return ZE_RESULT_ERROR_UNINITIALIZED;
1553
1554 return pfnOcGetVoltageTarget( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset );
1555 }
1556
1557 ///////////////////////////////////////////////////////////////////////////////
1558 /// @brief Set the current overclocking voltage settings.
1559 ///
1560 /// @details
1561 /// - The application may call this function from simultaneous threads.
1562 /// - The implementation of this function should be lock-free.
1563 ///
1564 /// @returns
1565 /// - ::ZE_RESULT_SUCCESS
1566 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1567 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1568 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1569 /// + `nullptr == hFrequency`
1570 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1571 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1572 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1573 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1574 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1575 /// + Overclocking feature is locked on this frequency domain
1576 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1577 /// + User does not have permissions to make these modifications.
1578 ze_result_t ZE_APICALL
zesFrequencyOcSetVoltageTarget(zes_freq_handle_t hFrequency,double CurrentVoltageTarget,double CurrentVoltageOffset)1579 zesFrequencyOcSetVoltageTarget(
1580 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1581 double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than
1582 ///< ::zes_oc_capabilities_t.maxOcVoltage.
1583 double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the
1584 ///< voltage/frequency curve, include the new overclock voltageTarget. It
1585 ///< can be in the range (::zes_oc_capabilities_t.minOcVoltageOffset,
1586 ///< ::zes_oc_capabilities_t.maxOcVoltageOffset).
1587 )
1588 {
1589 auto pfnOcSetVoltageTarget = ze_lib::context->zesDdiTable.Frequency.pfnOcSetVoltageTarget;
1590 if( nullptr == pfnOcSetVoltageTarget )
1591 return ZE_RESULT_ERROR_UNINITIALIZED;
1592
1593 return pfnOcSetVoltageTarget( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset );
1594 }
1595
1596 ///////////////////////////////////////////////////////////////////////////////
1597 /// @brief Set the current overclocking mode.
1598 ///
1599 /// @details
1600 /// - The application may call this function from simultaneous threads.
1601 /// - The implementation of this function should be lock-free.
1602 ///
1603 /// @returns
1604 /// - ::ZE_RESULT_SUCCESS
1605 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1606 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1607 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1608 /// + `nullptr == hFrequency`
1609 /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
1610 /// + `::ZES_OC_MODE_FIXED < CurrentOcMode`
1611 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1612 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1613 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1614 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1615 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1616 /// + Overclocking feature is locked on this frequency domain
1617 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1618 /// + User does not have permissions to make these modifications.
1619 ze_result_t ZE_APICALL
zesFrequencyOcSetMode(zes_freq_handle_t hFrequency,zes_oc_mode_t CurrentOcMode)1620 zesFrequencyOcSetMode(
1621 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1622 zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t.
1623 )
1624 {
1625 auto pfnOcSetMode = ze_lib::context->zesDdiTable.Frequency.pfnOcSetMode;
1626 if( nullptr == pfnOcSetMode )
1627 return ZE_RESULT_ERROR_UNINITIALIZED;
1628
1629 return pfnOcSetMode( hFrequency, CurrentOcMode );
1630 }
1631
1632 ///////////////////////////////////////////////////////////////////////////////
1633 /// @brief Get the current overclocking mode.
1634 ///
1635 /// @details
1636 /// - The application may call this function from simultaneous threads.
1637 /// - The implementation of this function should be lock-free.
1638 ///
1639 /// @returns
1640 /// - ::ZE_RESULT_SUCCESS
1641 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1642 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1643 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1644 /// + `nullptr == hFrequency`
1645 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1646 /// + `nullptr == pCurrentOcMode`
1647 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1648 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1649 /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset).
1650 /// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device.
1651 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1652 /// + Overclocking feature is locked on this frequency domain
1653 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1654 /// + User does not have permissions to make these modifications.
1655 ze_result_t ZE_APICALL
zesFrequencyOcGetMode(zes_freq_handle_t hFrequency,zes_oc_mode_t * pCurrentOcMode)1656 zesFrequencyOcGetMode(
1657 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1658 zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t.
1659 )
1660 {
1661 auto pfnOcGetMode = ze_lib::context->zesDdiTable.Frequency.pfnOcGetMode;
1662 if( nullptr == pfnOcGetMode )
1663 return ZE_RESULT_ERROR_UNINITIALIZED;
1664
1665 return pfnOcGetMode( hFrequency, pCurrentOcMode );
1666 }
1667
1668 ///////////////////////////////////////////////////////////////////////////////
1669 /// @brief Get the maximum current limit setting.
1670 ///
1671 /// @details
1672 /// - The application may call this function from simultaneous threads.
1673 /// - The implementation of this function should be lock-free.
1674 ///
1675 /// @returns
1676 /// - ::ZE_RESULT_SUCCESS
1677 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1678 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1679 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1680 /// + `nullptr == hFrequency`
1681 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1682 /// + `nullptr == pOcIccMax`
1683 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1684 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1685 /// + Capability ::zes_oc_capabilities_t.isIccMaxSupported is false for this frequency domain
1686 ze_result_t ZE_APICALL
zesFrequencyOcGetIccMax(zes_freq_handle_t hFrequency,double * pOcIccMax)1687 zesFrequencyOcGetIccMax(
1688 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1689 double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on
1690 ///< successful return.
1691 )
1692 {
1693 auto pfnOcGetIccMax = ze_lib::context->zesDdiTable.Frequency.pfnOcGetIccMax;
1694 if( nullptr == pfnOcGetIccMax )
1695 return ZE_RESULT_ERROR_UNINITIALIZED;
1696
1697 return pfnOcGetIccMax( hFrequency, pOcIccMax );
1698 }
1699
1700 ///////////////////////////////////////////////////////////////////////////////
1701 /// @brief Change the maximum current limit setting.
1702 ///
1703 /// @details
1704 /// - Setting ocIccMax to 0.0 will return the value to the factory default.
1705 /// - The application may call this function from simultaneous threads.
1706 /// - The implementation of this function should be lock-free.
1707 ///
1708 /// @returns
1709 /// - ::ZE_RESULT_SUCCESS
1710 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1711 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1712 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1713 /// + `nullptr == hFrequency`
1714 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1715 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1716 /// + Capability ::zes_oc_capabilities_t.isIccMaxSupported is false for this frequency domain
1717 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1718 /// + Overclocking feature is locked on this frequency domain
1719 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
1720 /// + The specified current limit is too low or too high
1721 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1722 /// + User does not have permissions to make these modifications.
1723 ze_result_t ZE_APICALL
zesFrequencyOcSetIccMax(zes_freq_handle_t hFrequency,double ocIccMax)1724 zesFrequencyOcSetIccMax(
1725 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1726 double ocIccMax ///< [in] The new maximum current limit in Amperes.
1727 )
1728 {
1729 auto pfnOcSetIccMax = ze_lib::context->zesDdiTable.Frequency.pfnOcSetIccMax;
1730 if( nullptr == pfnOcSetIccMax )
1731 return ZE_RESULT_ERROR_UNINITIALIZED;
1732
1733 return pfnOcSetIccMax( hFrequency, ocIccMax );
1734 }
1735
1736 ///////////////////////////////////////////////////////////////////////////////
1737 /// @brief Get the maximum temperature limit setting.
1738 ///
1739 /// @details
1740 /// - The application may call this function from simultaneous threads.
1741 /// - The implementation of this function should be lock-free.
1742 ///
1743 /// @returns
1744 /// - ::ZE_RESULT_SUCCESS
1745 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1746 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1747 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1748 /// + `nullptr == hFrequency`
1749 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1750 /// + `nullptr == pOcTjMax`
1751 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1752 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1753 ze_result_t ZE_APICALL
zesFrequencyOcGetTjMax(zes_freq_handle_t hFrequency,double * pOcTjMax)1754 zesFrequencyOcGetTjMax(
1755 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1756 double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius
1757 ///< on successful return.
1758 )
1759 {
1760 auto pfnOcGetTjMax = ze_lib::context->zesDdiTable.Frequency.pfnOcGetTjMax;
1761 if( nullptr == pfnOcGetTjMax )
1762 return ZE_RESULT_ERROR_UNINITIALIZED;
1763
1764 return pfnOcGetTjMax( hFrequency, pOcTjMax );
1765 }
1766
1767 ///////////////////////////////////////////////////////////////////////////////
1768 /// @brief Change the maximum temperature limit setting.
1769 ///
1770 /// @details
1771 /// - Setting ocTjMax to 0.0 will return the value to the factory default.
1772 /// - The application may call this function from simultaneous threads.
1773 /// - The implementation of this function should be lock-free.
1774 ///
1775 /// @returns
1776 /// - ::ZE_RESULT_SUCCESS
1777 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1778 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1779 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1780 /// + `nullptr == hFrequency`
1781 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1782 /// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported)
1783 /// + Capability ::zes_oc_capabilities_t.isTjMaxSupported is false for this frequency domain
1784 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
1785 /// + Overclocking feature is locked on this frequency domain
1786 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
1787 /// + The specified temperature limit is too high
1788 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1789 /// + User does not have permissions to make these modifications.
1790 ze_result_t ZE_APICALL
zesFrequencyOcSetTjMax(zes_freq_handle_t hFrequency,double ocTjMax)1791 zesFrequencyOcSetTjMax(
1792 zes_freq_handle_t hFrequency, ///< [in] Handle for the component.
1793 double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius.
1794 )
1795 {
1796 auto pfnOcSetTjMax = ze_lib::context->zesDdiTable.Frequency.pfnOcSetTjMax;
1797 if( nullptr == pfnOcSetTjMax )
1798 return ZE_RESULT_ERROR_UNINITIALIZED;
1799
1800 return pfnOcSetTjMax( hFrequency, ocTjMax );
1801 }
1802
1803 ///////////////////////////////////////////////////////////////////////////////
1804 /// @brief Get handle of LEDs
1805 ///
1806 /// @details
1807 /// - The application may call this function from simultaneous threads.
1808 /// - The implementation of this function should be lock-free.
1809 ///
1810 /// @returns
1811 /// - ::ZE_RESULT_SUCCESS
1812 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1813 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1814 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1815 /// + `nullptr == hDevice`
1816 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1817 /// + `nullptr == pCount`
1818 ze_result_t ZE_APICALL
zesDeviceEnumLeds(zes_device_handle_t hDevice,uint32_t * pCount,zes_led_handle_t * phLed)1819 zesDeviceEnumLeds(
1820 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
1821 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
1822 ///< if count is zero, then the driver shall update the value with the
1823 ///< total number of components of this type that are available.
1824 ///< if count is greater than the number of components of this type that
1825 ///< are available, then the driver shall update the value with the correct
1826 ///< number of components.
1827 zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of
1828 ///< this type.
1829 ///< if count is less than the number of components of this type that are
1830 ///< available, then the driver shall only retrieve that number of
1831 ///< component handles.
1832 )
1833 {
1834 auto pfnEnumLeds = ze_lib::context->zesDdiTable.Device.pfnEnumLeds;
1835 if( nullptr == pfnEnumLeds )
1836 return ZE_RESULT_ERROR_UNINITIALIZED;
1837
1838 return pfnEnumLeds( hDevice, pCount, phLed );
1839 }
1840
1841 ///////////////////////////////////////////////////////////////////////////////
1842 /// @brief Get LED properties
1843 ///
1844 /// @details
1845 /// - The application may call this function from simultaneous threads.
1846 /// - The implementation of this function should be lock-free.
1847 ///
1848 /// @returns
1849 /// - ::ZE_RESULT_SUCCESS
1850 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1851 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1852 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1853 /// + `nullptr == hLed`
1854 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1855 /// + `nullptr == pProperties`
1856 ze_result_t ZE_APICALL
zesLedGetProperties(zes_led_handle_t hLed,zes_led_properties_t * pProperties)1857 zesLedGetProperties(
1858 zes_led_handle_t hLed, ///< [in] Handle for the component.
1859 zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED.
1860 )
1861 {
1862 auto pfnGetProperties = ze_lib::context->zesDdiTable.Led.pfnGetProperties;
1863 if( nullptr == pfnGetProperties )
1864 return ZE_RESULT_ERROR_UNINITIALIZED;
1865
1866 return pfnGetProperties( hLed, pProperties );
1867 }
1868
1869 ///////////////////////////////////////////////////////////////////////////////
1870 /// @brief Get current state of a LED - on/off, color
1871 ///
1872 /// @details
1873 /// - The application may call this function from simultaneous threads.
1874 /// - The implementation of this function should be lock-free.
1875 ///
1876 /// @returns
1877 /// - ::ZE_RESULT_SUCCESS
1878 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1879 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1880 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1881 /// + `nullptr == hLed`
1882 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1883 /// + `nullptr == pState`
1884 ze_result_t ZE_APICALL
zesLedGetState(zes_led_handle_t hLed,zes_led_state_t * pState)1885 zesLedGetState(
1886 zes_led_handle_t hLed, ///< [in] Handle for the component.
1887 zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED.
1888 )
1889 {
1890 auto pfnGetState = ze_lib::context->zesDdiTable.Led.pfnGetState;
1891 if( nullptr == pfnGetState )
1892 return ZE_RESULT_ERROR_UNINITIALIZED;
1893
1894 return pfnGetState( hLed, pState );
1895 }
1896
1897 ///////////////////////////////////////////////////////////////////////////////
1898 /// @brief Turn the LED on/off
1899 ///
1900 /// @details
1901 /// - The application may call this function from simultaneous threads.
1902 /// - The implementation of this function should be lock-free.
1903 ///
1904 /// @returns
1905 /// - ::ZE_RESULT_SUCCESS
1906 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1907 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1908 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1909 /// + `nullptr == hLed`
1910 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1911 /// + User does not have permissions to make these modifications.
1912 ze_result_t ZE_APICALL
zesLedSetState(zes_led_handle_t hLed,ze_bool_t enable)1913 zesLedSetState(
1914 zes_led_handle_t hLed, ///< [in] Handle for the component.
1915 ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off.
1916 )
1917 {
1918 auto pfnSetState = ze_lib::context->zesDdiTable.Led.pfnSetState;
1919 if( nullptr == pfnSetState )
1920 return ZE_RESULT_ERROR_UNINITIALIZED;
1921
1922 return pfnSetState( hLed, enable );
1923 }
1924
1925 ///////////////////////////////////////////////////////////////////////////////
1926 /// @brief Set the color of the LED
1927 ///
1928 /// @details
1929 /// - The application may call this function from simultaneous threads.
1930 /// - The implementation of this function should be lock-free.
1931 ///
1932 /// @returns
1933 /// - ::ZE_RESULT_SUCCESS
1934 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1935 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1936 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1937 /// + `nullptr == hLed`
1938 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1939 /// + `nullptr == pColor`
1940 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
1941 /// + User does not have permissions to make these modifications.
1942 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
1943 /// + This LED doesn't not support color changes. See ::zes_led_properties_t.haveRGB.
1944 ze_result_t ZE_APICALL
zesLedSetColor(zes_led_handle_t hLed,const zes_led_color_t * pColor)1945 zesLedSetColor(
1946 zes_led_handle_t hLed, ///< [in] Handle for the component.
1947 const zes_led_color_t* pColor ///< [in] New color of the LED.
1948 )
1949 {
1950 auto pfnSetColor = ze_lib::context->zesDdiTable.Led.pfnSetColor;
1951 if( nullptr == pfnSetColor )
1952 return ZE_RESULT_ERROR_UNINITIALIZED;
1953
1954 return pfnSetColor( hLed, pColor );
1955 }
1956
1957 ///////////////////////////////////////////////////////////////////////////////
1958 /// @brief Get handle of memory modules
1959 ///
1960 /// @details
1961 /// - The application may call this function from simultaneous threads.
1962 /// - The implementation of this function should be lock-free.
1963 ///
1964 /// @returns
1965 /// - ::ZE_RESULT_SUCCESS
1966 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
1967 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
1968 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
1969 /// + `nullptr == hDevice`
1970 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
1971 /// + `nullptr == pCount`
1972 ze_result_t ZE_APICALL
zesDeviceEnumMemoryModules(zes_device_handle_t hDevice,uint32_t * pCount,zes_mem_handle_t * phMemory)1973 zesDeviceEnumMemoryModules(
1974 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
1975 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
1976 ///< if count is zero, then the driver shall update the value with the
1977 ///< total number of components of this type that are available.
1978 ///< if count is greater than the number of components of this type that
1979 ///< are available, then the driver shall update the value with the correct
1980 ///< number of components.
1981 zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of
1982 ///< this type.
1983 ///< if count is less than the number of components of this type that are
1984 ///< available, then the driver shall only retrieve that number of
1985 ///< component handles.
1986 )
1987 {
1988 auto pfnEnumMemoryModules = ze_lib::context->zesDdiTable.Device.pfnEnumMemoryModules;
1989 if( nullptr == pfnEnumMemoryModules )
1990 return ZE_RESULT_ERROR_UNINITIALIZED;
1991
1992 return pfnEnumMemoryModules( hDevice, pCount, phMemory );
1993 }
1994
1995 ///////////////////////////////////////////////////////////////////////////////
1996 /// @brief Get memory properties
1997 ///
1998 /// @details
1999 /// - The application may call this function from simultaneous threads.
2000 /// - The implementation of this function should be lock-free.
2001 ///
2002 /// @returns
2003 /// - ::ZE_RESULT_SUCCESS
2004 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2005 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2006 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2007 /// + `nullptr == hMemory`
2008 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2009 /// + `nullptr == pProperties`
2010 ze_result_t ZE_APICALL
zesMemoryGetProperties(zes_mem_handle_t hMemory,zes_mem_properties_t * pProperties)2011 zesMemoryGetProperties(
2012 zes_mem_handle_t hMemory, ///< [in] Handle for the component.
2013 zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties.
2014 )
2015 {
2016 auto pfnGetProperties = ze_lib::context->zesDdiTable.Memory.pfnGetProperties;
2017 if( nullptr == pfnGetProperties )
2018 return ZE_RESULT_ERROR_UNINITIALIZED;
2019
2020 return pfnGetProperties( hMemory, pProperties );
2021 }
2022
2023 ///////////////////////////////////////////////////////////////////////////////
2024 /// @brief Get memory state - health, allocated
2025 ///
2026 /// @details
2027 /// - The application may call this function from simultaneous threads.
2028 /// - The implementation of this function should be lock-free.
2029 ///
2030 /// @returns
2031 /// - ::ZE_RESULT_SUCCESS
2032 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2033 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2034 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2035 /// + `nullptr == hMemory`
2036 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2037 /// + `nullptr == pState`
2038 ze_result_t ZE_APICALL
zesMemoryGetState(zes_mem_handle_t hMemory,zes_mem_state_t * pState)2039 zesMemoryGetState(
2040 zes_mem_handle_t hMemory, ///< [in] Handle for the component.
2041 zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory.
2042 )
2043 {
2044 auto pfnGetState = ze_lib::context->zesDdiTable.Memory.pfnGetState;
2045 if( nullptr == pfnGetState )
2046 return ZE_RESULT_ERROR_UNINITIALIZED;
2047
2048 return pfnGetState( hMemory, pState );
2049 }
2050
2051 ///////////////////////////////////////////////////////////////////////////////
2052 /// @brief Get memory bandwidth
2053 ///
2054 /// @details
2055 /// - The application may call this function from simultaneous threads.
2056 /// - The implementation of this function should be lock-free.
2057 ///
2058 /// @returns
2059 /// - ::ZE_RESULT_SUCCESS
2060 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2061 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2062 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2063 /// + `nullptr == hMemory`
2064 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2065 /// + `nullptr == pBandwidth`
2066 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2067 /// + User does not have permissions to query this telemetry.
2068 ze_result_t ZE_APICALL
zesMemoryGetBandwidth(zes_mem_handle_t hMemory,zes_mem_bandwidth_t * pBandwidth)2069 zesMemoryGetBandwidth(
2070 zes_mem_handle_t hMemory, ///< [in] Handle for the component.
2071 zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the current health, free memory, total memory
2072 ///< size.
2073 )
2074 {
2075 auto pfnGetBandwidth = ze_lib::context->zesDdiTable.Memory.pfnGetBandwidth;
2076 if( nullptr == pfnGetBandwidth )
2077 return ZE_RESULT_ERROR_UNINITIALIZED;
2078
2079 return pfnGetBandwidth( hMemory, pBandwidth );
2080 }
2081
2082 ///////////////////////////////////////////////////////////////////////////////
2083 /// @brief Get handles to accelerator domains whose performance can be optimized
2084 /// via a Performance Factor
2085 ///
2086 /// @details
2087 /// - A Performance Factor should be tuned for each workload.
2088 /// - The application may call this function from simultaneous threads.
2089 /// - The implementation of this function should be lock-free.
2090 ///
2091 /// @returns
2092 /// - ::ZE_RESULT_SUCCESS
2093 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2094 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2095 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2096 /// + `nullptr == hDevice`
2097 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2098 /// + `nullptr == pCount`
2099 ze_result_t ZE_APICALL
zesDeviceEnumPerformanceFactorDomains(zes_device_handle_t hDevice,uint32_t * pCount,zes_perf_handle_t * phPerf)2100 zesDeviceEnumPerformanceFactorDomains(
2101 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2102 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
2103 ///< if count is zero, then the driver shall update the value with the
2104 ///< total number of components of this type that are available.
2105 ///< if count is greater than the number of components of this type that
2106 ///< are available, then the driver shall update the value with the correct
2107 ///< number of components.
2108 zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of
2109 ///< this type.
2110 ///< if count is less than the number of components of this type that are
2111 ///< available, then the driver shall only retrieve that number of
2112 ///< component handles.
2113 )
2114 {
2115 auto pfnEnumPerformanceFactorDomains = ze_lib::context->zesDdiTable.Device.pfnEnumPerformanceFactorDomains;
2116 if( nullptr == pfnEnumPerformanceFactorDomains )
2117 return ZE_RESULT_ERROR_UNINITIALIZED;
2118
2119 return pfnEnumPerformanceFactorDomains( hDevice, pCount, phPerf );
2120 }
2121
2122 ///////////////////////////////////////////////////////////////////////////////
2123 /// @brief Get properties about a Performance Factor domain
2124 ///
2125 /// @details
2126 /// - The application may call this function from simultaneous threads.
2127 /// - The implementation of this function should be lock-free.
2128 ///
2129 /// @returns
2130 /// - ::ZE_RESULT_SUCCESS
2131 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2132 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2133 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2134 /// + `nullptr == hPerf`
2135 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2136 /// + `nullptr == pProperties`
2137 ze_result_t ZE_APICALL
zesPerformanceFactorGetProperties(zes_perf_handle_t hPerf,zes_perf_properties_t * pProperties)2138 zesPerformanceFactorGetProperties(
2139 zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain.
2140 zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance
2141 ///< Factor domain.
2142 )
2143 {
2144 auto pfnGetProperties = ze_lib::context->zesDdiTable.PerformanceFactor.pfnGetProperties;
2145 if( nullptr == pfnGetProperties )
2146 return ZE_RESULT_ERROR_UNINITIALIZED;
2147
2148 return pfnGetProperties( hPerf, pProperties );
2149 }
2150
2151 ///////////////////////////////////////////////////////////////////////////////
2152 /// @brief Get current Performance Factor for a given domain
2153 ///
2154 /// @details
2155 /// - The application may call this function from simultaneous threads.
2156 /// - The implementation of this function should be lock-free.
2157 ///
2158 /// @returns
2159 /// - ::ZE_RESULT_SUCCESS
2160 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2161 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2162 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2163 /// + `nullptr == hPerf`
2164 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2165 /// + `nullptr == pFactor`
2166 ze_result_t ZE_APICALL
zesPerformanceFactorGetConfig(zes_perf_handle_t hPerf,double * pFactor)2167 zesPerformanceFactorGetConfig(
2168 zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain.
2169 double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the
2170 ///< hardware (may not be the same as the requested Performance Factor).
2171 )
2172 {
2173 auto pfnGetConfig = ze_lib::context->zesDdiTable.PerformanceFactor.pfnGetConfig;
2174 if( nullptr == pfnGetConfig )
2175 return ZE_RESULT_ERROR_UNINITIALIZED;
2176
2177 return pfnGetConfig( hPerf, pFactor );
2178 }
2179
2180 ///////////////////////////////////////////////////////////////////////////////
2181 /// @brief Change the performance factor for a domain
2182 ///
2183 /// @details
2184 /// - The Performance Factor is a number between 0 and 100.
2185 /// - A Performance Factor is a hint to the hardware. Depending on the
2186 /// hardware, the request may not be granted. Follow up this function with
2187 /// a call to ::zesPerformanceFactorGetConfig() to determine the actual
2188 /// factor being used by the hardware.
2189 /// - The application may call this function from simultaneous threads.
2190 /// - The implementation of this function should be lock-free.
2191 ///
2192 /// @returns
2193 /// - ::ZE_RESULT_SUCCESS
2194 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2195 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2196 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2197 /// + `nullptr == hPerf`
2198 ze_result_t ZE_APICALL
zesPerformanceFactorSetConfig(zes_perf_handle_t hPerf,double factor)2199 zesPerformanceFactorSetConfig(
2200 zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain.
2201 double factor ///< [in] The new Performance Factor.
2202 )
2203 {
2204 auto pfnSetConfig = ze_lib::context->zesDdiTable.PerformanceFactor.pfnSetConfig;
2205 if( nullptr == pfnSetConfig )
2206 return ZE_RESULT_ERROR_UNINITIALIZED;
2207
2208 return pfnSetConfig( hPerf, factor );
2209 }
2210
2211 ///////////////////////////////////////////////////////////////////////////////
2212 /// @brief Get handle of power domains
2213 ///
2214 /// @details
2215 /// - The application may call this function from simultaneous threads.
2216 /// - The implementation of this function should be lock-free.
2217 ///
2218 /// @returns
2219 /// - ::ZE_RESULT_SUCCESS
2220 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2221 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2222 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2223 /// + `nullptr == hDevice`
2224 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2225 /// + `nullptr == pCount`
2226 ze_result_t ZE_APICALL
zesDeviceEnumPowerDomains(zes_device_handle_t hDevice,uint32_t * pCount,zes_pwr_handle_t * phPower)2227 zesDeviceEnumPowerDomains(
2228 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2229 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
2230 ///< if count is zero, then the driver shall update the value with the
2231 ///< total number of components of this type that are available.
2232 ///< if count is greater than the number of components of this type that
2233 ///< are available, then the driver shall update the value with the correct
2234 ///< number of components.
2235 zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of
2236 ///< this type.
2237 ///< if count is less than the number of components of this type that are
2238 ///< available, then the driver shall only retrieve that number of
2239 ///< component handles.
2240 )
2241 {
2242 auto pfnEnumPowerDomains = ze_lib::context->zesDdiTable.Device.pfnEnumPowerDomains;
2243 if( nullptr == pfnEnumPowerDomains )
2244 return ZE_RESULT_ERROR_UNINITIALIZED;
2245
2246 return pfnEnumPowerDomains( hDevice, pCount, phPower );
2247 }
2248
2249 ///////////////////////////////////////////////////////////////////////////////
2250 /// @brief Get handle of the PCIe card-level power
2251 ///
2252 /// @details
2253 /// - The application may call this function from simultaneous threads.
2254 /// - The implementation of this function should be lock-free.
2255 ///
2256 /// @returns
2257 /// - ::ZE_RESULT_SUCCESS
2258 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2259 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2260 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2261 /// + `nullptr == hDevice`
2262 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2263 /// + `nullptr == phPower`
2264 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2265 /// + The device does not provide access to card level power controls or telemetry. An invalid power domain handle will be returned in phPower.
2266 ze_result_t ZE_APICALL
zesDeviceGetCardPowerDomain(zes_device_handle_t hDevice,zes_pwr_handle_t * phPower)2267 zesDeviceGetCardPowerDomain(
2268 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2269 zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card.
2270 )
2271 {
2272 auto pfnGetCardPowerDomain = ze_lib::context->zesDdiTable.Device.pfnGetCardPowerDomain;
2273 if( nullptr == pfnGetCardPowerDomain )
2274 return ZE_RESULT_ERROR_UNINITIALIZED;
2275
2276 return pfnGetCardPowerDomain( hDevice, phPower );
2277 }
2278
2279 ///////////////////////////////////////////////////////////////////////////////
2280 /// @brief Get properties related to a power domain
2281 ///
2282 /// @details
2283 /// - The application may call this function from simultaneous threads.
2284 /// - The implementation of this function should be lock-free.
2285 ///
2286 /// @returns
2287 /// - ::ZE_RESULT_SUCCESS
2288 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2289 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2290 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2291 /// + `nullptr == hPower`
2292 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2293 /// + `nullptr == pProperties`
2294 ze_result_t ZE_APICALL
zesPowerGetProperties(zes_pwr_handle_t hPower,zes_power_properties_t * pProperties)2295 zesPowerGetProperties(
2296 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2297 zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data.
2298 )
2299 {
2300 auto pfnGetProperties = ze_lib::context->zesDdiTable.Power.pfnGetProperties;
2301 if( nullptr == pfnGetProperties )
2302 return ZE_RESULT_ERROR_UNINITIALIZED;
2303
2304 return pfnGetProperties( hPower, pProperties );
2305 }
2306
2307 ///////////////////////////////////////////////////////////////////////////////
2308 /// @brief Get energy counter
2309 ///
2310 /// @details
2311 /// - The application may call this function from simultaneous threads.
2312 /// - The implementation of this function should be lock-free.
2313 ///
2314 /// @returns
2315 /// - ::ZE_RESULT_SUCCESS
2316 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2317 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2318 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2319 /// + `nullptr == hPower`
2320 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2321 /// + `nullptr == pEnergy`
2322 ze_result_t ZE_APICALL
zesPowerGetEnergyCounter(zes_pwr_handle_t hPower,zes_power_energy_counter_t * pEnergy)2323 zesPowerGetEnergyCounter(
2324 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2325 zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and
2326 ///< timestamp when the last counter value was measured.
2327 )
2328 {
2329 auto pfnGetEnergyCounter = ze_lib::context->zesDdiTable.Power.pfnGetEnergyCounter;
2330 if( nullptr == pfnGetEnergyCounter )
2331 return ZE_RESULT_ERROR_UNINITIALIZED;
2332
2333 return pfnGetEnergyCounter( hPower, pEnergy );
2334 }
2335
2336 ///////////////////////////////////////////////////////////////////////////////
2337 /// @brief Get power limits
2338 ///
2339 /// @details
2340 /// - The application may call this function from simultaneous threads.
2341 /// - The implementation of this function should be lock-free.
2342 ///
2343 /// @returns
2344 /// - ::ZE_RESULT_SUCCESS
2345 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2346 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2347 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2348 /// + `nullptr == hPower`
2349 ze_result_t ZE_APICALL
zesPowerGetLimits(zes_pwr_handle_t hPower,zes_power_sustained_limit_t * pSustained,zes_power_burst_limit_t * pBurst,zes_power_peak_limit_t * pPeak)2350 zesPowerGetLimits(
2351 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2352 zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the
2353 ///< current sustained power limits will not be returned.
2354 zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current
2355 ///< peak power limits will not be returned.
2356 zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak
2357 ///< power limits will not be returned.
2358 )
2359 {
2360 auto pfnGetLimits = ze_lib::context->zesDdiTable.Power.pfnGetLimits;
2361 if( nullptr == pfnGetLimits )
2362 return ZE_RESULT_ERROR_UNINITIALIZED;
2363
2364 return pfnGetLimits( hPower, pSustained, pBurst, pPeak );
2365 }
2366
2367 ///////////////////////////////////////////////////////////////////////////////
2368 /// @brief Set power limits
2369 ///
2370 /// @details
2371 /// - The application may call this function from simultaneous threads.
2372 /// - The implementation of this function should be lock-free.
2373 ///
2374 /// @returns
2375 /// - ::ZE_RESULT_SUCCESS
2376 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2377 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2378 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2379 /// + `nullptr == hPower`
2380 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2381 /// + User does not have permissions to make these modifications.
2382 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
2383 /// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported.
2384 ze_result_t ZE_APICALL
zesPowerSetLimits(zes_pwr_handle_t hPower,const zes_power_sustained_limit_t * pSustained,const zes_power_burst_limit_t * pBurst,const zes_power_peak_limit_t * pPeak)2385 zesPowerSetLimits(
2386 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2387 const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes
2388 ///< will be made to the sustained power limits.
2389 const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will
2390 ///< be made to the burst power limits.
2391 const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will
2392 ///< be made to the peak power limits.
2393 )
2394 {
2395 auto pfnSetLimits = ze_lib::context->zesDdiTable.Power.pfnSetLimits;
2396 if( nullptr == pfnSetLimits )
2397 return ZE_RESULT_ERROR_UNINITIALIZED;
2398
2399 return pfnSetLimits( hPower, pSustained, pBurst, pPeak );
2400 }
2401
2402 ///////////////////////////////////////////////////////////////////////////////
2403 /// @brief Get energy threshold
2404 ///
2405 /// @details
2406 /// - The application may call this function from simultaneous threads.
2407 /// - The implementation of this function should be lock-free.
2408 ///
2409 /// @returns
2410 /// - ::ZE_RESULT_SUCCESS
2411 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2412 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2413 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2414 /// + `nullptr == hPower`
2415 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2416 /// + `nullptr == pThreshold`
2417 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2418 /// + Energy threshold not supported on this power domain (check ::zes_power_properties_t.isEnergyThresholdSupported).
2419 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2420 /// + User does not have permissions to request this feature.
2421 ze_result_t ZE_APICALL
zesPowerGetEnergyThreshold(zes_pwr_handle_t hPower,zes_energy_threshold_t * pThreshold)2422 zesPowerGetEnergyThreshold(
2423 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2424 zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting -
2425 ///< enabled/energy threshold/process ID.
2426 )
2427 {
2428 auto pfnGetEnergyThreshold = ze_lib::context->zesDdiTable.Power.pfnGetEnergyThreshold;
2429 if( nullptr == pfnGetEnergyThreshold )
2430 return ZE_RESULT_ERROR_UNINITIALIZED;
2431
2432 return pfnGetEnergyThreshold( hPower, pThreshold );
2433 }
2434
2435 ///////////////////////////////////////////////////////////////////////////////
2436 /// @brief Set energy threshold
2437 ///
2438 /// @details
2439 /// - An event ::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED will be
2440 /// generated when the delta energy consumed starting from this call
2441 /// exceeds the specified threshold. Use the function
2442 /// ::zesDeviceEventRegister() to start receiving the event.
2443 /// - Only one running process can control the energy threshold at a given
2444 /// time. If another process attempts to change the energy threshold, the
2445 /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function
2446 /// ::zesPowerGetEnergyThreshold() to determine the process ID currently
2447 /// controlling this setting.
2448 /// - Calling this function will remove any pending energy thresholds and
2449 /// start counting from the time of this call.
2450 /// - Once the energy threshold has been reached and the event generated,
2451 /// the threshold is automatically removed. It is up to the application to
2452 /// request a new threshold.
2453 /// - The application may call this function from simultaneous threads.
2454 /// - The implementation of this function should be lock-free.
2455 ///
2456 /// @returns
2457 /// - ::ZE_RESULT_SUCCESS
2458 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2459 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2460 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2461 /// + `nullptr == hPower`
2462 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2463 /// + Energy threshold not supported on this power domain (check ::zes_power_properties_t.isEnergyThresholdSupported).
2464 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2465 /// + User does not have permissions to request this feature.
2466 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
2467 /// + Another running process has set the energy threshold.
2468 ze_result_t ZE_APICALL
zesPowerSetEnergyThreshold(zes_pwr_handle_t hPower,double threshold)2469 zesPowerSetEnergyThreshold(
2470 zes_pwr_handle_t hPower, ///< [in] Handle for the component.
2471 double threshold ///< [in] The energy threshold to be set in joules.
2472 )
2473 {
2474 auto pfnSetEnergyThreshold = ze_lib::context->zesDdiTable.Power.pfnSetEnergyThreshold;
2475 if( nullptr == pfnSetEnergyThreshold )
2476 return ZE_RESULT_ERROR_UNINITIALIZED;
2477
2478 return pfnSetEnergyThreshold( hPower, threshold );
2479 }
2480
2481 ///////////////////////////////////////////////////////////////////////////////
2482 /// @brief Get handle of power supplies
2483 ///
2484 /// @details
2485 /// - The application may call this function from simultaneous threads.
2486 /// - The implementation of this function should be lock-free.
2487 ///
2488 /// @returns
2489 /// - ::ZE_RESULT_SUCCESS
2490 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2491 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2492 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2493 /// + `nullptr == hDevice`
2494 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2495 /// + `nullptr == pCount`
2496 ze_result_t ZE_APICALL
zesDeviceEnumPsus(zes_device_handle_t hDevice,uint32_t * pCount,zes_psu_handle_t * phPsu)2497 zesDeviceEnumPsus(
2498 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2499 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
2500 ///< if count is zero, then the driver shall update the value with the
2501 ///< total number of components of this type that are available.
2502 ///< if count is greater than the number of components of this type that
2503 ///< are available, then the driver shall update the value with the correct
2504 ///< number of components.
2505 zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of
2506 ///< this type.
2507 ///< if count is less than the number of components of this type that are
2508 ///< available, then the driver shall only retrieve that number of
2509 ///< component handles.
2510 )
2511 {
2512 auto pfnEnumPsus = ze_lib::context->zesDdiTable.Device.pfnEnumPsus;
2513 if( nullptr == pfnEnumPsus )
2514 return ZE_RESULT_ERROR_UNINITIALIZED;
2515
2516 return pfnEnumPsus( hDevice, pCount, phPsu );
2517 }
2518
2519 ///////////////////////////////////////////////////////////////////////////////
2520 /// @brief Get power supply properties
2521 ///
2522 /// @details
2523 /// - The application may call this function from simultaneous threads.
2524 /// - The implementation of this function should be lock-free.
2525 ///
2526 /// @returns
2527 /// - ::ZE_RESULT_SUCCESS
2528 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2529 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2530 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2531 /// + `nullptr == hPsu`
2532 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2533 /// + `nullptr == pProperties`
2534 ze_result_t ZE_APICALL
zesPsuGetProperties(zes_psu_handle_t hPsu,zes_psu_properties_t * pProperties)2535 zesPsuGetProperties(
2536 zes_psu_handle_t hPsu, ///< [in] Handle for the component.
2537 zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply.
2538 )
2539 {
2540 auto pfnGetProperties = ze_lib::context->zesDdiTable.Psu.pfnGetProperties;
2541 if( nullptr == pfnGetProperties )
2542 return ZE_RESULT_ERROR_UNINITIALIZED;
2543
2544 return pfnGetProperties( hPsu, pProperties );
2545 }
2546
2547 ///////////////////////////////////////////////////////////////////////////////
2548 /// @brief Get current power supply state
2549 ///
2550 /// @details
2551 /// - The application may call this function from simultaneous threads.
2552 /// - The implementation of this function should be lock-free.
2553 ///
2554 /// @returns
2555 /// - ::ZE_RESULT_SUCCESS
2556 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2557 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2558 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2559 /// + `nullptr == hPsu`
2560 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2561 /// + `nullptr == pState`
2562 ze_result_t ZE_APICALL
zesPsuGetState(zes_psu_handle_t hPsu,zes_psu_state_t * pState)2563 zesPsuGetState(
2564 zes_psu_handle_t hPsu, ///< [in] Handle for the component.
2565 zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply.
2566 )
2567 {
2568 auto pfnGetState = ze_lib::context->zesDdiTable.Psu.pfnGetState;
2569 if( nullptr == pfnGetState )
2570 return ZE_RESULT_ERROR_UNINITIALIZED;
2571
2572 return pfnGetState( hPsu, pState );
2573 }
2574
2575 ///////////////////////////////////////////////////////////////////////////////
2576 /// @brief Get handle of all RAS error sets on a device
2577 ///
2578 /// @details
2579 /// - A RAS error set is a collection of RAS error counters of a given type
2580 /// (correctable/uncorrectable) from hardware blocks contained within a
2581 /// sub-device or within the device.
2582 /// - A device without sub-devices will typically return two handles, one
2583 /// for correctable errors sets and one for uncorrectable error sets.
2584 /// - A device with sub-devices will return RAS error sets for each
2585 /// sub-device and possibly RAS error sets for hardware blocks outside the
2586 /// sub-devices.
2587 /// - If the function completes successfully but pCount is set to 0, RAS
2588 /// features are not available/enabled on this device.
2589 /// - The application may call this function from simultaneous threads.
2590 /// - The implementation of this function should be lock-free.
2591 ///
2592 /// @returns
2593 /// - ::ZE_RESULT_SUCCESS
2594 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2595 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2596 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2597 /// + `nullptr == hDevice`
2598 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2599 /// + `nullptr == pCount`
2600 ze_result_t ZE_APICALL
zesDeviceEnumRasErrorSets(zes_device_handle_t hDevice,uint32_t * pCount,zes_ras_handle_t * phRas)2601 zesDeviceEnumRasErrorSets(
2602 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2603 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
2604 ///< if count is zero, then the driver shall update the value with the
2605 ///< total number of components of this type that are available.
2606 ///< if count is greater than the number of components of this type that
2607 ///< are available, then the driver shall update the value with the correct
2608 ///< number of components.
2609 zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of
2610 ///< this type.
2611 ///< if count is less than the number of components of this type that are
2612 ///< available, then the driver shall only retrieve that number of
2613 ///< component handles.
2614 )
2615 {
2616 auto pfnEnumRasErrorSets = ze_lib::context->zesDdiTable.Device.pfnEnumRasErrorSets;
2617 if( nullptr == pfnEnumRasErrorSets )
2618 return ZE_RESULT_ERROR_UNINITIALIZED;
2619
2620 return pfnEnumRasErrorSets( hDevice, pCount, phRas );
2621 }
2622
2623 ///////////////////////////////////////////////////////////////////////////////
2624 /// @brief Get RAS properties of a given RAS error set - this enables discovery
2625 /// of the type of RAS error set (correctable/uncorrectable) and if
2626 /// located on a sub-device
2627 ///
2628 /// @details
2629 /// - The application may call this function from simultaneous threads.
2630 /// - The implementation of this function should be lock-free.
2631 ///
2632 /// @returns
2633 /// - ::ZE_RESULT_SUCCESS
2634 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2635 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2636 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2637 /// + `nullptr == hRas`
2638 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2639 /// + `nullptr == pProperties`
2640 ze_result_t ZE_APICALL
zesRasGetProperties(zes_ras_handle_t hRas,zes_ras_properties_t * pProperties)2641 zesRasGetProperties(
2642 zes_ras_handle_t hRas, ///< [in] Handle for the component.
2643 zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties
2644 )
2645 {
2646 auto pfnGetProperties = ze_lib::context->zesDdiTable.Ras.pfnGetProperties;
2647 if( nullptr == pfnGetProperties )
2648 return ZE_RESULT_ERROR_UNINITIALIZED;
2649
2650 return pfnGetProperties( hRas, pProperties );
2651 }
2652
2653 ///////////////////////////////////////////////////////////////////////////////
2654 /// @brief Get RAS error thresholds that control when RAS events are generated
2655 ///
2656 /// @details
2657 /// - The driver maintains counters for all RAS error sets and error
2658 /// categories. Events are generated when errors occur. The configuration
2659 /// enables setting thresholds to limit when events are sent.
2660 /// - When a particular RAS correctable error counter exceeds the configured
2661 /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will
2662 /// be triggered.
2663 /// - When a particular RAS uncorrectable error counter exceeds the
2664 /// configured threshold, the event
2665 /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered.
2666 /// - The application may call this function from simultaneous threads.
2667 /// - The implementation of this function should be lock-free.
2668 ///
2669 /// @returns
2670 /// - ::ZE_RESULT_SUCCESS
2671 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2672 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2673 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2674 /// + `nullptr == hRas`
2675 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2676 /// + `nullptr == pConfig`
2677 ze_result_t ZE_APICALL
zesRasGetConfig(zes_ras_handle_t hRas,zes_ras_config_t * pConfig)2678 zesRasGetConfig(
2679 zes_ras_handle_t hRas, ///< [in] Handle for the component.
2680 zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration -
2681 ///< thresholds used to trigger events
2682 )
2683 {
2684 auto pfnGetConfig = ze_lib::context->zesDdiTable.Ras.pfnGetConfig;
2685 if( nullptr == pfnGetConfig )
2686 return ZE_RESULT_ERROR_UNINITIALIZED;
2687
2688 return pfnGetConfig( hRas, pConfig );
2689 }
2690
2691 ///////////////////////////////////////////////////////////////////////////////
2692 /// @brief Set RAS error thresholds that control when RAS events are generated
2693 ///
2694 /// @details
2695 /// - The driver maintains counters for all RAS error sets and error
2696 /// categories. Events are generated when errors occur. The configuration
2697 /// enables setting thresholds to limit when events are sent.
2698 /// - When a particular RAS correctable error counter exceeds the specified
2699 /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will
2700 /// be generated.
2701 /// - When a particular RAS uncorrectable error counter exceeds the
2702 /// specified threshold, the event
2703 /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated.
2704 /// - Call ::zesRasGetState() and set the clear flag to true to restart
2705 /// event generation once counters have exceeded thresholds.
2706 /// - The application may call this function from simultaneous threads.
2707 /// - The implementation of this function should be lock-free.
2708 ///
2709 /// @returns
2710 /// - ::ZE_RESULT_SUCCESS
2711 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2712 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2713 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2714 /// + `nullptr == hRas`
2715 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2716 /// + `nullptr == pConfig`
2717 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
2718 /// + Another running process is controlling these settings.
2719 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2720 /// + Don't have permissions to set thresholds.
2721 ze_result_t ZE_APICALL
zesRasSetConfig(zes_ras_handle_t hRas,const zes_ras_config_t * pConfig)2722 zesRasSetConfig(
2723 zes_ras_handle_t hRas, ///< [in] Handle for the component.
2724 const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events
2725 )
2726 {
2727 auto pfnSetConfig = ze_lib::context->zesDdiTable.Ras.pfnSetConfig;
2728 if( nullptr == pfnSetConfig )
2729 return ZE_RESULT_ERROR_UNINITIALIZED;
2730
2731 return pfnSetConfig( hRas, pConfig );
2732 }
2733
2734 ///////////////////////////////////////////////////////////////////////////////
2735 /// @brief Get the current value of RAS error counters for a particular error set
2736 ///
2737 /// @details
2738 /// - Clearing errors will affect other threads/applications - the counter
2739 /// values will start from zero.
2740 /// - Clearing errors requires write permissions.
2741 /// - The application may call this function from simultaneous threads.
2742 /// - The implementation of this function should be lock-free.
2743 ///
2744 /// @returns
2745 /// - ::ZE_RESULT_SUCCESS
2746 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2747 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2748 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2749 /// + `nullptr == hRas`
2750 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2751 /// + `nullptr == pState`
2752 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2753 /// + Don't have permissions to clear error counters.
2754 ze_result_t ZE_APICALL
zesRasGetState(zes_ras_handle_t hRas,ze_bool_t clear,zes_ras_state_t * pState)2755 zesRasGetState(
2756 zes_ras_handle_t hRas, ///< [in] Handle for the component.
2757 ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type
2758 zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred
2759 )
2760 {
2761 auto pfnGetState = ze_lib::context->zesDdiTable.Ras.pfnGetState;
2762 if( nullptr == pfnGetState )
2763 return ZE_RESULT_ERROR_UNINITIALIZED;
2764
2765 return pfnGetState( hRas, clear, pState );
2766 }
2767
2768 ///////////////////////////////////////////////////////////////////////////////
2769 /// @brief Returns handles to scheduler components.
2770 ///
2771 /// @details
2772 /// - Each scheduler component manages the distribution of work across one
2773 /// or more accelerator engines.
2774 /// - If an application wishes to change the scheduler behavior for all
2775 /// accelerator engines of a specific type (e.g. compute), it should
2776 /// select all the handles where the structure member
2777 /// ::zes_sched_properties_t.engines contains that type.
2778 /// - The application may call this function from simultaneous threads.
2779 /// - The implementation of this function should be lock-free.
2780 ///
2781 /// @returns
2782 /// - ::ZE_RESULT_SUCCESS
2783 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2784 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2785 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2786 /// + `nullptr == hDevice`
2787 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2788 /// + `nullptr == pCount`
2789 ze_result_t ZE_APICALL
zesDeviceEnumSchedulers(zes_device_handle_t hDevice,uint32_t * pCount,zes_sched_handle_t * phScheduler)2790 zesDeviceEnumSchedulers(
2791 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
2792 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
2793 ///< if count is zero, then the driver shall update the value with the
2794 ///< total number of components of this type that are available.
2795 ///< if count is greater than the number of components of this type that
2796 ///< are available, then the driver shall update the value with the correct
2797 ///< number of components.
2798 zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of
2799 ///< this type.
2800 ///< if count is less than the number of components of this type that are
2801 ///< available, then the driver shall only retrieve that number of
2802 ///< component handles.
2803 )
2804 {
2805 auto pfnEnumSchedulers = ze_lib::context->zesDdiTable.Device.pfnEnumSchedulers;
2806 if( nullptr == pfnEnumSchedulers )
2807 return ZE_RESULT_ERROR_UNINITIALIZED;
2808
2809 return pfnEnumSchedulers( hDevice, pCount, phScheduler );
2810 }
2811
2812 ///////////////////////////////////////////////////////////////////////////////
2813 /// @brief Get properties related to a scheduler component
2814 ///
2815 /// @details
2816 /// - The application may call this function from simultaneous threads.
2817 /// - The implementation of this function should be lock-free.
2818 ///
2819 /// @returns
2820 /// - ::ZE_RESULT_SUCCESS
2821 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2822 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2823 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2824 /// + `nullptr == hScheduler`
2825 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2826 /// + `nullptr == pProperties`
2827 ze_result_t ZE_APICALL
zesSchedulerGetProperties(zes_sched_handle_t hScheduler,zes_sched_properties_t * pProperties)2828 zesSchedulerGetProperties(
2829 zes_sched_handle_t hScheduler, ///< [in] Handle for the component.
2830 zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data.
2831 )
2832 {
2833 auto pfnGetProperties = ze_lib::context->zesDdiTable.Scheduler.pfnGetProperties;
2834 if( nullptr == pfnGetProperties )
2835 return ZE_RESULT_ERROR_UNINITIALIZED;
2836
2837 return pfnGetProperties( hScheduler, pProperties );
2838 }
2839
2840 ///////////////////////////////////////////////////////////////////////////////
2841 /// @brief Get current scheduling mode in effect on a scheduler component.
2842 ///
2843 /// @details
2844 /// - The application may call this function from simultaneous threads.
2845 /// - The implementation of this function should be lock-free.
2846 ///
2847 /// @returns
2848 /// - ::ZE_RESULT_SUCCESS
2849 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2850 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2851 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2852 /// + `nullptr == hScheduler`
2853 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2854 /// + `nullptr == pMode`
2855 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2856 /// + This scheduler component does not support scheduler modes.
2857 ze_result_t ZE_APICALL
zesSchedulerGetCurrentMode(zes_sched_handle_t hScheduler,zes_sched_mode_t * pMode)2858 zesSchedulerGetCurrentMode(
2859 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
2860 zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode.
2861 )
2862 {
2863 auto pfnGetCurrentMode = ze_lib::context->zesDdiTable.Scheduler.pfnGetCurrentMode;
2864 if( nullptr == pfnGetCurrentMode )
2865 return ZE_RESULT_ERROR_UNINITIALIZED;
2866
2867 return pfnGetCurrentMode( hScheduler, pMode );
2868 }
2869
2870 ///////////////////////////////////////////////////////////////////////////////
2871 /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMEOUT
2872 ///
2873 /// @details
2874 /// - The application may call this function from simultaneous threads.
2875 /// - The implementation of this function should be lock-free.
2876 ///
2877 /// @returns
2878 /// - ::ZE_RESULT_SUCCESS
2879 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2880 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2881 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2882 /// + `nullptr == hScheduler`
2883 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2884 /// + `nullptr == pConfig`
2885 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2886 /// + This scheduler component does not support scheduler modes.
2887 ze_result_t ZE_APICALL
zesSchedulerGetTimeoutModeProperties(zes_sched_handle_t hScheduler,ze_bool_t getDefaults,zes_sched_timeout_properties_t * pConfig)2888 zesSchedulerGetTimeoutModeProperties(
2889 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
2890 ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for
2891 ///< this mode, otherwise it will return the current properties.
2892 zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode.
2893 )
2894 {
2895 auto pfnGetTimeoutModeProperties = ze_lib::context->zesDdiTable.Scheduler.pfnGetTimeoutModeProperties;
2896 if( nullptr == pfnGetTimeoutModeProperties )
2897 return ZE_RESULT_ERROR_UNINITIALIZED;
2898
2899 return pfnGetTimeoutModeProperties( hScheduler, getDefaults, pConfig );
2900 }
2901
2902 ///////////////////////////////////////////////////////////////////////////////
2903 /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMESLICE
2904 ///
2905 /// @details
2906 /// - The application may call this function from simultaneous threads.
2907 /// - The implementation of this function should be lock-free.
2908 ///
2909 /// @returns
2910 /// - ::ZE_RESULT_SUCCESS
2911 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2912 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2913 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2914 /// + `nullptr == hScheduler`
2915 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2916 /// + `nullptr == pConfig`
2917 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2918 /// + This scheduler component does not support scheduler modes.
2919 ze_result_t ZE_APICALL
zesSchedulerGetTimesliceModeProperties(zes_sched_handle_t hScheduler,ze_bool_t getDefaults,zes_sched_timeslice_properties_t * pConfig)2920 zesSchedulerGetTimesliceModeProperties(
2921 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
2922 ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for
2923 ///< this mode, otherwise it will return the current properties.
2924 zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode.
2925 )
2926 {
2927 auto pfnGetTimesliceModeProperties = ze_lib::context->zesDdiTable.Scheduler.pfnGetTimesliceModeProperties;
2928 if( nullptr == pfnGetTimesliceModeProperties )
2929 return ZE_RESULT_ERROR_UNINITIALIZED;
2930
2931 return pfnGetTimesliceModeProperties( hScheduler, getDefaults, pConfig );
2932 }
2933
2934 ///////////////////////////////////////////////////////////////////////////////
2935 /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMEOUT or update scheduler
2936 /// mode parameters if already running in this mode.
2937 ///
2938 /// @details
2939 /// - This mode is optimized for multiple applications or contexts
2940 /// submitting work to the hardware. When higher priority work arrives,
2941 /// the scheduler attempts to pause the current executing work within some
2942 /// timeout interval, then submits the other work.
2943 /// - The application may call this function from simultaneous threads.
2944 /// - The implementation of this function should be lock-free.
2945 ///
2946 /// @returns
2947 /// - ::ZE_RESULT_SUCCESS
2948 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2949 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2950 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2951 /// + `nullptr == hScheduler`
2952 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2953 /// + `nullptr == pProperties`
2954 /// + `nullptr == pNeedReload`
2955 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2956 /// + This scheduler component does not support scheduler modes.
2957 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2958 /// + User does not have permissions to make this modification.
2959 ze_result_t ZE_APICALL
zesSchedulerSetTimeoutMode(zes_sched_handle_t hScheduler,zes_sched_timeout_properties_t * pProperties,ze_bool_t * pNeedReload)2960 zesSchedulerSetTimeoutMode(
2961 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
2962 zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode.
2963 ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to
2964 ///< apply the new scheduler mode.
2965 )
2966 {
2967 auto pfnSetTimeoutMode = ze_lib::context->zesDdiTable.Scheduler.pfnSetTimeoutMode;
2968 if( nullptr == pfnSetTimeoutMode )
2969 return ZE_RESULT_ERROR_UNINITIALIZED;
2970
2971 return pfnSetTimeoutMode( hScheduler, pProperties, pNeedReload );
2972 }
2973
2974 ///////////////////////////////////////////////////////////////////////////////
2975 /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMESLICE or update
2976 /// scheduler mode parameters if already running in this mode.
2977 ///
2978 /// @details
2979 /// - This mode is optimized to provide fair sharing of hardware execution
2980 /// time between multiple contexts submitting work to the hardware
2981 /// concurrently.
2982 /// - The application may call this function from simultaneous threads.
2983 /// - The implementation of this function should be lock-free.
2984 ///
2985 /// @returns
2986 /// - ::ZE_RESULT_SUCCESS
2987 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
2988 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
2989 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
2990 /// + `nullptr == hScheduler`
2991 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
2992 /// + `nullptr == pProperties`
2993 /// + `nullptr == pNeedReload`
2994 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
2995 /// + This scheduler component does not support scheduler modes.
2996 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
2997 /// + User does not have permissions to make this modification.
2998 ze_result_t ZE_APICALL
zesSchedulerSetTimesliceMode(zes_sched_handle_t hScheduler,zes_sched_timeslice_properties_t * pProperties,ze_bool_t * pNeedReload)2999 zesSchedulerSetTimesliceMode(
3000 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
3001 zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode.
3002 ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to
3003 ///< apply the new scheduler mode.
3004 )
3005 {
3006 auto pfnSetTimesliceMode = ze_lib::context->zesDdiTable.Scheduler.pfnSetTimesliceMode;
3007 if( nullptr == pfnSetTimesliceMode )
3008 return ZE_RESULT_ERROR_UNINITIALIZED;
3009
3010 return pfnSetTimesliceMode( hScheduler, pProperties, pNeedReload );
3011 }
3012
3013 ///////////////////////////////////////////////////////////////////////////////
3014 /// @brief Change scheduler mode to ::ZES_SCHED_MODE_EXCLUSIVE
3015 ///
3016 /// @details
3017 /// - This mode is optimized for single application/context use-cases. It
3018 /// permits a context to run indefinitely on the hardware without being
3019 /// preempted or terminated. All pending work for other contexts must wait
3020 /// until the running context completes with no further submitted work.
3021 /// - The application may call this function from simultaneous threads.
3022 /// - The implementation of this function should be lock-free.
3023 ///
3024 /// @returns
3025 /// - ::ZE_RESULT_SUCCESS
3026 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3027 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3028 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3029 /// + `nullptr == hScheduler`
3030 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3031 /// + `nullptr == pNeedReload`
3032 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
3033 /// + This scheduler component does not support scheduler modes.
3034 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
3035 /// + User does not have permissions to make this modification.
3036 ze_result_t ZE_APICALL
zesSchedulerSetExclusiveMode(zes_sched_handle_t hScheduler,ze_bool_t * pNeedReload)3037 zesSchedulerSetExclusiveMode(
3038 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
3039 ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to
3040 ///< apply the new scheduler mode.
3041 )
3042 {
3043 auto pfnSetExclusiveMode = ze_lib::context->zesDdiTable.Scheduler.pfnSetExclusiveMode;
3044 if( nullptr == pfnSetExclusiveMode )
3045 return ZE_RESULT_ERROR_UNINITIALIZED;
3046
3047 return pfnSetExclusiveMode( hScheduler, pNeedReload );
3048 }
3049
3050 ///////////////////////////////////////////////////////////////////////////////
3051 /// @brief Change scheduler mode to ::ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG
3052 ///
3053 /// @details
3054 /// - This is a special mode that must ben enabled when debugging an
3055 /// application that uses this device e.g. using the Level0 Debug API.
3056 /// - It ensures that only one command queue can execute work on the
3057 /// hardware at a given time. Work is permitted to run as long as needed
3058 /// without enforcing any scheduler fairness policies.
3059 /// - The application may call this function from simultaneous threads.
3060 /// - The implementation of this function should be lock-free.
3061 ///
3062 /// @returns
3063 /// - ::ZE_RESULT_SUCCESS
3064 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3065 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3066 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3067 /// + `nullptr == hScheduler`
3068 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3069 /// + `nullptr == pNeedReload`
3070 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
3071 /// + This scheduler component does not support scheduler modes.
3072 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
3073 /// + User does not have permissions to make this modification.
3074 ze_result_t ZE_APICALL
zesSchedulerSetComputeUnitDebugMode(zes_sched_handle_t hScheduler,ze_bool_t * pNeedReload)3075 zesSchedulerSetComputeUnitDebugMode(
3076 zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component.
3077 ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to
3078 ///< apply the new scheduler mode.
3079 )
3080 {
3081 auto pfnSetComputeUnitDebugMode = ze_lib::context->zesDdiTable.Scheduler.pfnSetComputeUnitDebugMode;
3082 if( nullptr == pfnSetComputeUnitDebugMode )
3083 return ZE_RESULT_ERROR_UNINITIALIZED;
3084
3085 return pfnSetComputeUnitDebugMode( hScheduler, pNeedReload );
3086 }
3087
3088 ///////////////////////////////////////////////////////////////////////////////
3089 /// @brief Get handle of standby controls
3090 ///
3091 /// @details
3092 /// - The application may call this function from simultaneous threads.
3093 /// - The implementation of this function should be lock-free.
3094 ///
3095 /// @returns
3096 /// - ::ZE_RESULT_SUCCESS
3097 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3098 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3099 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3100 /// + `nullptr == hDevice`
3101 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3102 /// + `nullptr == pCount`
3103 ze_result_t ZE_APICALL
zesDeviceEnumStandbyDomains(zes_device_handle_t hDevice,uint32_t * pCount,zes_standby_handle_t * phStandby)3104 zesDeviceEnumStandbyDomains(
3105 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
3106 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
3107 ///< if count is zero, then the driver shall update the value with the
3108 ///< total number of components of this type that are available.
3109 ///< if count is greater than the number of components of this type that
3110 ///< are available, then the driver shall update the value with the correct
3111 ///< number of components.
3112 zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of
3113 ///< this type.
3114 ///< if count is less than the number of components of this type that are
3115 ///< available, then the driver shall only retrieve that number of
3116 ///< component handles.
3117 )
3118 {
3119 auto pfnEnumStandbyDomains = ze_lib::context->zesDdiTable.Device.pfnEnumStandbyDomains;
3120 if( nullptr == pfnEnumStandbyDomains )
3121 return ZE_RESULT_ERROR_UNINITIALIZED;
3122
3123 return pfnEnumStandbyDomains( hDevice, pCount, phStandby );
3124 }
3125
3126 ///////////////////////////////////////////////////////////////////////////////
3127 /// @brief Get standby hardware component properties
3128 ///
3129 /// @details
3130 /// - The application may call this function from simultaneous threads.
3131 /// - The implementation of this function should be lock-free.
3132 ///
3133 /// @returns
3134 /// - ::ZE_RESULT_SUCCESS
3135 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3136 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3137 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3138 /// + `nullptr == hStandby`
3139 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3140 /// + `nullptr == pProperties`
3141 ze_result_t ZE_APICALL
zesStandbyGetProperties(zes_standby_handle_t hStandby,zes_standby_properties_t * pProperties)3142 zesStandbyGetProperties(
3143 zes_standby_handle_t hStandby, ///< [in] Handle for the component.
3144 zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties.
3145 )
3146 {
3147 auto pfnGetProperties = ze_lib::context->zesDdiTable.Standby.pfnGetProperties;
3148 if( nullptr == pfnGetProperties )
3149 return ZE_RESULT_ERROR_UNINITIALIZED;
3150
3151 return pfnGetProperties( hStandby, pProperties );
3152 }
3153
3154 ///////////////////////////////////////////////////////////////////////////////
3155 /// @brief Get the current standby promotion mode
3156 ///
3157 /// @details
3158 /// - The application may call this function from simultaneous threads.
3159 /// - The implementation of this function should be lock-free.
3160 ///
3161 /// @returns
3162 /// - ::ZE_RESULT_SUCCESS
3163 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3164 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3165 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3166 /// + `nullptr == hStandby`
3167 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3168 /// + `nullptr == pMode`
3169 ze_result_t ZE_APICALL
zesStandbyGetMode(zes_standby_handle_t hStandby,zes_standby_promo_mode_t * pMode)3170 zesStandbyGetMode(
3171 zes_standby_handle_t hStandby, ///< [in] Handle for the component.
3172 zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode.
3173 )
3174 {
3175 auto pfnGetMode = ze_lib::context->zesDdiTable.Standby.pfnGetMode;
3176 if( nullptr == pfnGetMode )
3177 return ZE_RESULT_ERROR_UNINITIALIZED;
3178
3179 return pfnGetMode( hStandby, pMode );
3180 }
3181
3182 ///////////////////////////////////////////////////////////////////////////////
3183 /// @brief Set standby promotion mode
3184 ///
3185 /// @details
3186 /// - The application may call this function from simultaneous threads.
3187 /// - The implementation of this function should be lock-free.
3188 ///
3189 /// @returns
3190 /// - ::ZE_RESULT_SUCCESS
3191 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3192 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3193 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3194 /// + `nullptr == hStandby`
3195 /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
3196 /// + `::ZES_STANDBY_PROMO_MODE_NEVER < mode`
3197 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
3198 /// + User does not have permissions to make these modifications.
3199 ze_result_t ZE_APICALL
zesStandbySetMode(zes_standby_handle_t hStandby,zes_standby_promo_mode_t mode)3200 zesStandbySetMode(
3201 zes_standby_handle_t hStandby, ///< [in] Handle for the component.
3202 zes_standby_promo_mode_t mode ///< [in] New standby mode.
3203 )
3204 {
3205 auto pfnSetMode = ze_lib::context->zesDdiTable.Standby.pfnSetMode;
3206 if( nullptr == pfnSetMode )
3207 return ZE_RESULT_ERROR_UNINITIALIZED;
3208
3209 return pfnSetMode( hStandby, mode );
3210 }
3211
3212 ///////////////////////////////////////////////////////////////////////////////
3213 /// @brief Get handle of temperature sensors
3214 ///
3215 /// @details
3216 /// - The application may call this function from simultaneous threads.
3217 /// - The implementation of this function should be lock-free.
3218 ///
3219 /// @returns
3220 /// - ::ZE_RESULT_SUCCESS
3221 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3222 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3223 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3224 /// + `nullptr == hDevice`
3225 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3226 /// + `nullptr == pCount`
3227 ze_result_t ZE_APICALL
zesDeviceEnumTemperatureSensors(zes_device_handle_t hDevice,uint32_t * pCount,zes_temp_handle_t * phTemperature)3228 zesDeviceEnumTemperatureSensors(
3229 zes_device_handle_t hDevice, ///< [in] Sysman handle of the device.
3230 uint32_t* pCount, ///< [in,out] pointer to the number of components of this type.
3231 ///< if count is zero, then the driver shall update the value with the
3232 ///< total number of components of this type that are available.
3233 ///< if count is greater than the number of components of this type that
3234 ///< are available, then the driver shall update the value with the correct
3235 ///< number of components.
3236 zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of
3237 ///< this type.
3238 ///< if count is less than the number of components of this type that are
3239 ///< available, then the driver shall only retrieve that number of
3240 ///< component handles.
3241 )
3242 {
3243 auto pfnEnumTemperatureSensors = ze_lib::context->zesDdiTable.Device.pfnEnumTemperatureSensors;
3244 if( nullptr == pfnEnumTemperatureSensors )
3245 return ZE_RESULT_ERROR_UNINITIALIZED;
3246
3247 return pfnEnumTemperatureSensors( hDevice, pCount, phTemperature );
3248 }
3249
3250 ///////////////////////////////////////////////////////////////////////////////
3251 /// @brief Get temperature sensor properties
3252 ///
3253 /// @details
3254 /// - The application may call this function from simultaneous threads.
3255 /// - The implementation of this function should be lock-free.
3256 ///
3257 /// @returns
3258 /// - ::ZE_RESULT_SUCCESS
3259 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3260 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3261 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3262 /// + `nullptr == hTemperature`
3263 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3264 /// + `nullptr == pProperties`
3265 ze_result_t ZE_APICALL
zesTemperatureGetProperties(zes_temp_handle_t hTemperature,zes_temp_properties_t * pProperties)3266 zesTemperatureGetProperties(
3267 zes_temp_handle_t hTemperature, ///< [in] Handle for the component.
3268 zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties.
3269 )
3270 {
3271 auto pfnGetProperties = ze_lib::context->zesDdiTable.Temperature.pfnGetProperties;
3272 if( nullptr == pfnGetProperties )
3273 return ZE_RESULT_ERROR_UNINITIALIZED;
3274
3275 return pfnGetProperties( hTemperature, pProperties );
3276 }
3277
3278 ///////////////////////////////////////////////////////////////////////////////
3279 /// @brief Get temperature configuration for this sensor - which events are
3280 /// triggered and the trigger conditions
3281 ///
3282 /// @details
3283 /// - The application may call this function from simultaneous threads.
3284 /// - The implementation of this function should be lock-free.
3285 ///
3286 /// @returns
3287 /// - ::ZE_RESULT_SUCCESS
3288 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3289 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3290 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3291 /// + `nullptr == hTemperature`
3292 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3293 /// + `nullptr == pConfig`
3294 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
3295 /// + Temperature thresholds are not supported on this temperature sensor. Generally this is only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL
3296 /// + One or both of the thresholds is not supported - check ::zes_temp_properties_t.isThreshold1Supported and ::zes_temp_properties_t.isThreshold2Supported
3297 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
3298 /// + User does not have permissions to request this feature.
3299 ze_result_t ZE_APICALL
zesTemperatureGetConfig(zes_temp_handle_t hTemperature,zes_temp_config_t * pConfig)3300 zesTemperatureGetConfig(
3301 zes_temp_handle_t hTemperature, ///< [in] Handle for the component.
3302 zes_temp_config_t* pConfig ///< [in,out] Returns current configuration.
3303 )
3304 {
3305 auto pfnGetConfig = ze_lib::context->zesDdiTable.Temperature.pfnGetConfig;
3306 if( nullptr == pfnGetConfig )
3307 return ZE_RESULT_ERROR_UNINITIALIZED;
3308
3309 return pfnGetConfig( hTemperature, pConfig );
3310 }
3311
3312 ///////////////////////////////////////////////////////////////////////////////
3313 /// @brief Set temperature configuration for this sensor - indicates which events
3314 /// are triggered and the trigger conditions
3315 ///
3316 /// @details
3317 /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL will be triggered when
3318 /// temperature reaches the critical range. Use the function
3319 /// ::zesDeviceEventRegister() to start receiving this event.
3320 /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 and
3321 /// ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 will be generated when
3322 /// temperature cross the thresholds set using this function. Use the
3323 /// function ::zesDeviceEventRegister() to start receiving these events.
3324 /// - Only one running process can set the temperature configuration at a
3325 /// time. If another process attempts to change the configuration, the
3326 /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function
3327 /// ::zesTemperatureGetConfig() will return the process ID currently
3328 /// controlling these settings.
3329 /// - The application may call this function from simultaneous threads.
3330 /// - The implementation of this function should be lock-free.
3331 ///
3332 /// @returns
3333 /// - ::ZE_RESULT_SUCCESS
3334 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3335 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3336 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3337 /// + `nullptr == hTemperature`
3338 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3339 /// + `nullptr == pConfig`
3340 /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
3341 /// + Temperature thresholds are not supported on this temperature sensor. Generally they are only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL
3342 /// + Enabling the critical temperature event is not supported - check ::zes_temp_properties_t.isCriticalTempSupported
3343 /// + One or both of the thresholds is not supported - check ::zes_temp_properties_t.isThreshold1Supported and ::zes_temp_properties_t.isThreshold2Supported
3344 /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
3345 /// + User does not have permissions to request this feature.
3346 /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
3347 /// + Another running process is controlling these settings.
3348 /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
3349 /// + One or both the thresholds is above TjMax (see ::zesFrequencyOcGetTjMax()). Temperature thresholds must be below this value.
3350 ze_result_t ZE_APICALL
zesTemperatureSetConfig(zes_temp_handle_t hTemperature,const zes_temp_config_t * pConfig)3351 zesTemperatureSetConfig(
3352 zes_temp_handle_t hTemperature, ///< [in] Handle for the component.
3353 const zes_temp_config_t* pConfig ///< [in] New configuration.
3354 )
3355 {
3356 auto pfnSetConfig = ze_lib::context->zesDdiTable.Temperature.pfnSetConfig;
3357 if( nullptr == pfnSetConfig )
3358 return ZE_RESULT_ERROR_UNINITIALIZED;
3359
3360 return pfnSetConfig( hTemperature, pConfig );
3361 }
3362
3363 ///////////////////////////////////////////////////////////////////////////////
3364 /// @brief Get the temperature from a specified sensor
3365 ///
3366 /// @details
3367 /// - The application may call this function from simultaneous threads.
3368 /// - The implementation of this function should be lock-free.
3369 ///
3370 /// @returns
3371 /// - ::ZE_RESULT_SUCCESS
3372 /// - ::ZE_RESULT_ERROR_UNINITIALIZED
3373 /// - ::ZE_RESULT_ERROR_DEVICE_LOST
3374 /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
3375 /// + `nullptr == hTemperature`
3376 /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
3377 /// + `nullptr == pTemperature`
3378 ze_result_t ZE_APICALL
zesTemperatureGetState(zes_temp_handle_t hTemperature,double * pTemperature)3379 zesTemperatureGetState(
3380 zes_temp_handle_t hTemperature, ///< [in] Handle for the component.
3381 double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor
3382 ///< in degrees Celsius.
3383 )
3384 {
3385 auto pfnGetState = ze_lib::context->zesDdiTable.Temperature.pfnGetState;
3386 if( nullptr == pfnGetState )
3387 return ZE_RESULT_ERROR_UNINITIALIZED;
3388
3389 return pfnGetState( hTemperature, pTemperature );
3390 }
3391
3392 } // extern "C"
3393