diff --git a/examples/codegen/codegen.cpp b/examples/codegen/codegen.cpp index 7d45789063..e631bf2dc5 100644 --- a/examples/codegen/codegen.cpp +++ b/examples/codegen/codegen.cpp @@ -49,11 +49,11 @@ std::vector get_supported_adapters(std::vector &adapters) { std::vector supported_adapters; for (auto adapter : adapters) { - ur_adapter_backend_t backend; + ur_backend_t backend; ur_check(urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, - sizeof(ur_adapter_backend_t), &backend, nullptr)); + sizeof(ur_backend_t), &backend, nullptr)); - if (backend == UR_ADAPTER_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_LEVEL_ZERO) { supported_adapters.push_back(adapter); } } diff --git a/include/ur_api.h b/include/ur_api.h index c390ed4410..bea66e7107 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -894,6 +894,27 @@ typedef struct ur_rect_region_t { } ur_rect_region_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Defines known backends. +typedef enum ur_backend_t { + /// The backend is not a recognized one + UR_BACKEND_UNKNOWN = 0, + /// The backend is Level Zero + UR_BACKEND_LEVEL_ZERO = 1, + /// The backend is OpenCL + UR_BACKEND_OPENCL = 2, + /// The backend is CUDA + UR_BACKEND_CUDA = 3, + /// The backend is HIP + UR_BACKEND_HIP = 4, + /// The backend is Native CPU + UR_BACKEND_NATIVE_CPU = 5, + /// @cond + UR_BACKEND_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_backend_t; + #if !defined(__GNUC__) #pragma endregion #endif @@ -1308,8 +1329,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetLastError( /////////////////////////////////////////////////////////////////////////////// /// @brief Supported adapter info typedef enum ur_adapter_info_t { - /// [::ur_adapter_backend_t] Identifies the native backend supported by - /// the adapter. + /// [::ur_backend_t] Identifies the native backend supported by the + /// adapter. UR_ADAPTER_INFO_BACKEND = 0, /// [uint32_t] Reference count of the adapter. /// The reference count returned should be considered immediately stale. @@ -1370,27 +1391,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo( /// pPropValue. size_t *pPropSizeRet); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Identifies backend of the adapter -typedef enum ur_adapter_backend_t { - /// The backend is not a recognized one - UR_ADAPTER_BACKEND_UNKNOWN = 0, - /// The backend is Level Zero - UR_ADAPTER_BACKEND_LEVEL_ZERO = 1, - /// The backend is OpenCL - UR_ADAPTER_BACKEND_OPENCL = 2, - /// The backend is CUDA - UR_ADAPTER_BACKEND_CUDA = 3, - /// The backend is HIP - UR_ADAPTER_BACKEND_HIP = 4, - /// The backend is Native CPU - UR_ADAPTER_BACKEND_NATIVE_CPU = 5, - /// @cond - UR_ADAPTER_BACKEND_FORCE_UINT32 = 0x7fffffff - /// @endcond - -} ur_adapter_backend_t; - #if !defined(__GNUC__) #pragma endregion #endif @@ -1457,8 +1457,8 @@ typedef enum ur_platform_info_t { /// [char[]] The string denoting profile of the platform. The size of the /// info needs to be dynamically queried. UR_PLATFORM_INFO_PROFILE = 5, - /// [::ur_platform_backend_t] The backend of the platform. Identifies the - /// native backend adapter implementing this platform. + /// [::ur_backend_t] The backend of the platform. Identifies the native + /// backend adapter implementing this platform. UR_PLATFORM_INFO_BACKEND = 6, /// [::ur_adapter_handle_t] The adapter handle associated with the /// platform. @@ -1677,27 +1677,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption( /// the frontend option. const char **ppPlatformOption); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Identifies native backend adapters -typedef enum ur_platform_backend_t { - /// The backend is not a recognized one - UR_PLATFORM_BACKEND_UNKNOWN = 0, - /// The backend is Level Zero - UR_PLATFORM_BACKEND_LEVEL_ZERO = 1, - /// The backend is OpenCL - UR_PLATFORM_BACKEND_OPENCL = 2, - /// The backend is CUDA - UR_PLATFORM_BACKEND_CUDA = 3, - /// The backend is HIP - UR_PLATFORM_BACKEND_HIP = 4, - /// The backend is Native CPU - UR_PLATFORM_BACKEND_NATIVE_CPU = 5, - /// @cond - UR_PLATFORM_BACKEND_FORCE_UINT32 = 0x7fffffff - /// @endcond - -} ur_platform_backend_t; - #if !defined(__GNUC__) #pragma endregion #endif diff --git a/include/ur_print.h b/include/ur_print.h index f58133bb8a..3e20f71f7d 100644 --- a/include/ur_print.h +++ b/include/ur_print.h @@ -92,6 +92,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintRectRegion(const struct ur_rect_region_t params, char *buffer, const size_t buff_size, size_t *out_size); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_backend_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBackend(enum ur_backend_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_init_flag_t enum /// @returns @@ -132,16 +143,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterInfo(enum ur_adapter_info_t value, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_adapter_backend_t enum -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL -urPrintAdapterBackend(enum ur_adapter_backend_t value, char *buffer, - const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_platform_info_t enum /// @returns @@ -172,16 +173,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformNativeProperties( const struct ur_platform_native_properties_t params, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_platform_backend_t enum -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL -urPrintPlatformBackend(enum ur_platform_backend_t value, char *buffer, - const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_binary_t struct /// @returns diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 5c5f573477..7e73cbe638 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -277,6 +277,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_region_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_backend_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_device_init_flag_t value); inline std::ostream &operator<<(std::ostream &os, @@ -285,16 +286,12 @@ inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_code_location_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_adapter_backend_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_platform_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value); inline std::ostream &operator<<( std::ostream &os, [[maybe_unused]] const struct ur_platform_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_backend_t value); inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_binary_t params); @@ -1982,6 +1979,36 @@ inline std::ostream &operator<<(std::ostream &os, return os; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_backend_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_backend_t value) { + switch (value) { + case UR_BACKEND_UNKNOWN: + os << "UR_BACKEND_UNKNOWN"; + break; + case UR_BACKEND_LEVEL_ZERO: + os << "UR_BACKEND_LEVEL_ZERO"; + break; + case UR_BACKEND_OPENCL: + os << "UR_BACKEND_OPENCL"; + break; + case UR_BACKEND_CUDA: + os << "UR_BACKEND_CUDA"; + break; + case UR_BACKEND_HIP: + os << "UR_BACKEND_HIP"; + break; + case UR_BACKEND_NATIVE_CPU: + os << "UR_BACKEND_NATIVE_CPU"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_init_flag_t type /// @returns /// std::ostream & @@ -2200,10 +2227,10 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, switch (value) { case UR_ADAPTER_INFO_BACKEND: { - const ur_adapter_backend_t *tptr = (const ur_adapter_backend_t *)ptr; - if (sizeof(ur_adapter_backend_t) > size) { + const ur_backend_t *tptr = (const ur_backend_t *)ptr; + if (sizeof(ur_backend_t) > size) { os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_adapter_backend_t) << ")"; + << ", expected: >=" << sizeof(ur_backend_t) << ")"; return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2246,37 +2273,6 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, } } // namespace ur::details -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_adapter_backend_t type -/// @returns -/// std::ostream & -inline std::ostream &operator<<(std::ostream &os, - enum ur_adapter_backend_t value) { - switch (value) { - case UR_ADAPTER_BACKEND_UNKNOWN: - os << "UR_ADAPTER_BACKEND_UNKNOWN"; - break; - case UR_ADAPTER_BACKEND_LEVEL_ZERO: - os << "UR_ADAPTER_BACKEND_LEVEL_ZERO"; - break; - case UR_ADAPTER_BACKEND_OPENCL: - os << "UR_ADAPTER_BACKEND_OPENCL"; - break; - case UR_ADAPTER_BACKEND_CUDA: - os << "UR_ADAPTER_BACKEND_CUDA"; - break; - case UR_ADAPTER_BACKEND_HIP: - os << "UR_ADAPTER_BACKEND_HIP"; - break; - case UR_ADAPTER_BACKEND_NATIVE_CPU: - os << "UR_ADAPTER_BACKEND_NATIVE_CPU"; - break; - default: - os << "unknown enumerator"; - break; - } - return os; -} /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_platform_info_t type /// @returns @@ -2348,10 +2344,10 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, printPtr(os, tptr); } break; case UR_PLATFORM_INFO_BACKEND: { - const ur_platform_backend_t *tptr = (const ur_platform_backend_t *)ptr; - if (sizeof(ur_platform_backend_t) > size) { + const ur_backend_t *tptr = (const ur_backend_t *)ptr; + if (sizeof(ur_backend_t) > size) { os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_platform_backend_t) << ")"; + << ", expected: >=" << sizeof(ur_backend_t) << ")"; return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2416,37 +2412,6 @@ operator<<(std::ostream &os, return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_platform_backend_t type -/// @returns -/// std::ostream & -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_backend_t value) { - switch (value) { - case UR_PLATFORM_BACKEND_UNKNOWN: - os << "UR_PLATFORM_BACKEND_UNKNOWN"; - break; - case UR_PLATFORM_BACKEND_LEVEL_ZERO: - os << "UR_PLATFORM_BACKEND_LEVEL_ZERO"; - break; - case UR_PLATFORM_BACKEND_OPENCL: - os << "UR_PLATFORM_BACKEND_OPENCL"; - break; - case UR_PLATFORM_BACKEND_CUDA: - os << "UR_PLATFORM_BACKEND_CUDA"; - break; - case UR_PLATFORM_BACKEND_HIP: - os << "UR_PLATFORM_BACKEND_HIP"; - break; - case UR_PLATFORM_BACKEND_NATIVE_CPU: - os << "UR_PLATFORM_BACKEND_NATIVE_CPU"; - break; - default: - os << "unknown enumerator"; - break; - } - return os; -} -/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_binary_t type /// @returns /// std::ostream & diff --git a/scripts/core/adapter.yml b/scripts/core/adapter.yml index d8df466f1a..4a8d7348db 100644 --- a/scripts/core/adapter.yml +++ b/scripts/core/adapter.yml @@ -130,7 +130,7 @@ name: $x_adapter_info_t typed_etors: True etors: - name: BACKEND - desc: "[$x_adapter_backend_t] Identifies the native backend supported by the adapter." + desc: "[$x_backend_t] Identifies the native backend supported by the adapter." - name: REFERENCE_COUNT desc: | [uint32_t] Reference count of the adapter. @@ -182,27 +182,3 @@ returns: - "`pPropValue == NULL && pPropSizeRet == NULL`" - $X_RESULT_ERROR_OUT_OF_RESOURCES - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: enum -desc: "Identifies backend of the adapter" -class: $x -name: $x_adapter_backend_t -etors: - - name: UNKNOWN - value: "0" - desc: "The backend is not a recognized one" - - name: LEVEL_ZERO - value: "1" - desc: "The backend is Level Zero" - - name: OPENCL - value: "2" - desc: "The backend is OpenCL" - - name: CUDA - value: "3" - desc: "The backend is CUDA" - - name: HIP - value: "4" - desc: "The backend is HIP" - - name: NATIVE_CPU - value: "5" - desc: "The backend is Native CPU" diff --git a/scripts/core/common.yml b/scripts/core/common.yml index 73501ac39d..55485731f6 100644 --- a/scripts/core/common.yml +++ b/scripts/core/common.yml @@ -339,3 +339,26 @@ members: - type: uint64_t name: depth desc: "[in] scalar (scalar)" +--- #-------------------------------------------------------------------------- +type: enum +desc: "Defines known backends." +name: $x_backend_t +etors: + - name: UNKNOWN + value: "0" + desc: "The backend is not a recognized one" + - name: LEVEL_ZERO + value: "1" + desc: "The backend is Level Zero" + - name: OPENCL + value: "2" + desc: "The backend is OpenCL" + - name: CUDA + value: "3" + desc: "The backend is CUDA" + - name: HIP + value: "4" + desc: "The backend is HIP" + - name: NATIVE_CPU + value: "5" + desc: "The backend is Native CPU" diff --git a/scripts/core/platform.yml b/scripts/core/platform.yml index da4240a093..817d0436fa 100644 --- a/scripts/core/platform.yml +++ b/scripts/core/platform.yml @@ -76,7 +76,7 @@ etors: todo: "currently always return FULL_PROFILE, deprecate?" - name: BACKEND value: "6" - desc: "[$x_platform_backend_t] The backend of the platform. Identifies the native backend adapter implementing this platform." + desc: "[$x_backend_t] The backend of the platform. Identifies the native backend adapter implementing this platform." - name: ADAPTER value: "7" desc: "[$x_adapter_handle_t] The adapter handle associated with the platform." @@ -258,27 +258,3 @@ params: returns: - $X_RESULT_ERROR_INVALID_VALUE: - "If `pFrontendOption` is not a valid frontend option." ---- #-------------------------------------------------------------------------- -type: enum -desc: "Identifies native backend adapters" -class: $xPlatform -name: $x_platform_backend_t -etors: - - name: UNKNOWN - value: "0" - desc: "The backend is not a recognized one" - - name: LEVEL_ZERO - value: "1" - desc: "The backend is Level Zero" - - name: OPENCL - value: "2" - desc: "The backend is OpenCL" - - name: CUDA - value: "3" - desc: "The backend is CUDA" - - name: HIP - value: "4" - desc: "The backend is HIP" - - name: NATIVE_CPU - value: "5" - desc: "The backend is Native CPU" diff --git a/source/adapters/cuda/adapter.cpp b/source/adapters/cuda/adapter.cpp index 3ea896bbd6..7ab7679e27 100644 --- a/source/adapters/cuda/adapter.cpp +++ b/source/adapters/cuda/adapter.cpp @@ -106,7 +106,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, switch (propName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_CUDA); + return ReturnValue(UR_BACKEND_CUDA); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(adapter.RefCount.load()); case UR_ADAPTER_INFO_VERSION: diff --git a/source/adapters/cuda/platform.cpp b/source/adapters/cuda/platform.cpp index ac66c39afb..7b865f61cd 100644 --- a/source/adapters/cuda/platform.cpp +++ b/source/adapters/cuda/platform.cpp @@ -99,7 +99,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetInfo( return ReturnValue(""); } case UR_PLATFORM_INFO_BACKEND: { - return ReturnValue(UR_PLATFORM_BACKEND_CUDA); + return ReturnValue(UR_BACKEND_CUDA); } case UR_PLATFORM_INFO_ADAPTER: { return ReturnValue(&adapter); diff --git a/source/adapters/hip/adapter.cpp b/source/adapters/hip/adapter.cpp index 9daaee8a29..8244d0a0bb 100644 --- a/source/adapters/hip/adapter.cpp +++ b/source/adapters/hip/adapter.cpp @@ -94,7 +94,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, switch (propName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_HIP); + return ReturnValue(UR_BACKEND_HIP); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(adapter.RefCount.load()); case UR_ADAPTER_INFO_VERSION: diff --git a/source/adapters/hip/platform.cpp b/source/adapters/hip/platform.cpp index fa0b07cc82..882c7fb913 100644 --- a/source/adapters/hip/platform.cpp +++ b/source/adapters/hip/platform.cpp @@ -30,7 +30,7 @@ urPlatformGetInfo(ur_platform_handle_t, ur_platform_info_t propName, return ReturnValue(Version.c_str()); } case UR_PLATFORM_INFO_BACKEND: { - return ReturnValue(UR_PLATFORM_BACKEND_HIP); + return ReturnValue(UR_BACKEND_HIP); } case UR_PLATFORM_INFO_EXTENSIONS: { return ReturnValue(""); diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index 6267c6c095..7e1ff260ca 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -706,7 +706,7 @@ ur_result_t urAdapterGetInfo(ur_adapter_handle_t, ur_adapter_info_t PropName, switch (PropName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_LEVEL_ZERO); + return ReturnValue(UR_BACKEND_LEVEL_ZERO); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(GlobalAdapter->RefCount.load()); case UR_ADAPTER_INFO_VERSION: { diff --git a/source/adapters/level_zero/platform.cpp b/source/adapters/level_zero/platform.cpp index 7b6ac3874c..eb02d9ec1f 100644 --- a/source/adapters/level_zero/platform.cpp +++ b/source/adapters/level_zero/platform.cpp @@ -94,7 +94,7 @@ ur_result_t urPlatformGetInfo( // return ReturnValue(Platform->ZeDriverApiVersion.c_str()); case UR_PLATFORM_INFO_BACKEND: - return ReturnValue(UR_PLATFORM_BACKEND_LEVEL_ZERO); + return ReturnValue(UR_BACKEND_LEVEL_ZERO); case UR_PLATFORM_INFO_ADAPTER: return ReturnValue(GlobalAdapter); default: diff --git a/source/adapters/native_cpu/adapter.cpp b/source/adapters/native_cpu/adapter.cpp index 1af605286e..0a74af7e67 100644 --- a/source/adapters/native_cpu/adapter.cpp +++ b/source/adapters/native_cpu/adapter.cpp @@ -55,7 +55,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, switch (propName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_NATIVE_CPU); + return ReturnValue(UR_BACKEND_NATIVE_CPU); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(Adapter.RefCount.load()); case UR_ADAPTER_INFO_VERSION: diff --git a/source/adapters/native_cpu/platform.cpp b/source/adapters/native_cpu/platform.cpp index 8e55037079..3621de651f 100644 --- a/source/adapters/native_cpu/platform.cpp +++ b/source/adapters/native_cpu/platform.cpp @@ -76,9 +76,11 @@ urPlatformGetInfo(ur_platform_handle_t hPlatform, ur_platform_info_t propName, return ReturnValue(""); case UR_PLATFORM_INFO_BACKEND: - return ReturnValue(UR_PLATFORM_BACKEND_NATIVE_CPU); + return ReturnValue(UR_BACKEND_NATIVE_CPU); + case UR_PLATFORM_INFO_ADAPTER: return ReturnValue(&Adapter); + default: DIE_NO_IMPLEMENTATION; } diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 365723f14e..e586fffc56 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -126,7 +126,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, switch (propName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_OPENCL); + return ReturnValue(UR_BACKEND_OPENCL); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(adapter->RefCount.load()); case UR_ADAPTER_INFO_VERSION: diff --git a/source/adapters/opencl/platform.cpp b/source/adapters/opencl/platform.cpp index 1400f27cf4..d13fd08ab9 100644 --- a/source/adapters/opencl/platform.cpp +++ b/source/adapters/opencl/platform.cpp @@ -57,7 +57,7 @@ urPlatformGetInfo(ur_platform_handle_t hPlatform, ur_platform_info_t propName, switch (static_cast(propName)) { case UR_PLATFORM_INFO_BACKEND: - return ReturnValue(UR_PLATFORM_BACKEND_OPENCL); + return ReturnValue(UR_BACKEND_OPENCL); case UR_PLATFORM_INFO_ADAPTER: return ReturnValue(ur::cl::getAdapter()); case UR_PLATFORM_INFO_NAME: diff --git a/source/loader/loader.def.in b/source/loader/loader.def.in index 1425c602d6..047c80a5bc 100644 --- a/source/loader/loader.def.in +++ b/source/loader/loader.def.in @@ -166,7 +166,6 @@ EXPORTS urPlatformGetBackendOption urPlatformGetInfo urPlatformGetNativeHandle - urPrintAdapterBackend urPrintAdapterGetInfoParams urPrintAdapterGetLastErrorParams urPrintAdapterGetParams @@ -174,6 +173,7 @@ EXPORTS urPrintAdapterReleaseParams urPrintAdapterRetainParams urPrintApiVersion + urPrintBackend urPrintBaseDesc urPrintBaseProperties urPrintBindlessImagesImageAllocateExpParams @@ -397,7 +397,6 @@ EXPORTS urPrintPhysicalMemProperties urPrintPhysicalMemReleaseParams urPrintPhysicalMemRetainParams - urPrintPlatformBackend urPrintPlatformCreateWithNativeHandleParams urPrintPlatformGetApiVersionParams urPrintPlatformGetBackendOptionParams diff --git a/source/loader/loader.map.in b/source/loader/loader.map.in index ebb413c985..49a8310cf5 100644 --- a/source/loader/loader.map.in +++ b/source/loader/loader.map.in @@ -166,7 +166,6 @@ urPlatformGetBackendOption; urPlatformGetInfo; urPlatformGetNativeHandle; - urPrintAdapterBackend; urPrintAdapterGetInfoParams; urPrintAdapterGetLastErrorParams; urPrintAdapterGetParams; @@ -174,6 +173,7 @@ urPrintAdapterReleaseParams; urPrintAdapterRetainParams; urPrintApiVersion; + urPrintBackend; urPrintBaseDesc; urPrintBaseProperties; urPrintBindlessImagesImageAllocateExpParams; @@ -397,7 +397,6 @@ urPrintPhysicalMemProperties; urPrintPhysicalMemReleaseParams; urPrintPhysicalMemRetainParams; - urPrintPlatformBackend; urPrintPlatformCreateWithNativeHandleParams; urPrintPlatformGetApiVersionParams; urPrintPlatformGetBackendOptionParams; diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index ef46895861..72f65c462c 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -374,34 +374,34 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, ")$", std::regex_constants::icase); - ur_platform_backend_t platformBackend; + ur_backend_t platformBackend; if (UR_RESULT_SUCCESS != urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &platformBackend, 0)) { + sizeof(ur_backend_t), &platformBackend, 0)) { return UR_RESULT_ERROR_INVALID_PLATFORM; } const std::string platformBackendName = // hPlatform->get_backend_name(); [&platformBackend]() constexpr { switch (platformBackend) { - case UR_PLATFORM_BACKEND_UNKNOWN: + case UR_BACKEND_UNKNOWN: return "*"; // the only ODS string that matches break; - case UR_PLATFORM_BACKEND_LEVEL_ZERO: + case UR_BACKEND_LEVEL_ZERO: return "level_zero"; break; - case UR_PLATFORM_BACKEND_OPENCL: + case UR_BACKEND_OPENCL: return "opencl"; break; - case UR_PLATFORM_BACKEND_CUDA: + case UR_BACKEND_CUDA: return "cuda"; break; - case UR_PLATFORM_BACKEND_HIP: + case UR_BACKEND_HIP: return "hip"; break; - case UR_PLATFORM_BACKEND_NATIVE_CPU: + case UR_BACKEND_NATIVE_CPU: return "*"; // the only ODS string that matches break; - case UR_PLATFORM_BACKEND_FORCE_UINT32: + case UR_BACKEND_FORCE_UINT32: return ""; // no ODS string matches this break; default: diff --git a/source/loader/ur_print.cpp b/source/loader/ur_print.cpp index d75272a1ae..bed420a21a 100644 --- a/source/loader/ur_print.cpp +++ b/source/loader/ur_print.cpp @@ -92,6 +92,13 @@ ur_result_t urPrintRectRegion(const struct ur_rect_region_t params, return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t urPrintBackend(enum ur_backend_t value, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << value; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintDeviceInitFlags(enum ur_device_init_flag_t value, char *buffer, const size_t buff_size, size_t *out_size) { @@ -123,13 +130,6 @@ ur_result_t urPrintAdapterInfo(enum ur_adapter_info_t value, char *buffer, return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintAdapterBackend(enum ur_adapter_backend_t value, char *buffer, - const size_t buff_size, size_t *out_size) { - std::stringstream ss; - ss << value; - return str_copy(&ss, buffer, buff_size, out_size); -} - ur_result_t urPrintPlatformInfo(enum ur_platform_info_t value, char *buffer, const size_t buff_size, size_t *out_size) { std::stringstream ss; @@ -152,14 +152,6 @@ ur_result_t urPrintPlatformNativeProperties( return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintPlatformBackend(enum ur_platform_backend_t value, - char *buffer, const size_t buff_size, - size_t *out_size) { - std::stringstream ss; - ss << value; - return str_copy(&ss, buffer, buff_size, out_size); -} - ur_result_t urPrintDeviceBinary(const struct ur_device_binary_t params, char *buffer, const size_t buff_size, size_t *out_size) { diff --git a/test/conformance/adapter/urAdapterGetInfo.cpp b/test/conformance/adapter/urAdapterGetInfo.cpp index ed5d356147..2be5da1c3c 100644 --- a/test/conformance/adapter/urAdapterGetInfo.cpp +++ b/test/conformance/adapter/urAdapterGetInfo.cpp @@ -19,14 +19,14 @@ TEST_P(urAdapterGetInfoTest, SuccessBackend) { ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urAdapterGetInfo(adapter, property_name, 0, nullptr, &property_size), property_name); - ASSERT_EQ(property_size, sizeof(ur_adapter_backend_t)); + ASSERT_EQ(property_size, sizeof(ur_backend_t)); - ur_adapter_backend_t property_value = UR_ADAPTER_BACKEND_UNKNOWN; + ur_backend_t property_value = UR_BACKEND_UNKNOWN; ASSERT_SUCCESS(urAdapterGetInfo(adapter, property_name, property_size, &property_value, nullptr)); - ASSERT_TRUE(property_value >= UR_ADAPTER_BACKEND_LEVEL_ZERO && - property_value <= UR_ADAPTER_BACKEND_NATIVE_CPU); + ASSERT_TRUE(property_value >= UR_BACKEND_LEVEL_ZERO && + property_value <= UR_BACKEND_NATIVE_CPU); } TEST_P(urAdapterGetInfoTest, SuccessReferenceCount) { @@ -78,21 +78,21 @@ TEST_P(urAdapterGetInfoTest, InvalidEnumerationAdapterInfoType) { } TEST_P(urAdapterGetInfoTest, InvalidSizeZero) { - ur_adapter_backend_t backend = UR_ADAPTER_BACKEND_UNKNOWN; + ur_backend_t backend = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT( urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, 0, &backend, nullptr), UR_RESULT_ERROR_INVALID_SIZE); } TEST_P(urAdapterGetInfoTest, InvalidSizeSmall) { - ur_adapter_backend_t backend = UR_ADAPTER_BACKEND_UNKNOWN; + ur_backend_t backend = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT(urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, sizeof(backend) - 1, &backend, nullptr), UR_RESULT_ERROR_INVALID_SIZE); } TEST_P(urAdapterGetInfoTest, InvalidNullPointerPropValue) { - const ur_adapter_backend_t backend = UR_ADAPTER_BACKEND_UNKNOWN; + const ur_backend_t backend = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT(urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, sizeof(backend), nullptr, nullptr), UR_RESULT_ERROR_INVALID_NULL_POINTER); diff --git a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index ef5c0228ed..411673284d 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp @@ -158,14 +158,12 @@ TEST_P(urEnqueueKernelLaunchTest, InvalidKernelArgs) { UUR_KNOWN_FAILURE_ON(uur::CUDA{}, uur::HIP{}); UUR_KNOWN_FAILURE_ON(uur::LevelZero{}, uur::LevelZeroV2{}); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); + sizeof(ur_backend_t), &backend, nullptr)); - if (backend == UR_PLATFORM_BACKEND_CUDA || - backend == UR_PLATFORM_BACKEND_HIP || - backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_CUDA || backend == UR_BACKEND_HIP || + backend == UR_BACKEND_LEVEL_ZERO) { GTEST_FAIL() << "AMD, L0 and Nvidia can't check kernel arguments."; } diff --git a/test/conformance/exp_command_buffer/fixtures.h b/test/conformance/exp_command_buffer/fixtures.h index e0ddc0b389..24cc7f9ffc 100644 --- a/test/conformance/exp_command_buffer/fixtures.h +++ b/test/conformance/exp_command_buffer/fixtures.h @@ -163,7 +163,7 @@ struct urUpdatableCommandBufferExpTest : uur::urQueueTest { } ur_exp_command_buffer_handle_t updatable_cmd_buf_handle = nullptr; - ur_platform_backend_t backend{}; + ur_backend_t backend{}; }; struct urUpdatableCommandBufferExpExecutionTest : uur::urKernelExecutionTest { @@ -200,7 +200,7 @@ struct urUpdatableCommandBufferExpExecutionTest : uur::urKernelExecutionTest { UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::TearDown()); } - ur_platform_backend_t backend{}; + ur_backend_t backend{}; ur_exp_command_buffer_handle_t updatable_cmd_buf_handle = nullptr; }; @@ -248,7 +248,7 @@ struct TestKernel { std::shared_ptr> ILBinary; std::vector Metadatas{}; - ur_platform_backend_t Backend; + ur_backend_t Backend; ASSERT_SUCCESS(urPlatformGetInfo(Platform, UR_PLATFORM_INFO_BACKEND, sizeof(Backend), &Backend, nullptr)); diff --git a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp index c76ac3e111..227df67596 100644 --- a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp @@ -26,7 +26,7 @@ struct BufferFillCommandTest // Add accessor arguments depending on backend. // HIP has 3 offset parameters and other backends only have 1. - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { size_t val = 0; ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++, sizeof(size_t), nullptr, &val)); @@ -105,7 +105,7 @@ TEST_P(BufferFillCommandTest, UpdateParameters) { }; // Set argument index 2 as new value to fill (index 1 is buffer accessor) - const uint32_t arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 4 : 2; + const uint32_t arg_index = (backend == UR_BACKEND_HIP) ? 4 : 2; uint32_t new_val = 33; ur_exp_command_buffer_update_value_arg_desc_t new_input_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype @@ -239,7 +239,7 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) { &output_update_desc)); uint32_t new_val = 33; - const uint32_t arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 4 : 2; + const uint32_t arg_index = (backend == UR_BACKEND_HIP) ? 4 : 2; ur_exp_command_buffer_update_value_arg_desc_t new_input_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -302,7 +302,7 @@ TEST_P(BufferFillCommandTest, OverrideUpdate) { ASSERT_SUCCESS(urQueueFinish(queue)); ValidateBuffer(buffer, sizeof(val) * global_size, val); - const uint32_t arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 4 : 2; + const uint32_t arg_index = (backend == UR_BACKEND_HIP) ? 4 : 2; uint32_t first_val = 33; ur_exp_command_buffer_update_value_arg_desc_t first_input_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype @@ -377,7 +377,7 @@ TEST_P(BufferFillCommandTest, OverrideArgList) { ValidateBuffer(buffer, sizeof(val) * global_size, val); ur_exp_command_buffer_update_value_arg_desc_t input_descs[2]; - const uint32_t arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 4 : 2; + const uint32_t arg_index = (backend == UR_BACKEND_HIP) ? 4 : 2; uint32_t first_val = 33; input_descs[0] = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype diff --git a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp index 55b408b96b..1a45543c46 100644 --- a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp @@ -39,7 +39,7 @@ struct BufferSaxpyKernelTest // Lambda to add accessor arguments depending on backend. // HIP has 3 offset parameters and other backends only have 1. auto addAccessorArgs = [&]() { - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { size_t val = 0; ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++, sizeof(size_t), nullptr, &val)); @@ -142,7 +142,7 @@ TEST_P(BufferSaxpyKernelTest, UpdateParameters) { ur_exp_command_buffer_update_memobj_arg_desc_t new_input_descs[2]; // Index 5 on HIP and 3 on non-HIP is X buffer - const uint32_t x_arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 5 : 3; + const uint32_t x_arg_index = (backend == UR_BACKEND_HIP) ? 5 : 3; new_input_descs[0] = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype nullptr, // pNext @@ -152,7 +152,7 @@ TEST_P(BufferSaxpyKernelTest, UpdateParameters) { }; // Index 9 on HIP and 5 on non-HIP is Y buffer - const uint32_t y_arg_index = backend == (UR_PLATFORM_BACKEND_HIP) ? 9 : 5; + const uint32_t y_arg_index = backend == (UR_BACKEND_HIP) ? 9 : 5; new_input_descs[1] = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype nullptr, // pNext @@ -162,7 +162,7 @@ TEST_P(BufferSaxpyKernelTest, UpdateParameters) { }; // Index 4 on HIP and 2 on non-HIP is A - const uint32_t a_arg_index = (backend == UR_PLATFORM_BACKEND_HIP) ? 4 : 2; + const uint32_t a_arg_index = (backend == UR_BACKEND_HIP) ? 4 : 2; uint32_t new_A = 33; ur_exp_command_buffer_update_value_arg_desc_t new_A_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype diff --git a/test/conformance/exp_command_buffer/update/local_memory_update.cpp b/test/conformance/exp_command_buffer/update/local_memory_update.cpp index 1621b902a9..0ba44eb38a 100644 --- a/test/conformance/exp_command_buffer/update/local_memory_update.cpp +++ b/test/conformance/exp_command_buffer/update/local_memory_update.cpp @@ -19,7 +19,7 @@ struct LocalMemoryUpdateTestBase // HIP has extra args for local memory so we define an offset for arg // indices here for updating - hip_arg_offset = backend == UR_PLATFORM_BACKEND_HIP ? 3 : 0; + hip_arg_offset = backend == UR_BACKEND_HIP ? 3 : 0; ur_device_usm_access_capability_flags_t shared_usm_flags; ASSERT_SUCCESS( uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags)); @@ -43,7 +43,7 @@ struct LocalMemoryUpdateTestBase local_mem_a_size, nullptr)); // Hip has extra args for local mem at index 1-3 - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -58,7 +58,7 @@ struct LocalMemoryUpdateTestBase // Index 1 is local_mem_b arg ASSERT_SUCCESS(urKernelSetArgLocal(kernel, current_index++, local_mem_b_size, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -405,7 +405,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersSmallerLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { new_value_descs.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -443,7 +443,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersSmallerLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { new_value_descs.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -559,7 +559,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersLargerLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { new_value_descs.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -597,7 +597,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersLargerLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { new_value_descs.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -714,7 +714,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersPartialLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { new_value_descs.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -805,7 +805,7 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersPartialLocalSize) { nullptr, // hArgValue }); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { second_update_value_args.push_back({ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -1082,7 +1082,7 @@ struct LocalMemoryUpdateTestBaseOutOfOrder : LocalMemoryUpdateTestBase { // HIP has extra args for local memory so we define an offset for arg // indices here for updating - hip_arg_offset = backend == UR_PLATFORM_BACKEND_HIP ? 3 : 0; + hip_arg_offset = backend == UR_BACKEND_HIP ? 3 : 0; ur_device_usm_access_capability_flags_t shared_usm_flags; ASSERT_SUCCESS( uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags)); @@ -1102,7 +1102,7 @@ struct LocalMemoryUpdateTestBaseOutOfOrder : LocalMemoryUpdateTestBase { } std::array index_order{}; - if (backend != UR_PLATFORM_BACKEND_HIP) { + if (backend != UR_BACKEND_HIP) { index_order = {3, 2, 4, 5, 1, 0}; } else { index_order = {9, 8, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3}; @@ -1126,7 +1126,7 @@ struct LocalMemoryUpdateTestBaseOutOfOrder : LocalMemoryUpdateTestBase { // Index 1 is local_mem_b arg ASSERT_SUCCESS(urKernelSetArgLocal(kernel, index_order[current_index++], local_mem_b_size, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, index_order[current_index++], sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -1143,7 +1143,7 @@ struct LocalMemoryUpdateTestBaseOutOfOrder : LocalMemoryUpdateTestBase { local_mem_a_size, nullptr)); // Hip has extra args for local mem at index 1-3 - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, index_order[current_index++], sizeof(hip_local_offset), nullptr, &hip_local_offset)); diff --git a/test/conformance/kernel/urKernelGetInfo.cpp b/test/conformance/kernel/urKernelGetInfo.cpp index 8e68e1785d..6684345ddb 100644 --- a/test/conformance/kernel/urKernelGetInfo.cpp +++ b/test/conformance/kernel/urKernelGetInfo.cpp @@ -109,11 +109,10 @@ TEST_P(urKernelGetInfoTest, SuccessAttributes) { ASSERT_TRUE(uur::stringPropertyIsValid(property_value.data(), property_size)); const std::string returned_attributes = std::string(property_value.data()); - ur_platform_backend_t backend = UR_PLATFORM_BACKEND_FORCE_UINT32; + ur_backend_t backend = UR_BACKEND_FORCE_UINT32; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend == UR_PLATFORM_BACKEND_OPENCL || - backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_OPENCL || backend == UR_BACKEND_LEVEL_ZERO) { // Older intel drivers don't attach any default attributes and newer // ones force walk order to X/Y/Z using special attribute. ASSERT_TRUE(returned_attributes.empty() || diff --git a/test/conformance/kernel/urKernelSetArgLocal.cpp b/test/conformance/kernel/urKernelSetArgLocal.cpp index 850e13e392..323ee6da97 100644 --- a/test/conformance/kernel/urKernelSetArgLocal.cpp +++ b/test/conformance/kernel/urKernelSetArgLocal.cpp @@ -50,7 +50,7 @@ struct urKernelSetArgLocalMultiTest : uur::urKernelExecutionTest { // HIP has extra args for local memory so we define an offset for arg // indices here for updating - hip_arg_offset = backend == UR_PLATFORM_BACKEND_HIP ? 3 : 0; + hip_arg_offset = backend == UR_BACKEND_HIP ? 3 : 0; ur_device_usm_access_capability_flags_t shared_usm_flags; ASSERT_SUCCESS( uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags)); @@ -74,7 +74,7 @@ struct urKernelSetArgLocalMultiTest : uur::urKernelExecutionTest { local_mem_a_size, nullptr)); // Hip has extra args for local mem at index 1-3 - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -89,7 +89,7 @@ struct urKernelSetArgLocalMultiTest : uur::urKernelExecutionTest { // Index 1 is local_mem_b arg ASSERT_SUCCESS(urKernelSetArgLocal(kernel, current_index++, local_mem_b_size, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -145,7 +145,7 @@ struct urKernelSetArgLocalMultiTest : uur::urKernelExecutionTest { uint32_t hip_arg_offset = 0; static constexpr uint64_t hip_local_offset = 0; - ur_platform_backend_t backend{}; + ur_backend_t backend{}; }; UUR_INSTANTIATE_DEVICE_TEST_SUITE(urKernelSetArgLocalMultiTest); @@ -203,7 +203,7 @@ TEST_P(urKernelSetArgLocalMultiTest, Overwrite) { new_local_mem_a_size, nullptr)); // Hip has extra args for local mem at index 1-3 - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -218,7 +218,7 @@ TEST_P(urKernelSetArgLocalMultiTest, Overwrite) { // Index 1 is local_mem_b arg ASSERT_SUCCESS(urKernelSetArgLocal(kernel, current_index++, new_local_mem_b_size, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_index++, sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -249,7 +249,7 @@ struct urKernelSetArgLocalOutOfOrder : urKernelSetArgLocalMultiTest { // HIP has extra args for local memory so we define an offset for arg // indices here for updating - hip_arg_offset = backend == UR_PLATFORM_BACKEND_HIP ? 3 : 0; + hip_arg_offset = backend == UR_BACKEND_HIP ? 3 : 0; ur_device_usm_access_capability_flags_t shared_usm_flags; ASSERT_SUCCESS( uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags)); @@ -269,7 +269,7 @@ struct urKernelSetArgLocalOutOfOrder : urKernelSetArgLocalMultiTest { } std::array index_order{}; - if (backend != UR_PLATFORM_BACKEND_HIP) { + if (backend != UR_BACKEND_HIP) { index_order = {3, 2, 4, 5, 1, 0}; } else { index_order = {9, 8, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3}; @@ -293,7 +293,7 @@ struct urKernelSetArgLocalOutOfOrder : urKernelSetArgLocalMultiTest { // Index 1 is local_mem_b arg ASSERT_SUCCESS(urKernelSetArgLocal(kernel, index_order[current_index++], local_mem_b_size, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, index_order[current_index++], sizeof(hip_local_offset), nullptr, &hip_local_offset)); @@ -310,7 +310,7 @@ struct urKernelSetArgLocalOutOfOrder : urKernelSetArgLocalMultiTest { local_mem_a_size, nullptr)); // Hip has extra args for local mem at index 1-3 - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { ASSERT_SUCCESS(urKernelSetArgValue(kernel, index_order[current_index++], sizeof(hip_local_offset), nullptr, &hip_local_offset)); diff --git a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp index 52a63186fc..0cae4dde0d 100644 --- a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp +++ b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp @@ -97,10 +97,10 @@ struct urMultiDeviceContextMemBufferTest : urMultiDeviceContextTest { // the AMD backend handles this differently and uses three separate // arguments for each of the three dimensions of the accessor. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { // this emulates the three offset params for buffer accessor on AMD. size_t val = 0; ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index + 1, diff --git a/test/conformance/platform/urPlatformGetInfo.cpp b/test/conformance/platform/urPlatformGetInfo.cpp index d9b22d1efb..a3a3b664c0 100644 --- a/test/conformance/platform/urPlatformGetInfo.cpp +++ b/test/conformance/platform/urPlatformGetInfo.cpp @@ -99,14 +99,14 @@ TEST_P(urPlatformGetInfoTest, SuccessBackend) { ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urPlatformGetInfo(platform, property_name, 0, nullptr, &property_size), property_name); - ASSERT_EQ(property_size, sizeof(ur_platform_backend_t)); + ASSERT_EQ(property_size, sizeof(ur_backend_t)); - ur_platform_backend_t property_value = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t property_value = UR_BACKEND_UNKNOWN; ASSERT_SUCCESS(urPlatformGetInfo(platform, property_name, property_size, &property_value, nullptr)); - ASSERT_TRUE(property_value >= UR_PLATFORM_BACKEND_LEVEL_ZERO && - property_value <= UR_PLATFORM_BACKEND_NATIVE_CPU); + ASSERT_TRUE(property_value >= UR_BACKEND_LEVEL_ZERO && + property_value <= UR_BACKEND_NATIVE_CPU); } TEST_P(urPlatformGetInfoTest, SuccessAdapter) { @@ -143,14 +143,14 @@ TEST_P(urPlatformGetInfoTest, InvalidEnumerationPlatformInfoType) { } TEST_P(urPlatformGetInfoTest, InvalidSizeZero) { - ur_platform_backend_t property_value = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t property_value = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, 0, &property_value, nullptr), UR_RESULT_ERROR_INVALID_SIZE); } TEST_P(urPlatformGetInfoTest, InvalidSizeSmall) { - ur_platform_backend_t property_value = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t property_value = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(property_value) - 1, &property_value, nullptr), @@ -158,7 +158,7 @@ TEST_P(urPlatformGetInfoTest, InvalidSizeSmall) { } TEST_P(urPlatformGetInfoTest, InvalidNullPointerPropValue) { - ur_platform_backend_t property_value = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t property_value = UR_BACKEND_UNKNOWN; ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(property_value), nullptr, nullptr), UR_RESULT_ERROR_INVALID_NULL_POINTER); diff --git a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp index 0094caa274..f27fc5ee6e 100644 --- a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp +++ b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp @@ -86,17 +86,17 @@ TEST_P(urMultiDeviceProgramCreateWithBinaryTest, CheckCompileAndLink) { // Level Zero and link only programs in Object state. OpenCL allows to compile // and link programs created from native binaries, so probably we should align // those two. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_LEVEL_ZERO) { ASSERT_EQ(urProgramCompile(context, binary_program, nullptr), UR_RESULT_ERROR_INVALID_OPERATION); uur::raii::Program linked_program; ASSERT_EQ(urProgramLink(context, 1, &binary_program, nullptr, linked_program.ptr()), UR_RESULT_ERROR_INVALID_OPERATION); - } else if (backend == UR_PLATFORM_BACKEND_OPENCL) { + } else if (backend == UR_BACKEND_OPENCL) { ASSERT_SUCCESS(urProgramCompile(context, binary_program, nullptr)); uur::raii::Program linked_program; ASSERT_SUCCESS(urProgramLink(context, 1, &binary_program, nullptr, @@ -124,10 +124,10 @@ TEST_P(urMultiDeviceProgramCreateWithBinaryTest, // context. TEST_P(urMultiDeviceProgramCreateWithBinaryTest, MultipleBuildCalls) { // Run test only for level zero backend which supports urProgramBuildExp. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend != UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend != UR_BACKEND_LEVEL_ZERO) { GTEST_SKIP(); } auto first_subset = std::vector( diff --git a/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp b/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp index b999ae7a2b..21524981a9 100644 --- a/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp +++ b/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp @@ -15,10 +15,10 @@ UUR_INSTANTIATE_PLATFORM_TEST_SUITE(urMultiDeviceProgramTest); // built for a subset of devices in the context. TEST_P(urMultiDeviceProgramTest, urMultiDeviceProgramGetInfo) { // Run test only for level zero backend which supports urProgramBuildExp. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend != UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend != UR_BACKEND_LEVEL_ZERO) { GTEST_SKIP(); } diff --git a/test/conformance/program/urProgramBuild.cpp b/test/conformance/program/urProgramBuild.cpp index 40bffa721e..1e101fa4c9 100644 --- a/test/conformance/program/urProgramBuild.cpp +++ b/test/conformance/program/urProgramBuild.cpp @@ -46,11 +46,10 @@ TEST_P(urProgramBuildTest, BuildFailure) { // TODO: This seems to fail on opencl/device combination used in the Github // runners (`2023.16.12.0.12_195853.xmain-hotfix`). It segfaults, so we just // skip the test so other tests can run - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_OPENCL) { + sizeof(ur_backend_t), &backend, nullptr)); + if (backend == UR_BACKEND_OPENCL) { GTEST_SKIP() << "Skipping opencl build failure test - segfaults on CI"; } diff --git a/test/conformance/program/urProgramCreateWithIL.cpp b/test/conformance/program/urProgramCreateWithIL.cpp index e70ae0a922..2752df254c 100644 --- a/test/conformance/program/urProgramCreateWithIL.cpp +++ b/test/conformance/program/urProgramCreateWithIL.cpp @@ -15,11 +15,10 @@ struct urProgramCreateWithILTest : uur::urContextTest { UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp()); // TODO: This should use a query for urProgramCreateWithIL support or // rely on UR_RESULT_ERROR_UNSUPPORTED_FEATURE being returned. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + sizeof(ur_backend_t), &backend, nullptr)); + if (backend == UR_BACKEND_HIP) { GTEST_SKIP(); } uur::KernelsEnvironment::instance->LoadSource("foo", platform, il_binary); diff --git a/test/conformance/program/urProgramCreateWithNativeHandle.cpp b/test/conformance/program/urProgramCreateWithNativeHandle.cpp index 9726f7f53e..08a716a88e 100644 --- a/test/conformance/program/urProgramCreateWithNativeHandle.cpp +++ b/test/conformance/program/urProgramCreateWithNativeHandle.cpp @@ -11,11 +11,11 @@ struct urProgramCreateWithNativeHandleTest : uur::urProgramTest { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(urProgramTest::SetUp()); { - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // For Level Zero we have to build the program to have the native handle. - if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_LEVEL_ZERO) { ASSERT_SUCCESS(urProgramBuild(context, program, nullptr)); } UUR_ASSERT_SUCCESS_OR_UNSUPPORTED( diff --git a/test/conformance/program/urProgramGetFunctionPointer.cpp b/test/conformance/program/urProgramGetFunctionPointer.cpp index 267e4412af..9243701000 100644 --- a/test/conformance/program/urProgramGetFunctionPointer.cpp +++ b/test/conformance/program/urProgramGetFunctionPointer.cpp @@ -36,12 +36,12 @@ TEST_P(urProgramGetFunctionPointerTest, InvalidKernelName) { std::string missing_function = "aFakeFunctionName"; auto result = urProgramGetFunctionPointer( device, program, missing_function.data(), &function_pointer); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // TODO: level zero backend incorrectly returns // UR_RESULT_ERROR_UNSUPPORTED_FEATURE - if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_LEVEL_ZERO) { ASSERT_EQ(UR_RESULT_ERROR_UNSUPPORTED_FEATURE, result); } else { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_NAME, result); diff --git a/test/conformance/program/urProgramGetGlobalVariablePointer.cpp b/test/conformance/program/urProgramGetGlobalVariablePointer.cpp index bb58fe0c0a..b638d96cf3 100644 --- a/test/conformance/program/urProgramGetGlobalVariablePointer.cpp +++ b/test/conformance/program/urProgramGetGlobalVariablePointer.cpp @@ -62,11 +62,10 @@ TEST_P(urProgramGetGlobalVariablePointerTest, } TEST_P(urProgramGetGlobalVariablePointerTest, InvalidProgramExecutable) { - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend != UR_PLATFORM_BACKEND_LEVEL_ZERO) { + sizeof(ur_backend_t), &backend, nullptr)); + if (backend != UR_BACKEND_LEVEL_ZERO) { GTEST_SKIP(); } // Get IL from the compiled program. diff --git a/test/conformance/program/urProgramGetNativeHandle.cpp b/test/conformance/program/urProgramGetNativeHandle.cpp index 2e357e5a59..f836a83d98 100644 --- a/test/conformance/program/urProgramGetNativeHandle.cpp +++ b/test/conformance/program/urProgramGetNativeHandle.cpp @@ -10,11 +10,11 @@ using urProgramGetNativeHandleTest = uur::urProgramTest; UUR_INSTANTIATE_DEVICE_TEST_SUITE(urProgramGetNativeHandleTest); TEST_P(urProgramGetNativeHandleTest, Success) { - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // For Level Zero we have to build the program to have the native handle. - if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend == UR_BACKEND_LEVEL_ZERO) { ASSERT_SUCCESS(urProgramBuild(context, program, nullptr)); } ur_native_handle_t native_program_handle = 0; diff --git a/test/conformance/program/urProgramLink.cpp b/test/conformance/program/urProgramLink.cpp index c7eecfed54..eb6d4ac798 100644 --- a/test/conformance/program/urProgramLink.cpp +++ b/test/conformance/program/urProgramLink.cpp @@ -12,11 +12,10 @@ struct urProgramLinkTest : uur::urProgramTest { UUR_RETURN_ON_FATAL_FAILURE(urProgramTest::SetUp()); // TODO: This should use a query for urProgramCreateWithIL support or // rely on UR_RESULT_ERROR_UNSUPPORTED_FEATURE being returned. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + sizeof(ur_backend_t), &backend, nullptr)); + if (backend == UR_BACKEND_HIP) { GTEST_SKIP(); } ASSERT_SUCCESS(urProgramCompile(context, program, nullptr)); @@ -43,15 +42,14 @@ struct urProgramLinkErrorTest : uur::urQueueTest { UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp()); // TODO: This should use a query for urProgramCreateWithIL support or // rely on UR_RESULT_ERROR_UNSUPPORTED_FEATURE being returned. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + sizeof(ur_backend_t), &backend, nullptr)); + if (backend == UR_BACKEND_HIP) { GTEST_SKIP(); } // Don't know how to produce alinker error on CUDA - if (backend == UR_PLATFORM_BACKEND_CUDA) { + if (backend == UR_BACKEND_CUDA) { GTEST_SKIP(); } diff --git a/test/conformance/program/urProgramSetSpecializationConstants.cpp b/test/conformance/program/urProgramSetSpecializationConstants.cpp index 1e99de684a..b3d25a66fb 100644 --- a/test/conformance/program/urProgramSetSpecializationConstants.cpp +++ b/test/conformance/program/urProgramSetSpecializationConstants.cpp @@ -91,15 +91,8 @@ TEST_P(urProgramSetSpecializationConstantsNegativeTest, Unsupported) { } TEST_P(urProgramSetSpecializationConstantsTest, UseDefaultValue) { - ur_platform_backend_t backend; - ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_CUDA || - backend == UR_PLATFORM_BACKEND_HIP) { - GTEST_FAIL() << "This test is known to cause crashes on Nvidia and " - "AMD; not running."; - } + // This test is known to cause crashes on Nvidia and AMD. + UUR_KNOWN_FAILURE_ON(uur::CUDA{}, uur::HIP{}); ASSERT_SUCCESS(urProgramBuild(context, program, nullptr)); auto entry_points = diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 6ada2ae4ba..7ff1e9e196 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -192,7 +192,7 @@ std::string KernelsEnvironment::getTargetName(ur_platform_handle_t platform) { } // special case for AMD as it doesn't support IL. - ur_platform_backend_t backend; + ur_backend_t backend; if (urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)) { error = "failed to get backend from platform."; @@ -201,14 +201,14 @@ std::string KernelsEnvironment::getTargetName(ur_platform_handle_t platform) { std::string target = ""; switch (backend) { - case UR_PLATFORM_BACKEND_OPENCL: - case UR_PLATFORM_BACKEND_LEVEL_ZERO: + case UR_BACKEND_OPENCL: + case UR_BACKEND_LEVEL_ZERO: return "spir64"; - case UR_PLATFORM_BACKEND_CUDA: + case UR_BACKEND_CUDA: return "nvptx64-nvidia-cuda"; - case UR_PLATFORM_BACKEND_HIP: + case UR_BACKEND_HIP: return "amdgcn-amd-amdhsa"; - case UR_PLATFORM_BACKEND_NATIVE_CPU: + case UR_BACKEND_NATIVE_CPU: error = "native_cpu doesn't support kernel tests yet"; return {}; default: @@ -277,14 +277,12 @@ ur_result_t KernelsEnvironment::CreateProgram( ur_platform_handle_t hPlatform, ur_context_handle_t hContext, ur_device_handle_t hDevice, const std::vector &binary, const ur_program_properties_t *properties, ur_program_handle_t *phProgram) { - ur_platform_backend_t backend; - if (auto error = - urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, nullptr)) { + ur_backend_t backend; + if (auto error = urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_BACKEND, + sizeof(ur_backend_t), &backend, nullptr)) { return error; } - if (backend == UR_PLATFORM_BACKEND_HIP || - backend == UR_PLATFORM_BACKEND_CUDA) { + if (backend == UR_BACKEND_HIP || backend == UR_BACKEND_CUDA) { // The CUDA and HIP adapters do not support urProgramCreateWithIL so we // need to use urProgramCreateWithBinary instead. auto size = binary.size(); diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index f05e1a521a..c19848825d 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -1236,11 +1236,11 @@ struct urProgramTest : urQueueTest { UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp()); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // Images and samplers are not available on AMD - if (program_name == "image_copy" && backend == UR_PLATFORM_BACKEND_HIP) { + if (program_name == "image_copy" && backend == UR_BACKEND_HIP) { GTEST_SKIP(); } UUR_RETURN_ON_FATAL_FAILURE(uur::KernelsEnvironment::instance->LoadSource( @@ -1274,11 +1274,11 @@ template struct urProgramTestWithParam : urQueueTestWithParam { UUR_RETURN_ON_FATAL_FAILURE(urQueueTestWithParam::SetUp()); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(this->platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // Images and samplers are not available on AMD - if (program_name == "image_copy" && backend == UR_PLATFORM_BACKEND_HIP) { + if (program_name == "image_copy" && backend == UR_BACKEND_HIP) { GTEST_SKIP(); } @@ -1446,10 +1446,10 @@ struct KernelLaunchHelper { // the AMD backend handles this differently and uses three separate // arguments for each of the three dimensions of the accessor. - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP) { + if (backend == UR_BACKEND_HIP) { // this emulates the three offset params for buffer accessor on AMD. size_t val = 0; ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index + 1, @@ -1683,12 +1683,11 @@ struct urMultiDeviceProgramTest : urMultiDeviceQueueTest { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceQueueTest::SetUp()); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, sizeof(backend), &backend, nullptr)); // Multi-device programs are not supported for AMD and CUDA - if (backend == UR_PLATFORM_BACKEND_HIP || - backend == UR_PLATFORM_BACKEND_CUDA) { + if (backend == UR_BACKEND_HIP || backend == UR_BACKEND_CUDA) { GTEST_SKIP(); } if (devices.size() < 2) { diff --git a/test/conformance/testing/include/uur/known_failure.h b/test/conformance/testing/include/uur/known_failure.h index 6c7992795b..e4775f2618 100644 --- a/test/conformance/testing/include/uur/known_failure.h +++ b/test/conformance/testing/include/uur/known_failure.h @@ -18,7 +18,7 @@ namespace uur { namespace detail { struct AdapterInfo { uint32_t version; - ur_adapter_backend_t backend; + ur_backend_t backend; }; inline AdapterInfo getAdapterInfo(ur_adapter_handle_t adapter) { @@ -32,7 +32,7 @@ inline AdapterInfo getAdapterInfo(ur_adapter_handle_t adapter) { } // namespace detail struct Matcher { - Matcher(uint32_t adapterVersion, ur_adapter_backend_t backend, + Matcher(uint32_t adapterVersion, ur_backend_t backend, std::vector deviceNames) : adapterVersion(adapterVersion), backend(backend), names(std::move(deviceNames)) {} @@ -57,38 +57,38 @@ struct Matcher { } uint32_t adapterVersion; - ur_adapter_backend_t backend; + ur_backend_t backend; std::vector names; }; struct OpenCL : Matcher { OpenCL(std::initializer_list il) - : Matcher(1, UR_ADAPTER_BACKEND_OPENCL, {il.begin(), il.end()}) {} + : Matcher(1, UR_BACKEND_OPENCL, {il.begin(), il.end()}) {} }; struct LevelZero : Matcher { LevelZero(std::initializer_list il) - : Matcher(1, UR_ADAPTER_BACKEND_LEVEL_ZERO, {il.begin(), il.end()}) {} + : Matcher(1, UR_BACKEND_LEVEL_ZERO, {il.begin(), il.end()}) {} }; struct LevelZeroV2 : Matcher { LevelZeroV2(std::initializer_list il) - : Matcher(2, UR_ADAPTER_BACKEND_LEVEL_ZERO, {il.begin(), il.end()}) {} + : Matcher(2, UR_BACKEND_LEVEL_ZERO, {il.begin(), il.end()}) {} }; struct CUDA : Matcher { CUDA(std::initializer_list il) - : Matcher(1, UR_ADAPTER_BACKEND_CUDA, {il.begin(), il.end()}) {} + : Matcher(1, UR_BACKEND_CUDA, {il.begin(), il.end()}) {} }; struct HIP : Matcher { HIP(std::initializer_list il) - : Matcher(1, UR_ADAPTER_BACKEND_HIP, {il.begin(), il.end()}) {} + : Matcher(1, UR_BACKEND_HIP, {il.begin(), il.end()}) {} }; struct NativeCPU : Matcher { NativeCPU(std::initializer_list il) - : Matcher(1, UR_ADAPTER_BACKEND_NATIVE_CPU, {il.begin(), il.end()}) {} + : Matcher(1, UR_BACKEND_NATIVE_CPU, {il.begin(), il.end()}) {} }; inline bool isKnownFailureOn(ur_adapter_handle_t adapter, diff --git a/test/conformance/testing/source/utils.cpp b/test/conformance/testing/source/utils.cpp index f605aa86fd..23525dbc9a 100644 --- a/test/conformance/testing/source/utils.cpp +++ b/test/conformance/testing/source/utils.cpp @@ -688,7 +688,7 @@ ur_result_t MakeUSMAllocationByType(ur_usm_type_t type, } std::string GetAdapterBackendName(ur_adapter_handle_t hAdapter) { - ur_adapter_backend_t backend = UR_ADAPTER_BACKEND_UNKNOWN; + ur_backend_t backend = UR_BACKEND_UNKNOWN; urAdapterGetInfo(hAdapter, UR_ADAPTER_INFO_BACKEND, sizeof(backend), &backend, nullptr); std::stringstream ss; diff --git a/tools/urinfo/urinfo.hpp b/tools/urinfo/urinfo.hpp index d01245138f..c73f9084cb 100644 --- a/tools/urinfo/urinfo.hpp +++ b/tools/urinfo/urinfo.hpp @@ -29,7 +29,7 @@ inline void printLoaderConfigInfos(ur_loader_config_handle_t hLoaderConfig, inline void printAdapterInfos(ur_adapter_handle_t hAdapter, std::string_view prefix = " ") { std::cout << prefix; - printAdapterInfo(hAdapter, UR_ADAPTER_INFO_BACKEND); + printAdapterInfo(hAdapter, UR_ADAPTER_INFO_BACKEND); std::cout << prefix; printAdapterInfo(hAdapter, UR_ADAPTER_INFO_VERSION); } @@ -47,7 +47,7 @@ inline void printPlatformInfos(ur_platform_handle_t hPlatform, std::cout << prefix; printPlatformInfo(hPlatform, UR_PLATFORM_INFO_PROFILE); std::cout << prefix; - printPlatformInfo(hPlatform, UR_PLATFORM_INFO_BACKEND); + printPlatformInfo(hPlatform, UR_PLATFORM_INFO_BACKEND); std::cout << prefix; printPlatformInfo(hPlatform, UR_PLATFORM_INFO_ADAPTER); } diff --git a/tools/urinfo/utils.hpp b/tools/urinfo/utils.hpp index fcc767a2ca..8e15779a20 100644 --- a/tools/urinfo/utils.hpp +++ b/tools/urinfo/utils.hpp @@ -42,14 +42,13 @@ inline std::string stripPrefix(std::string_view value, } inline std::string getAdapterBackend(ur_adapter_handle_t adapter) { - ur_adapter_backend_t adapterBackend; + ur_backend_t adapterBackend; UR_CHECK(urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, - sizeof(ur_adapter_backend_t), &adapterBackend, - nullptr)); + sizeof(ur_backend_t), &adapterBackend, nullptr)); std::stringstream adapterBackendStream; adapterBackendStream << adapterBackend; std::string adapterBackendStr = - stripPrefix(adapterBackendStream.str(), "UR_ADAPTER_BACKEND_"); + stripPrefix(adapterBackendStream.str(), "UR_BACKEND_"); std::transform(adapterBackendStr.begin(), adapterBackendStr.end(), adapterBackendStr.begin(), [](unsigned char c) { return std::tolower(c); }); @@ -128,8 +127,8 @@ inline void printLoaderConfigInfo(ur_loader_config_handle_t loaderConfig, ur_loader_config_info_t info) { std::cout << getLoaderConfigInfoName(info) << ": "; T value; - UR_CHECK(urLoaderConfigGetInfo( - loaderConfig, info, sizeof(ur_adapter_backend_t), &value, nullptr)); + UR_CHECK(urLoaderConfigGetInfo(loaderConfig, info, sizeof(ur_backend_t), + &value, nullptr)); std::cout << value << "\n"; } @@ -159,8 +158,8 @@ inline void printAdapterInfo(ur_adapter_handle_t adapter, ur_adapter_info_t info) { std::cout << getAdapterInfoName(info) << ": "; T value; - UR_CHECK(urAdapterGetInfo(adapter, info, sizeof(ur_adapter_backend_t), &value, - nullptr)); + UR_CHECK( + urAdapterGetInfo(adapter, info, sizeof(ur_backend_t), &value, nullptr)); std::cout << value << "\n"; }