1*fd3907ccSCallum Fare //===- Auto-generated file, part of the LLVM/Offload project --------------===// 2*fd3907ccSCallum Fare // 3*fd3907ccSCallum Fare // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*fd3907ccSCallum Fare // See https://llvm.org/LICENSE.txt for license information. 5*fd3907ccSCallum Fare // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*fd3907ccSCallum Fare // 7*fd3907ccSCallum Fare //===----------------------------------------------------------------------===// 8*fd3907ccSCallum Fare 9*fd3907ccSCallum Fare // Auto-generated file, do not manually edit. 10*fd3907ccSCallum Fare 11*fd3907ccSCallum Fare #pragma once 12*fd3907ccSCallum Fare 13*fd3907ccSCallum Fare #include <stddef.h> 14*fd3907ccSCallum Fare #include <stdint.h> 15*fd3907ccSCallum Fare 16*fd3907ccSCallum Fare #if defined(__cplusplus) 17*fd3907ccSCallum Fare extern "C" { 18*fd3907ccSCallum Fare #endif 19*fd3907ccSCallum Fare 20*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 21*fd3907ccSCallum Fare #ifndef OL_VERSION_MAJOR 22*fd3907ccSCallum Fare /// @brief Major version of the Offload API 23*fd3907ccSCallum Fare #define OL_VERSION_MAJOR 0 24*fd3907ccSCallum Fare #endif // OL_VERSION_MAJOR 25*fd3907ccSCallum Fare 26*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 27*fd3907ccSCallum Fare #ifndef OL_VERSION_MINOR 28*fd3907ccSCallum Fare /// @brief Minor version of the Offload API 29*fd3907ccSCallum Fare #define OL_VERSION_MINOR 0 30*fd3907ccSCallum Fare #endif // OL_VERSION_MINOR 31*fd3907ccSCallum Fare 32*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 33*fd3907ccSCallum Fare #ifndef OL_VERSION_PATCH 34*fd3907ccSCallum Fare /// @brief Patch version of the Offload API 35*fd3907ccSCallum Fare #define OL_VERSION_PATCH 1 36*fd3907ccSCallum Fare #endif // OL_VERSION_PATCH 37*fd3907ccSCallum Fare 38*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 39*fd3907ccSCallum Fare #ifndef OL_APICALL 40*fd3907ccSCallum Fare #if defined(_WIN32) 41*fd3907ccSCallum Fare /// @brief Calling convention for all API functions 42*fd3907ccSCallum Fare #define OL_APICALL __cdecl 43*fd3907ccSCallum Fare #else 44*fd3907ccSCallum Fare #define OL_APICALL 45*fd3907ccSCallum Fare #endif // defined(_WIN32) 46*fd3907ccSCallum Fare #endif // OL_APICALL 47*fd3907ccSCallum Fare 48*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 49*fd3907ccSCallum Fare #ifndef OL_APIEXPORT 50*fd3907ccSCallum Fare #if defined(_WIN32) 51*fd3907ccSCallum Fare /// @brief Microsoft-specific dllexport storage-class attribute 52*fd3907ccSCallum Fare #define OL_APIEXPORT __declspec(dllexport) 53*fd3907ccSCallum Fare #else 54*fd3907ccSCallum Fare #define OL_APIEXPORT 55*fd3907ccSCallum Fare #endif // defined(_WIN32) 56*fd3907ccSCallum Fare #endif // OL_APIEXPORT 57*fd3907ccSCallum Fare 58*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 59*fd3907ccSCallum Fare #ifndef OL_DLLEXPORT 60*fd3907ccSCallum Fare #if defined(_WIN32) 61*fd3907ccSCallum Fare /// @brief Microsoft-specific dllexport storage-class attribute 62*fd3907ccSCallum Fare #define OL_DLLEXPORT __declspec(dllexport) 63*fd3907ccSCallum Fare #endif // defined(_WIN32) 64*fd3907ccSCallum Fare #endif // OL_DLLEXPORT 65*fd3907ccSCallum Fare 66*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 67*fd3907ccSCallum Fare #ifndef OL_DLLEXPORT 68*fd3907ccSCallum Fare #if __GNUC__ >= 4 69*fd3907ccSCallum Fare /// @brief GCC-specific dllexport storage-class attribute 70*fd3907ccSCallum Fare #define OL_DLLEXPORT __attribute__((visibility("default"))) 71*fd3907ccSCallum Fare #else 72*fd3907ccSCallum Fare #define OL_DLLEXPORT 73*fd3907ccSCallum Fare #endif // __GNUC__ >= 4 74*fd3907ccSCallum Fare #endif // OL_DLLEXPORT 75*fd3907ccSCallum Fare 76*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 77*fd3907ccSCallum Fare /// @brief Handle of a platform instance 78*fd3907ccSCallum Fare typedef struct ol_platform_handle_t_ *ol_platform_handle_t; 79*fd3907ccSCallum Fare 80*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 81*fd3907ccSCallum Fare /// @brief Handle of platform's device object 82*fd3907ccSCallum Fare typedef struct ol_device_handle_t_ *ol_device_handle_t; 83*fd3907ccSCallum Fare 84*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 85*fd3907ccSCallum Fare /// @brief Handle of context object 86*fd3907ccSCallum Fare typedef struct ol_context_handle_t_ *ol_context_handle_t; 87*fd3907ccSCallum Fare 88*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 89*fd3907ccSCallum Fare /// @brief Defines Return/Error codes 90*fd3907ccSCallum Fare typedef enum ol_errc_t { 91*fd3907ccSCallum Fare /// Success 92*fd3907ccSCallum Fare OL_ERRC_SUCCESS = 0, 93*fd3907ccSCallum Fare /// Invalid Value 94*fd3907ccSCallum Fare OL_ERRC_INVALID_VALUE = 1, 95*fd3907ccSCallum Fare /// Invalid platform 96*fd3907ccSCallum Fare OL_ERRC_INVALID_PLATFORM = 2, 97*fd3907ccSCallum Fare /// Device not found 98*fd3907ccSCallum Fare OL_ERRC_DEVICE_NOT_FOUND = 3, 99*fd3907ccSCallum Fare /// Invalid device 100*fd3907ccSCallum Fare OL_ERRC_INVALID_DEVICE = 4, 101*fd3907ccSCallum Fare /// Device hung, reset, was removed, or driver update occurred 102*fd3907ccSCallum Fare OL_ERRC_DEVICE_LOST = 5, 103*fd3907ccSCallum Fare /// plugin is not initialized or specific entry-point is not implemented 104*fd3907ccSCallum Fare OL_ERRC_UNINITIALIZED = 6, 105*fd3907ccSCallum Fare /// Out of resources 106*fd3907ccSCallum Fare OL_ERRC_OUT_OF_RESOURCES = 7, 107*fd3907ccSCallum Fare /// generic error code for unsupported versions 108*fd3907ccSCallum Fare OL_ERRC_UNSUPPORTED_VERSION = 8, 109*fd3907ccSCallum Fare /// generic error code for unsupported features 110*fd3907ccSCallum Fare OL_ERRC_UNSUPPORTED_FEATURE = 9, 111*fd3907ccSCallum Fare /// generic error code for invalid arguments 112*fd3907ccSCallum Fare OL_ERRC_INVALID_ARGUMENT = 10, 113*fd3907ccSCallum Fare /// handle argument is not valid 114*fd3907ccSCallum Fare OL_ERRC_INVALID_NULL_HANDLE = 11, 115*fd3907ccSCallum Fare /// pointer argument may not be nullptr 116*fd3907ccSCallum Fare OL_ERRC_INVALID_NULL_POINTER = 12, 117*fd3907ccSCallum Fare /// invalid size or dimensions (e.g., must not be zero, or is out of bounds) 118*fd3907ccSCallum Fare OL_ERRC_INVALID_SIZE = 13, 119*fd3907ccSCallum Fare /// enumerator argument is not valid 120*fd3907ccSCallum Fare OL_ERRC_INVALID_ENUMERATION = 14, 121*fd3907ccSCallum Fare /// enumerator argument is not supported by the device 122*fd3907ccSCallum Fare OL_ERRC_UNSUPPORTED_ENUMERATION = 15, 123*fd3907ccSCallum Fare /// Unknown or internal error 124*fd3907ccSCallum Fare OL_ERRC_UNKNOWN = 16, 125*fd3907ccSCallum Fare /// @cond 126*fd3907ccSCallum Fare OL_ERRC_FORCE_UINT32 = 0x7fffffff 127*fd3907ccSCallum Fare /// @endcond 128*fd3907ccSCallum Fare 129*fd3907ccSCallum Fare } ol_errc_t; 130*fd3907ccSCallum Fare 131*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 132*fd3907ccSCallum Fare /// @brief Details of the error condition returned by an API call 133*fd3907ccSCallum Fare typedef struct ol_error_struct_t { 134*fd3907ccSCallum Fare ol_errc_t Code; /// The error code 135*fd3907ccSCallum Fare const char *Details; /// String containing error details 136*fd3907ccSCallum Fare } ol_error_struct_t; 137*fd3907ccSCallum Fare 138*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 139*fd3907ccSCallum Fare /// @brief Result type returned by all entry points. 140*fd3907ccSCallum Fare typedef const ol_error_struct_t *ol_result_t; 141*fd3907ccSCallum Fare 142*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 143*fd3907ccSCallum Fare #ifndef OL_SUCCESS 144*fd3907ccSCallum Fare /// @brief Success condition 145*fd3907ccSCallum Fare #define OL_SUCCESS NULL 146*fd3907ccSCallum Fare #endif // OL_SUCCESS 147*fd3907ccSCallum Fare 148*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 149*fd3907ccSCallum Fare /// @brief Code location information that can optionally be associated with an 150*fd3907ccSCallum Fare /// API call 151*fd3907ccSCallum Fare typedef struct ol_code_location_t { 152*fd3907ccSCallum Fare const char *FunctionName; /// Function name 153*fd3907ccSCallum Fare const char *SourceFile; /// Source code file 154*fd3907ccSCallum Fare uint32_t LineNumber; /// Source code line number 155*fd3907ccSCallum Fare uint32_t ColumnNumber; /// Source code column number 156*fd3907ccSCallum Fare } ol_code_location_t; 157*fd3907ccSCallum Fare 158*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 159*fd3907ccSCallum Fare /// @brief Perform initialization of the Offload library and plugins 160*fd3907ccSCallum Fare /// 161*fd3907ccSCallum Fare /// @details 162*fd3907ccSCallum Fare /// - This must be the first API call made by a user of the Offload library 163*fd3907ccSCallum Fare /// - Each call will increment an internal reference count that is 164*fd3907ccSCallum Fare /// decremented by `olShutDown` 165*fd3907ccSCallum Fare /// 166*fd3907ccSCallum Fare /// @returns 167*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 168*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 169*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 170*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 171*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 172*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olInit(); 173*fd3907ccSCallum Fare 174*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 175*fd3907ccSCallum Fare /// @brief Release the resources in use by Offload 176*fd3907ccSCallum Fare /// 177*fd3907ccSCallum Fare /// @details 178*fd3907ccSCallum Fare /// - This decrements an internal reference count. When this reaches 0, all 179*fd3907ccSCallum Fare /// resources will be released 180*fd3907ccSCallum Fare /// - Subsequent API calls made after this are not valid 181*fd3907ccSCallum Fare /// 182*fd3907ccSCallum Fare /// @returns 183*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 184*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 185*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 186*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 187*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 188*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olShutDown(); 189*fd3907ccSCallum Fare 190*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 191*fd3907ccSCallum Fare /// @brief Retrieves all available platforms 192*fd3907ccSCallum Fare /// 193*fd3907ccSCallum Fare /// @details 194*fd3907ccSCallum Fare /// - Multiple calls to this function will return identical platforms 195*fd3907ccSCallum Fare /// handles, in the same order. 196*fd3907ccSCallum Fare /// 197*fd3907ccSCallum Fare /// @returns 198*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 199*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 200*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 201*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_SIZE 202*fd3907ccSCallum Fare /// + `NumEntries == 0` 203*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 204*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 205*fd3907ccSCallum Fare /// + `NULL == Platforms` 206*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatform( 207*fd3907ccSCallum Fare // [in] The number of platforms to be added to Platforms. NumEntries must be 208*fd3907ccSCallum Fare // greater than zero. 209*fd3907ccSCallum Fare uint32_t NumEntries, 210*fd3907ccSCallum Fare // [out] Array of handle of platforms. If NumEntries is less than the number 211*fd3907ccSCallum Fare // of platforms available, then olGetPlatform shall only retrieve that 212*fd3907ccSCallum Fare // number of platforms. 213*fd3907ccSCallum Fare ol_platform_handle_t *Platforms); 214*fd3907ccSCallum Fare 215*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 216*fd3907ccSCallum Fare /// @brief Retrieves the number of available platforms 217*fd3907ccSCallum Fare /// 218*fd3907ccSCallum Fare /// @details 219*fd3907ccSCallum Fare /// 220*fd3907ccSCallum Fare /// @returns 221*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 222*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 223*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 224*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 225*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 226*fd3907ccSCallum Fare /// + `NULL == NumPlatforms` 227*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformCount( 228*fd3907ccSCallum Fare // [out] returns the total number of platforms available. 229*fd3907ccSCallum Fare uint32_t *NumPlatforms); 230*fd3907ccSCallum Fare 231*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 232*fd3907ccSCallum Fare /// @brief Supported platform info 233*fd3907ccSCallum Fare typedef enum ol_platform_info_t { 234*fd3907ccSCallum Fare /// [char[]] The string denoting name of the platform. The size of the info 235*fd3907ccSCallum Fare /// needs to be dynamically queried. 236*fd3907ccSCallum Fare OL_PLATFORM_INFO_NAME = 0, 237*fd3907ccSCallum Fare /// [char[]] The string denoting name of the vendor of the platform. The size 238*fd3907ccSCallum Fare /// of the info needs to be dynamically queried. 239*fd3907ccSCallum Fare OL_PLATFORM_INFO_VENDOR_NAME = 1, 240*fd3907ccSCallum Fare /// [char[]] The string denoting the version of the platform. The size of the 241*fd3907ccSCallum Fare /// info needs to be dynamically queried. 242*fd3907ccSCallum Fare OL_PLATFORM_INFO_VERSION = 2, 243*fd3907ccSCallum Fare /// [ol_platform_backend_t] The native backend of the platform. 244*fd3907ccSCallum Fare OL_PLATFORM_INFO_BACKEND = 3, 245*fd3907ccSCallum Fare /// @cond 246*fd3907ccSCallum Fare OL_PLATFORM_INFO_FORCE_UINT32 = 0x7fffffff 247*fd3907ccSCallum Fare /// @endcond 248*fd3907ccSCallum Fare 249*fd3907ccSCallum Fare } ol_platform_info_t; 250*fd3907ccSCallum Fare 251*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 252*fd3907ccSCallum Fare /// @brief Identifies the native backend of the platform 253*fd3907ccSCallum Fare typedef enum ol_platform_backend_t { 254*fd3907ccSCallum Fare /// The backend is not recognized 255*fd3907ccSCallum Fare OL_PLATFORM_BACKEND_UNKNOWN = 0, 256*fd3907ccSCallum Fare /// The backend is CUDA 257*fd3907ccSCallum Fare OL_PLATFORM_BACKEND_CUDA = 1, 258*fd3907ccSCallum Fare /// The backend is AMDGPU 259*fd3907ccSCallum Fare OL_PLATFORM_BACKEND_AMDGPU = 2, 260*fd3907ccSCallum Fare /// @cond 261*fd3907ccSCallum Fare OL_PLATFORM_BACKEND_FORCE_UINT32 = 0x7fffffff 262*fd3907ccSCallum Fare /// @endcond 263*fd3907ccSCallum Fare 264*fd3907ccSCallum Fare } ol_platform_backend_t; 265*fd3907ccSCallum Fare 266*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 267*fd3907ccSCallum Fare /// @brief Queries the given property of the platform 268*fd3907ccSCallum Fare /// 269*fd3907ccSCallum Fare /// @details 270*fd3907ccSCallum Fare /// - `olGetPlatformInfoSize` can be used to query the storage size required 271*fd3907ccSCallum Fare /// for the given query. 272*fd3907ccSCallum Fare /// 273*fd3907ccSCallum Fare /// @returns 274*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 275*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 276*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 277*fd3907ccSCallum Fare /// - ::OL_ERRC_UNSUPPORTED_ENUMERATION 278*fd3907ccSCallum Fare /// + If `PropName` is not supported by the platform. 279*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_SIZE 280*fd3907ccSCallum Fare /// + `PropSize == 0` 281*fd3907ccSCallum Fare /// + If `PropSize` is less than the real number of bytes needed to 282*fd3907ccSCallum Fare /// return the info. 283*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_PLATFORM 284*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 285*fd3907ccSCallum Fare /// + `NULL == Platform` 286*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 287*fd3907ccSCallum Fare /// + `NULL == PropValue` 288*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfo( 289*fd3907ccSCallum Fare // [in] handle of the platform 290*fd3907ccSCallum Fare ol_platform_handle_t Platform, 291*fd3907ccSCallum Fare // [in] type of the info to retrieve 292*fd3907ccSCallum Fare ol_platform_info_t PropName, 293*fd3907ccSCallum Fare // [in] the number of bytes pointed to by pPlatformInfo. 294*fd3907ccSCallum Fare size_t PropSize, 295*fd3907ccSCallum Fare // [out] array of bytes holding the info. If Size is not equal to or greater 296*fd3907ccSCallum Fare // to the real number of bytes needed to return the info then the 297*fd3907ccSCallum Fare // OL_ERRC_INVALID_SIZE error is returned and pPlatformInfo is not used. 298*fd3907ccSCallum Fare void *PropValue); 299*fd3907ccSCallum Fare 300*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 301*fd3907ccSCallum Fare /// @brief Returns the storage size of the given platform query 302*fd3907ccSCallum Fare /// 303*fd3907ccSCallum Fare /// @details 304*fd3907ccSCallum Fare /// 305*fd3907ccSCallum Fare /// @returns 306*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 307*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 308*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 309*fd3907ccSCallum Fare /// - ::OL_ERRC_UNSUPPORTED_ENUMERATION 310*fd3907ccSCallum Fare /// + If `PropName` is not supported by the platform. 311*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_PLATFORM 312*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 313*fd3907ccSCallum Fare /// + `NULL == Platform` 314*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 315*fd3907ccSCallum Fare /// + `NULL == PropSizeRet` 316*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoSize( 317*fd3907ccSCallum Fare // [in] handle of the platform 318*fd3907ccSCallum Fare ol_platform_handle_t Platform, 319*fd3907ccSCallum Fare // [in] type of the info to query 320*fd3907ccSCallum Fare ol_platform_info_t PropName, 321*fd3907ccSCallum Fare // [out] pointer to the number of bytes required to store the query 322*fd3907ccSCallum Fare size_t *PropSizeRet); 323*fd3907ccSCallum Fare 324*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 325*fd3907ccSCallum Fare /// @brief Supported device types 326*fd3907ccSCallum Fare typedef enum ol_device_type_t { 327*fd3907ccSCallum Fare /// The default device type as preferred by the runtime 328*fd3907ccSCallum Fare OL_DEVICE_TYPE_DEFAULT = 0, 329*fd3907ccSCallum Fare /// Devices of all types 330*fd3907ccSCallum Fare OL_DEVICE_TYPE_ALL = 1, 331*fd3907ccSCallum Fare /// GPU device type 332*fd3907ccSCallum Fare OL_DEVICE_TYPE_GPU = 2, 333*fd3907ccSCallum Fare /// CPU device type 334*fd3907ccSCallum Fare OL_DEVICE_TYPE_CPU = 3, 335*fd3907ccSCallum Fare /// @cond 336*fd3907ccSCallum Fare OL_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff 337*fd3907ccSCallum Fare /// @endcond 338*fd3907ccSCallum Fare 339*fd3907ccSCallum Fare } ol_device_type_t; 340*fd3907ccSCallum Fare 341*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 342*fd3907ccSCallum Fare /// @brief Supported device info 343*fd3907ccSCallum Fare typedef enum ol_device_info_t { 344*fd3907ccSCallum Fare /// [ol_device_type_t] type of the device 345*fd3907ccSCallum Fare OL_DEVICE_INFO_TYPE = 0, 346*fd3907ccSCallum Fare /// [ol_platform_handle_t] the platform associated with the device 347*fd3907ccSCallum Fare OL_DEVICE_INFO_PLATFORM = 1, 348*fd3907ccSCallum Fare /// [char[]] Device name 349*fd3907ccSCallum Fare OL_DEVICE_INFO_NAME = 2, 350*fd3907ccSCallum Fare /// [char[]] Device vendor 351*fd3907ccSCallum Fare OL_DEVICE_INFO_VENDOR = 3, 352*fd3907ccSCallum Fare /// [char[]] Driver version 353*fd3907ccSCallum Fare OL_DEVICE_INFO_DRIVER_VERSION = 4, 354*fd3907ccSCallum Fare /// @cond 355*fd3907ccSCallum Fare OL_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff 356*fd3907ccSCallum Fare /// @endcond 357*fd3907ccSCallum Fare 358*fd3907ccSCallum Fare } ol_device_info_t; 359*fd3907ccSCallum Fare 360*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 361*fd3907ccSCallum Fare /// @brief Retrieves the number of available devices within a platform 362*fd3907ccSCallum Fare /// 363*fd3907ccSCallum Fare /// @details 364*fd3907ccSCallum Fare /// 365*fd3907ccSCallum Fare /// @returns 366*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 367*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 368*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 369*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 370*fd3907ccSCallum Fare /// + `NULL == Platform` 371*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 372*fd3907ccSCallum Fare /// + `NULL == NumDevices` 373*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceCount( 374*fd3907ccSCallum Fare // [in] handle of the platform instance 375*fd3907ccSCallum Fare ol_platform_handle_t Platform, 376*fd3907ccSCallum Fare // [out] pointer to the number of devices. 377*fd3907ccSCallum Fare uint32_t *NumDevices); 378*fd3907ccSCallum Fare 379*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 380*fd3907ccSCallum Fare /// @brief Retrieves devices within a platform 381*fd3907ccSCallum Fare /// 382*fd3907ccSCallum Fare /// @details 383*fd3907ccSCallum Fare /// - Multiple calls to this function will return identical device handles, 384*fd3907ccSCallum Fare /// in the same order. 385*fd3907ccSCallum Fare /// 386*fd3907ccSCallum Fare /// @returns 387*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 388*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 389*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 390*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_SIZE 391*fd3907ccSCallum Fare /// + `NumEntries == 0` 392*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 393*fd3907ccSCallum Fare /// + `NULL == Platform` 394*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 395*fd3907ccSCallum Fare /// + `NULL == Devices` 396*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDevice( 397*fd3907ccSCallum Fare // [in] handle of the platform instance 398*fd3907ccSCallum Fare ol_platform_handle_t Platform, 399*fd3907ccSCallum Fare // [in] the number of devices to be added to phDevices, which must be 400*fd3907ccSCallum Fare // greater than zero 401*fd3907ccSCallum Fare uint32_t NumEntries, 402*fd3907ccSCallum Fare // [out] Array of device handles. If NumEntries is less than the number of 403*fd3907ccSCallum Fare // devices available, then this function shall only retrieve that number of 404*fd3907ccSCallum Fare // devices. 405*fd3907ccSCallum Fare ol_device_handle_t *Devices); 406*fd3907ccSCallum Fare 407*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 408*fd3907ccSCallum Fare /// @brief Queries the given property of the device 409*fd3907ccSCallum Fare /// 410*fd3907ccSCallum Fare /// @details 411*fd3907ccSCallum Fare /// 412*fd3907ccSCallum Fare /// @returns 413*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 414*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 415*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 416*fd3907ccSCallum Fare /// - ::OL_ERRC_UNSUPPORTED_ENUMERATION 417*fd3907ccSCallum Fare /// + If `PropName` is not supported by the device. 418*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_SIZE 419*fd3907ccSCallum Fare /// + `PropSize == 0` 420*fd3907ccSCallum Fare /// + If `PropSize` is less than the real number of bytes needed to 421*fd3907ccSCallum Fare /// return the info. 422*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_DEVICE 423*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 424*fd3907ccSCallum Fare /// + `NULL == Device` 425*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 426*fd3907ccSCallum Fare /// + `NULL == PropValue` 427*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfo( 428*fd3907ccSCallum Fare // [in] handle of the device instance 429*fd3907ccSCallum Fare ol_device_handle_t Device, 430*fd3907ccSCallum Fare // [in] type of the info to retrieve 431*fd3907ccSCallum Fare ol_device_info_t PropName, 432*fd3907ccSCallum Fare // [in] the number of bytes pointed to by PropValue. 433*fd3907ccSCallum Fare size_t PropSize, 434*fd3907ccSCallum Fare // [out] array of bytes holding the info. If PropSize is not equal to or 435*fd3907ccSCallum Fare // greater than the real number of bytes needed to return the info then the 436*fd3907ccSCallum Fare // OL_ERRC_INVALID_SIZE error is returned and PropValue is not used. 437*fd3907ccSCallum Fare void *PropValue); 438*fd3907ccSCallum Fare 439*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 440*fd3907ccSCallum Fare /// @brief Returns the storage size of the given device query 441*fd3907ccSCallum Fare /// 442*fd3907ccSCallum Fare /// @details 443*fd3907ccSCallum Fare /// 444*fd3907ccSCallum Fare /// @returns 445*fd3907ccSCallum Fare /// - ::OL_RESULT_SUCCESS 446*fd3907ccSCallum Fare /// - ::OL_ERRC_UNINITIALIZED 447*fd3907ccSCallum Fare /// - ::OL_ERRC_DEVICE_LOST 448*fd3907ccSCallum Fare /// - ::OL_ERRC_UNSUPPORTED_ENUMERATION 449*fd3907ccSCallum Fare /// + If `PropName` is not supported by the device. 450*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_DEVICE 451*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_HANDLE 452*fd3907ccSCallum Fare /// + `NULL == Device` 453*fd3907ccSCallum Fare /// - ::OL_ERRC_INVALID_NULL_POINTER 454*fd3907ccSCallum Fare /// + `NULL == PropSizeRet` 455*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoSize( 456*fd3907ccSCallum Fare // [in] handle of the device instance 457*fd3907ccSCallum Fare ol_device_handle_t Device, 458*fd3907ccSCallum Fare // [in] type of the info to retrieve 459*fd3907ccSCallum Fare ol_device_info_t PropName, 460*fd3907ccSCallum Fare // [out] pointer to the number of bytes required to store the query 461*fd3907ccSCallum Fare size_t *PropSizeRet); 462*fd3907ccSCallum Fare 463*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 464*fd3907ccSCallum Fare /// @brief Function parameters for olGetPlatform 465*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 466*fd3907ccSCallum Fare typedef struct ol_get_platform_params_t { 467*fd3907ccSCallum Fare uint32_t *pNumEntries; 468*fd3907ccSCallum Fare ol_platform_handle_t **pPlatforms; 469*fd3907ccSCallum Fare } ol_get_platform_params_t; 470*fd3907ccSCallum Fare 471*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 472*fd3907ccSCallum Fare /// @brief Function parameters for olGetPlatformCount 473*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 474*fd3907ccSCallum Fare typedef struct ol_get_platform_count_params_t { 475*fd3907ccSCallum Fare uint32_t **pNumPlatforms; 476*fd3907ccSCallum Fare } ol_get_platform_count_params_t; 477*fd3907ccSCallum Fare 478*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 479*fd3907ccSCallum Fare /// @brief Function parameters for olGetPlatformInfo 480*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 481*fd3907ccSCallum Fare typedef struct ol_get_platform_info_params_t { 482*fd3907ccSCallum Fare ol_platform_handle_t *pPlatform; 483*fd3907ccSCallum Fare ol_platform_info_t *pPropName; 484*fd3907ccSCallum Fare size_t *pPropSize; 485*fd3907ccSCallum Fare void **pPropValue; 486*fd3907ccSCallum Fare } ol_get_platform_info_params_t; 487*fd3907ccSCallum Fare 488*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 489*fd3907ccSCallum Fare /// @brief Function parameters for olGetPlatformInfoSize 490*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 491*fd3907ccSCallum Fare typedef struct ol_get_platform_info_size_params_t { 492*fd3907ccSCallum Fare ol_platform_handle_t *pPlatform; 493*fd3907ccSCallum Fare ol_platform_info_t *pPropName; 494*fd3907ccSCallum Fare size_t **pPropSizeRet; 495*fd3907ccSCallum Fare } ol_get_platform_info_size_params_t; 496*fd3907ccSCallum Fare 497*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 498*fd3907ccSCallum Fare /// @brief Function parameters for olGetDeviceCount 499*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 500*fd3907ccSCallum Fare typedef struct ol_get_device_count_params_t { 501*fd3907ccSCallum Fare ol_platform_handle_t *pPlatform; 502*fd3907ccSCallum Fare uint32_t **pNumDevices; 503*fd3907ccSCallum Fare } ol_get_device_count_params_t; 504*fd3907ccSCallum Fare 505*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 506*fd3907ccSCallum Fare /// @brief Function parameters for olGetDevice 507*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 508*fd3907ccSCallum Fare typedef struct ol_get_device_params_t { 509*fd3907ccSCallum Fare ol_platform_handle_t *pPlatform; 510*fd3907ccSCallum Fare uint32_t *pNumEntries; 511*fd3907ccSCallum Fare ol_device_handle_t **pDevices; 512*fd3907ccSCallum Fare } ol_get_device_params_t; 513*fd3907ccSCallum Fare 514*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 515*fd3907ccSCallum Fare /// @brief Function parameters for olGetDeviceInfo 516*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 517*fd3907ccSCallum Fare typedef struct ol_get_device_info_params_t { 518*fd3907ccSCallum Fare ol_device_handle_t *pDevice; 519*fd3907ccSCallum Fare ol_device_info_t *pPropName; 520*fd3907ccSCallum Fare size_t *pPropSize; 521*fd3907ccSCallum Fare void **pPropValue; 522*fd3907ccSCallum Fare } ol_get_device_info_params_t; 523*fd3907ccSCallum Fare 524*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 525*fd3907ccSCallum Fare /// @brief Function parameters for olGetDeviceInfoSize 526*fd3907ccSCallum Fare /// @details Each entry is a pointer to the parameter passed to the function; 527*fd3907ccSCallum Fare typedef struct ol_get_device_info_size_params_t { 528*fd3907ccSCallum Fare ol_device_handle_t *pDevice; 529*fd3907ccSCallum Fare ol_device_info_t *pPropName; 530*fd3907ccSCallum Fare size_t **pPropSizeRet; 531*fd3907ccSCallum Fare } ol_get_device_info_size_params_t; 532*fd3907ccSCallum Fare 533*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 534*fd3907ccSCallum Fare /// @brief Variant of olInit that also sets source code location information 535*fd3907ccSCallum Fare /// @details See also ::olInit 536*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL 537*fd3907ccSCallum Fare olInitWithCodeLoc(ol_code_location_t *CodeLocation); 538*fd3907ccSCallum Fare 539*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 540*fd3907ccSCallum Fare /// @brief Variant of olShutDown that also sets source code location information 541*fd3907ccSCallum Fare /// @details See also ::olShutDown 542*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL 543*fd3907ccSCallum Fare olShutDownWithCodeLoc(ol_code_location_t *CodeLocation); 544*fd3907ccSCallum Fare 545*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 546*fd3907ccSCallum Fare /// @brief Variant of olGetPlatform that also sets source code location 547*fd3907ccSCallum Fare /// information 548*fd3907ccSCallum Fare /// @details See also ::olGetPlatform 549*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL 550*fd3907ccSCallum Fare olGetPlatformWithCodeLoc(uint32_t NumEntries, ol_platform_handle_t *Platforms, 551*fd3907ccSCallum Fare ol_code_location_t *CodeLocation); 552*fd3907ccSCallum Fare 553*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 554*fd3907ccSCallum Fare /// @brief Variant of olGetPlatformCount that also sets source code location 555*fd3907ccSCallum Fare /// information 556*fd3907ccSCallum Fare /// @details See also ::olGetPlatformCount 557*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformCountWithCodeLoc( 558*fd3907ccSCallum Fare uint32_t *NumPlatforms, ol_code_location_t *CodeLocation); 559*fd3907ccSCallum Fare 560*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 561*fd3907ccSCallum Fare /// @brief Variant of olGetPlatformInfo that also sets source code location 562*fd3907ccSCallum Fare /// information 563*fd3907ccSCallum Fare /// @details See also ::olGetPlatformInfo 564*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoWithCodeLoc( 565*fd3907ccSCallum Fare ol_platform_handle_t Platform, ol_platform_info_t PropName, size_t PropSize, 566*fd3907ccSCallum Fare void *PropValue, ol_code_location_t *CodeLocation); 567*fd3907ccSCallum Fare 568*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 569*fd3907ccSCallum Fare /// @brief Variant of olGetPlatformInfoSize that also sets source code location 570*fd3907ccSCallum Fare /// information 571*fd3907ccSCallum Fare /// @details See also ::olGetPlatformInfoSize 572*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetPlatformInfoSizeWithCodeLoc( 573*fd3907ccSCallum Fare ol_platform_handle_t Platform, ol_platform_info_t PropName, 574*fd3907ccSCallum Fare size_t *PropSizeRet, ol_code_location_t *CodeLocation); 575*fd3907ccSCallum Fare 576*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 577*fd3907ccSCallum Fare /// @brief Variant of olGetDeviceCount that also sets source code location 578*fd3907ccSCallum Fare /// information 579*fd3907ccSCallum Fare /// @details See also ::olGetDeviceCount 580*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL 581*fd3907ccSCallum Fare olGetDeviceCountWithCodeLoc(ol_platform_handle_t Platform, uint32_t *NumDevices, 582*fd3907ccSCallum Fare ol_code_location_t *CodeLocation); 583*fd3907ccSCallum Fare 584*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 585*fd3907ccSCallum Fare /// @brief Variant of olGetDevice that also sets source code location 586*fd3907ccSCallum Fare /// information 587*fd3907ccSCallum Fare /// @details See also ::olGetDevice 588*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceWithCodeLoc( 589*fd3907ccSCallum Fare ol_platform_handle_t Platform, uint32_t NumEntries, 590*fd3907ccSCallum Fare ol_device_handle_t *Devices, ol_code_location_t *CodeLocation); 591*fd3907ccSCallum Fare 592*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 593*fd3907ccSCallum Fare /// @brief Variant of olGetDeviceInfo that also sets source code location 594*fd3907ccSCallum Fare /// information 595*fd3907ccSCallum Fare /// @details See also ::olGetDeviceInfo 596*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoWithCodeLoc( 597*fd3907ccSCallum Fare ol_device_handle_t Device, ol_device_info_t PropName, size_t PropSize, 598*fd3907ccSCallum Fare void *PropValue, ol_code_location_t *CodeLocation); 599*fd3907ccSCallum Fare 600*fd3907ccSCallum Fare /////////////////////////////////////////////////////////////////////////////// 601*fd3907ccSCallum Fare /// @brief Variant of olGetDeviceInfoSize that also sets source code location 602*fd3907ccSCallum Fare /// information 603*fd3907ccSCallum Fare /// @details See also ::olGetDeviceInfoSize 604*fd3907ccSCallum Fare OL_APIEXPORT ol_result_t OL_APICALL olGetDeviceInfoSizeWithCodeLoc( 605*fd3907ccSCallum Fare ol_device_handle_t Device, ol_device_info_t PropName, size_t *PropSizeRet, 606*fd3907ccSCallum Fare ol_code_location_t *CodeLocation); 607*fd3907ccSCallum Fare 608*fd3907ccSCallum Fare #if defined(__cplusplus) 609*fd3907ccSCallum Fare } // extern "C" 610*fd3907ccSCallum Fare #endif 611