diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 1e57ebf9888a1..694fe2967e3d3 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -48,19 +48,19 @@ static const AdapterPtr &getAdapter(backend Backend) { } } -backend convertUrBackend(ur_platform_backend_t UrBackend) { +backend convertUrBackend(ur_backend_t UrBackend) { switch (UrBackend) { - case UR_PLATFORM_BACKEND_UNKNOWN: + case UR_BACKEND_UNKNOWN: return backend::all; // No specific backend - case UR_PLATFORM_BACKEND_LEVEL_ZERO: + case UR_BACKEND_LEVEL_ZERO: return backend::ext_oneapi_level_zero; - case UR_PLATFORM_BACKEND_OPENCL: + case UR_BACKEND_OPENCL: return backend::opencl; - case UR_PLATFORM_BACKEND_CUDA: + case UR_BACKEND_CUDA: return backend::ext_oneapi_cuda; - case UR_PLATFORM_BACKEND_HIP: + case UR_BACKEND_HIP: return backend::ext_oneapi_hip; - case UR_PLATFORM_BACKEND_NATIVE_CPU: + case UR_BACKEND_NATIVE_CPU: return backend::ext_oneapi_native_cpu; default: throw exception(make_error_code(errc::runtime), diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index b27b95c1f1938..798425d536b74 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -208,10 +208,10 @@ platform_impl::filterDeviceFilter(std::vector &UrDevices, std::vector original_indices; // Find out backend of the platform - ur_platform_backend_t UrBackend = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t UrBackend = UR_BACKEND_UNKNOWN; MAdapter->call( - MPlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_platform_backend_t), - &UrBackend, nullptr); + MPlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_backend_t), &UrBackend, + nullptr); backend Backend = convertUrBackend(UrBackend); int InsertIDx = 0; diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 45d38c9c661f6..a46b14997d80f 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -41,10 +41,10 @@ class platform_impl { const std::shared_ptr &AAdapter) : MPlatform(APlatform), MAdapter(AAdapter) { // Find out backend of the platform - ur_platform_backend_t UrBackend = UR_PLATFORM_BACKEND_UNKNOWN; + ur_backend_t UrBackend = UR_BACKEND_UNKNOWN; AAdapter->call_nocheck( - APlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_platform_backend_t), - &UrBackend, nullptr); + APlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_backend_t), &UrBackend, + nullptr); MBackend = convertUrBackend(UrBackend); } diff --git a/sycl/source/detail/ur.cpp b/sycl/source/detail/ur.cpp index 5a799b2145048..e001d109b951a 100644 --- a/sycl/source/detail/ur.cpp +++ b/sycl/source/detail/ur.cpp @@ -193,17 +193,17 @@ static void initializeAdapters(std::vector &Adapters, std::vector adapters(adapterCount); CHECK_UR_SUCCESS(adapterGet(adapterCount, adapters.data(), nullptr)); - auto UrToSyclBackend = [](ur_adapter_backend_t backend) -> sycl::backend { + auto UrToSyclBackend = [](ur_backend_t backend) -> sycl::backend { switch (backend) { - case UR_ADAPTER_BACKEND_LEVEL_ZERO: + case UR_BACKEND_LEVEL_ZERO: return backend::ext_oneapi_level_zero; - case UR_ADAPTER_BACKEND_OPENCL: + case UR_BACKEND_OPENCL: return backend::opencl; - case UR_ADAPTER_BACKEND_CUDA: + case UR_BACKEND_CUDA: return backend::ext_oneapi_cuda; - case UR_ADAPTER_BACKEND_HIP: + case UR_BACKEND_HIP: return backend::ext_oneapi_hip; - case UR_ADAPTER_BACKEND_NATIVE_CPU: + case UR_BACKEND_NATIVE_CPU: return backend::ext_oneapi_native_cpu; default: // Throw an exception, this should be unreachable. @@ -213,7 +213,7 @@ static void initializeAdapters(std::vector &Adapters, }; for (const auto &UrAdapter : adapters) { - ur_adapter_backend_t adapterBackend = UR_ADAPTER_BACKEND_UNKNOWN; + ur_backend_t adapterBackend = UR_BACKEND_UNKNOWN; CHECK_UR_SUCCESS(adapterGetInfo(UrAdapter, UR_ADAPTER_INFO_BACKEND, sizeof(adapterBackend), &adapterBackend, nullptr)); diff --git a/sycl/source/detail/ur.hpp b/sycl/source/detail/ur.hpp index a599169ee3aec..bda521b412fcc 100644 --- a/sycl/source/detail/ur.hpp +++ b/sycl/source/detail/ur.hpp @@ -38,7 +38,7 @@ template const AdapterPtr &getAdapter(); } // namespace ur // Convert from UR backend to SYCL backend enum -backend convertUrBackend(ur_platform_backend_t UrBackend); +backend convertUrBackend(ur_backend_t UrBackend); } // namespace detail } // namespace _V1 diff --git a/sycl/unittests/Extensions/FPGADeviceSelectors.cpp b/sycl/unittests/Extensions/FPGADeviceSelectors.cpp index 01b1c035d18ea..0cd51c252cba8 100644 --- a/sycl/unittests/Extensions/FPGADeviceSelectors.cpp +++ b/sycl/unittests/Extensions/FPGADeviceSelectors.cpp @@ -35,7 +35,7 @@ template struct RedefTemplatedWrapper { return UR_RESULT_SUCCESS; } case UR_PLATFORM_INFO_BACKEND: { - constexpr auto MockPlatformBackend = UR_PLATFORM_BACKEND_UNKNOWN; + constexpr auto MockPlatformBackend = UR_BACKEND_UNKNOWN; if (*params.ppPropValue) { std::memcpy(*params.ppPropValue, &MockPlatformBackend, sizeof(MockPlatformBackend)); diff --git a/sycl/unittests/helpers/UrMock.hpp b/sycl/unittests/helpers/UrMock.hpp index a980789b71401..5a56277b2f438 100644 --- a/sycl/unittests/helpers/UrMock.hpp +++ b/sycl/unittests/helpers/UrMock.hpp @@ -83,7 +83,7 @@ inline ur_result_t mock_urDeviceGet(void *pParams) { inline ur_result_t mock_urDeviceRetain(void *) { return UR_RESULT_SUCCESS; } inline ur_result_t mock_urDeviceRelease(void *) { return UR_RESULT_SUCCESS; } -template +template inline ur_result_t mock_urAdapterGetInfo(void *pParams) { auto params = reinterpret_cast(pParams); @@ -100,7 +100,7 @@ inline ur_result_t mock_urAdapterGetInfo(void *pParams) { return UR_RESULT_SUCCESS; } -template +template inline ur_result_t mock_urPlatformGetInfo(void *pParams) { auto params = reinterpret_cast(pParams); constexpr char MockPlatformName[] = "Mock platform"; @@ -556,16 +556,14 @@ template class UrMock { #define ADD_DEFAULT_OVERRIDE(func_name, func_override) \ mock::getCallbacks().set_replace_callback(#func_name, \ &MockAdapter::func_override); - ADD_DEFAULT_OVERRIDE( - urAdapterGetInfo, - mock_urAdapterGetInfo) + ADD_DEFAULT_OVERRIDE(urAdapterGetInfo, + mock_urAdapterGetInfo) ADD_DEFAULT_OVERRIDE(urPlatformGet, mock_urPlatformGet) ADD_DEFAULT_OVERRIDE(urDeviceGet, mock_urDeviceGet) ADD_DEFAULT_OVERRIDE(urDeviceRetain, mock_urDeviceRetain) ADD_DEFAULT_OVERRIDE(urDeviceRelease, mock_urDeviceRelease) - ADD_DEFAULT_OVERRIDE( - urPlatformGetInfo, - mock_urPlatformGetInfo) + ADD_DEFAULT_OVERRIDE(urPlatformGetInfo, + mock_urPlatformGetInfo) ADD_DEFAULT_OVERRIDE(urDeviceGetInfo, mock_urDeviceGetInfo) ADD_DEFAULT_OVERRIDE(urProgramGetInfo, mock_urProgramGetInfo) ADD_DEFAULT_OVERRIDE(urContextGetInfo, mock_urContextGetInfo) @@ -619,39 +617,21 @@ template class UrMock { private: // These two helpers are needed to enable arbitrary backend selection // at compile time. - static constexpr ur_platform_backend_t - convertToUrPlatformBackend(const sycl::backend SyclBackend) { + static constexpr ur_backend_t + convertToUrBackend(const sycl::backend SyclBackend) { switch (SyclBackend) { case sycl::backend::opencl: - return UR_PLATFORM_BACKEND_OPENCL; + return UR_BACKEND_OPENCL; case sycl::backend::ext_oneapi_level_zero: - return UR_PLATFORM_BACKEND_LEVEL_ZERO; + return UR_BACKEND_LEVEL_ZERO; case sycl::backend::ext_oneapi_cuda: - return UR_PLATFORM_BACKEND_CUDA; + return UR_BACKEND_CUDA; case sycl::backend::ext_oneapi_hip: - return UR_PLATFORM_BACKEND_HIP; + return UR_BACKEND_HIP; case sycl::backend::ext_oneapi_native_cpu: - return UR_PLATFORM_BACKEND_NATIVE_CPU; + return UR_BACKEND_NATIVE_CPU; default: - return UR_PLATFORM_BACKEND_UNKNOWN; - } - } - - static constexpr ur_adapter_backend_t - convertToUrAdapterBackend(sycl::backend SyclBackend) { - switch (SyclBackend) { - case sycl::backend::opencl: - return UR_ADAPTER_BACKEND_OPENCL; - case sycl::backend::ext_oneapi_level_zero: - return UR_ADAPTER_BACKEND_LEVEL_ZERO; - case sycl::backend::ext_oneapi_cuda: - return UR_ADAPTER_BACKEND_CUDA; - case sycl::backend::ext_oneapi_hip: - return UR_ADAPTER_BACKEND_HIP; - case sycl::backend::ext_oneapi_native_cpu: - return UR_ADAPTER_BACKEND_NATIVE_CPU; - default: - return UR_ADAPTER_BACKEND_UNKNOWN; + return UR_BACKEND_UNKNOWN; } } }; diff --git a/unified-runtime/examples/codegen/codegen.cpp b/unified-runtime/examples/codegen/codegen.cpp index 7d45789063682..e631bf2dc556a 100644 --- a/unified-runtime/examples/codegen/codegen.cpp +++ b/unified-runtime/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/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index b50a56f903f28..67f4f046e8ee5 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -924,6 +924,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 @@ -1338,8 +1359,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. @@ -1400,27 +1421,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 @@ -1487,8 +1487,8 @@ typedef enum ur_platform_info_t { /// [char[]] The null-terminated 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. @@ -1707,27 +1707,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/unified-runtime/include/ur_print.h b/unified-runtime/include/ur_print.h index d42a2eab16289..27ef8a1ba68e3 100644 --- a/unified-runtime/include/ur_print.h +++ b/unified-runtime/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/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp index e97063011a4c3..28f7e439eda3a 100644 --- a/unified-runtime/include/ur_print.hpp +++ b/unified-runtime/include/ur_print.hpp @@ -285,6 +285,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, @@ -293,16 +294,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); @@ -2048,6 +2045,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 & @@ -2266,10 +2293,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) << " ("; @@ -2312,37 +2339,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 @@ -2414,10 +2410,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) << " ("; @@ -2482,37 +2478,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/unified-runtime/scripts/YaML.md b/unified-runtime/scripts/YaML.md index a28b52454d770..84b729caff038 100644 --- a/unified-runtime/scripts/YaML.md +++ b/unified-runtime/scripts/YaML.md @@ -838,8 +838,8 @@ namespace ur { * A manifest requires the following scalar fields: {`name`, `backend`} - `name` must be a string unique to the adapter. - `name` should be identical to how the name appears in the adapter's library name. E.g. `libur_adapter_my_adapter` should have the name string `my_adapter`. - - `backend` must be an etor of `$x_adapter_backend_t`. - - `backend` must not be `$X_ADAPTER_BACKEND_UNKNOWN`. + - `backend` must be an etor of `$x_backend_t`. + - `backend` must not be `$X_BACKEND_UNKNOWN`. * a manifest requires the following sequence of scalars: {`device_types`} - `device_types` must be an etor of `$x_device_type_t` diff --git a/unified-runtime/scripts/core/adapter.yml b/unified-runtime/scripts/core/adapter.yml index d8df466f1a55f..4a8d7348dbdd5 100644 --- a/unified-runtime/scripts/core/adapter.yml +++ b/unified-runtime/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/unified-runtime/scripts/core/common.yml b/unified-runtime/scripts/core/common.yml index 73501ac39db02..55485731f64de 100644 --- a/unified-runtime/scripts/core/common.yml +++ b/unified-runtime/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/unified-runtime/scripts/core/manifests.yml b/unified-runtime/scripts/core/manifests.yml index 6b9647852daea..d0466834f8337 100644 --- a/unified-runtime/scripts/core/manifests.yml +++ b/unified-runtime/scripts/core/manifests.yml @@ -16,7 +16,7 @@ ordinal: "99" --- #-------------------------------------------------------------------------- type: manifest name: opencl -backend: $X_ADAPTER_BACKEND_OPENCL +backend: $X_BACKEND_OPENCL device_types: - $X_DEVICE_TYPE_CPU - $X_DEVICE_TYPE_GPU @@ -26,19 +26,19 @@ device_types: --- #-------------------------------------------------------------------------- type: manifest name: cuda -backend: $X_ADAPTER_BACKEND_CUDA +backend: $X_BACKEND_CUDA device_types: - $X_DEVICE_TYPE_GPU --- #-------------------------------------------------------------------------- type: manifest name: hip -backend: $X_ADAPTER_BACKEND_HIP +backend: $X_BACKEND_HIP device_types: - $X_DEVICE_TYPE_GPU --- #-------------------------------------------------------------------------- type: manifest name: level_zero -backend: $X_ADAPTER_BACKEND_LEVEL_ZERO +backend: $X_BACKEND_LEVEL_ZERO device_types: - $X_DEVICE_TYPE_CPU - $X_DEVICE_TYPE_GPU @@ -48,7 +48,7 @@ device_types: --- #-------------------------------------------------------------------------- type: manifest name: level_zero_v2 -backend: $X_ADAPTER_BACKEND_LEVEL_ZERO +backend: $X_BACKEND_LEVEL_ZERO device_types: - $X_DEVICE_TYPE_CPU - $X_DEVICE_TYPE_GPU @@ -58,6 +58,6 @@ device_types: --- #-------------------------------------------------------------------------- type: manifest name: native_cpu -backend: $X_ADAPTER_BACKEND_NATIVE_CPU +backend: $X_BACKEND_NATIVE_CPU device_types: - $X_DEVICE_TYPE_CPU diff --git a/unified-runtime/scripts/core/platform.yml b/unified-runtime/scripts/core/platform.yml index 3566d42b7b09c..7ed252b566539 100644 --- a/unified-runtime/scripts/core/platform.yml +++ b/unified-runtime/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/unified-runtime/scripts/templates/manifests.hpp.mako b/unified-runtime/scripts/templates/manifests.hpp.mako index 81a8f1193bb66..a54e9b45d2891 100644 --- a/unified-runtime/scripts/templates/manifests.hpp.mako +++ b/unified-runtime/scripts/templates/manifests.hpp.mako @@ -28,7 +28,7 @@ namespace ur_loader { struct ur_adapter_manifest { std::string name; std::string library; - ur_adapter_backend_t backend; + ur_backend_t backend; std::vector device_types; }; diff --git a/unified-runtime/source/adapters/cuda/adapter.cpp b/unified-runtime/source/adapters/cuda/adapter.cpp index 3ea896bbd6cc3..7ab7679e27af6 100644 --- a/unified-runtime/source/adapters/cuda/adapter.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/cuda/platform.cpp b/unified-runtime/source/adapters/cuda/platform.cpp index 953c655bedff5..3cf233ef6f01b 100644 --- a/unified-runtime/source/adapters/cuda/platform.cpp +++ b/unified-runtime/source/adapters/cuda/platform.cpp @@ -97,7 +97,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/unified-runtime/source/adapters/hip/adapter.cpp b/unified-runtime/source/adapters/hip/adapter.cpp index 9daaee8a29738..8244d0a0bb8b5 100644 --- a/unified-runtime/source/adapters/hip/adapter.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/hip/platform.cpp b/unified-runtime/source/adapters/hip/platform.cpp index fa0b07cc8244a..882c7fb9135fe 100644 --- a/unified-runtime/source/adapters/hip/platform.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/level_zero/adapter.cpp b/unified-runtime/source/adapters/level_zero/adapter.cpp index 4339aed2a2299..00c8713154ac7 100644 --- a/unified-runtime/source/adapters/level_zero/adapter.cpp +++ b/unified-runtime/source/adapters/level_zero/adapter.cpp @@ -722,7 +722,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/unified-runtime/source/adapters/level_zero/platform.cpp b/unified-runtime/source/adapters/level_zero/platform.cpp index 5fb0b13c71022..2736bde269824 100644 --- a/unified-runtime/source/adapters/level_zero/platform.cpp +++ b/unified-runtime/source/adapters/level_zero/platform.cpp @@ -98,7 +98,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/unified-runtime/source/adapters/native_cpu/adapter.cpp b/unified-runtime/source/adapters/native_cpu/adapter.cpp index 1af605286ed22..0a74af7e67412 100644 --- a/unified-runtime/source/adapters/native_cpu/adapter.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/native_cpu/platform.cpp b/unified-runtime/source/adapters/native_cpu/platform.cpp index 8e550370792c7..3621de651f3bb 100644 --- a/unified-runtime/source/adapters/native_cpu/platform.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/opencl/adapter.cpp b/unified-runtime/source/adapters/opencl/adapter.cpp index 365723f14e977..e586fffc569b2 100644 --- a/unified-runtime/source/adapters/opencl/adapter.cpp +++ b/unified-runtime/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/unified-runtime/source/adapters/opencl/platform.cpp b/unified-runtime/source/adapters/opencl/platform.cpp index 5d58000b197a5..51330f51573eb 100644 --- a/unified-runtime/source/adapters/opencl/platform.cpp +++ b/unified-runtime/source/adapters/opencl/platform.cpp @@ -38,7 +38,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/unified-runtime/source/loader/loader.def.in b/unified-runtime/source/loader/loader.def.in index 2c1d2203ad31a..9a6d5222849b1 100644 --- a/unified-runtime/source/loader/loader.def.in +++ b/unified-runtime/source/loader/loader.def.in @@ -172,7 +172,6 @@ EXPORTS urPlatformGetBackendOption urPlatformGetInfo urPlatformGetNativeHandle - urPrintAdapterBackend urPrintAdapterGetInfoParams urPrintAdapterGetLastErrorParams urPrintAdapterGetParams @@ -180,6 +179,7 @@ EXPORTS urPrintAdapterReleaseParams urPrintAdapterRetainParams urPrintApiVersion + urPrintBackend urPrintBaseDesc urPrintBaseProperties urPrintBindlessImagesImageAllocateExpParams @@ -412,7 +412,6 @@ EXPORTS urPrintPhysicalMemProperties urPrintPhysicalMemReleaseParams urPrintPhysicalMemRetainParams - urPrintPlatformBackend urPrintPlatformCreateWithNativeHandleParams urPrintPlatformGetApiVersionParams urPrintPlatformGetBackendOptionParams diff --git a/unified-runtime/source/loader/loader.map.in b/unified-runtime/source/loader/loader.map.in index 687f97b283506..169857a0b71b0 100644 --- a/unified-runtime/source/loader/loader.map.in +++ b/unified-runtime/source/loader/loader.map.in @@ -172,7 +172,6 @@ urPlatformGetBackendOption; urPlatformGetInfo; urPlatformGetNativeHandle; - urPrintAdapterBackend; urPrintAdapterGetInfoParams; urPrintAdapterGetLastErrorParams; urPrintAdapterGetParams; @@ -180,6 +179,7 @@ urPrintAdapterReleaseParams; urPrintAdapterRetainParams; urPrintApiVersion; + urPrintBackend; urPrintBaseDesc; urPrintBaseProperties; urPrintBindlessImagesImageAllocateExpParams; @@ -412,7 +412,6 @@ urPrintPhysicalMemProperties; urPrintPhysicalMemReleaseParams; urPrintPhysicalMemRetainParams; - urPrintPlatformBackend; urPrintPlatformCreateWithNativeHandleParams; urPrintPlatformGetApiVersionParams; urPrintPlatformGetBackendOptionParams; diff --git a/unified-runtime/source/loader/ur_adapter_registry.hpp b/unified-runtime/source/loader/ur_adapter_registry.hpp index f716de1c487b0..5c92bab5571e5 100644 --- a/unified-runtime/source/loader/ur_adapter_registry.hpp +++ b/unified-runtime/source/loader/ur_adapter_registry.hpp @@ -25,7 +25,7 @@ namespace fs = filesystem; namespace ur_loader { struct ur_device_tuple { - ur_adapter_backend_t backend; + ur_backend_t backend; ur_device_type_t device; }; @@ -34,15 +34,15 @@ struct FilterTerm { std::string backend; std::vector devices; - const std::map backendNameMap = { - {"opencl", UR_ADAPTER_BACKEND_OPENCL}, - {"level_zero", UR_ADAPTER_BACKEND_LEVEL_ZERO}, - {"cuda", UR_ADAPTER_BACKEND_CUDA}, - {"hip", UR_ADAPTER_BACKEND_HIP}, - {"native_cpu", UR_ADAPTER_BACKEND_NATIVE_CPU}, + const std::map backendNameMap = { + {"opencl", UR_BACKEND_OPENCL}, + {"level_zero", UR_BACKEND_LEVEL_ZERO}, + {"cuda", UR_BACKEND_CUDA}, + {"hip", UR_BACKEND_HIP}, + {"native_cpu", UR_BACKEND_NATIVE_CPU}, }; - bool matchesBackend(const ur_adapter_backend_t &match_backend) const { + bool matchesBackend(const ur_backend_t &match_backend) const { if (backend.front() == '*') { return true; } diff --git a/unified-runtime/source/loader/ur_lib.cpp b/unified-runtime/source/loader/ur_lib.cpp index ef46895861ae8..72f65c462c98c 100644 --- a/unified-runtime/source/loader/ur_lib.cpp +++ b/unified-runtime/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/unified-runtime/source/loader/ur_manifests.hpp b/unified-runtime/source/loader/ur_manifests.hpp index 2ed89fc79f4f0..6b903e22a7ef4 100644 --- a/unified-runtime/source/loader/ur_manifests.hpp +++ b/unified-runtime/source/loader/ur_manifests.hpp @@ -26,14 +26,14 @@ namespace ur_loader { struct ur_adapter_manifest { std::string name; std::string library; - ur_adapter_backend_t backend; + ur_backend_t backend; std::vector device_types; }; const std::vector ur_adapter_manifests = { {"opencl", MAKE_LIBRARY_NAME("ur_adapter_opencl", "0"), - UR_ADAPTER_BACKEND_OPENCL, + UR_BACKEND_OPENCL, { UR_DEVICE_TYPE_CPU, UR_DEVICE_TYPE_GPU, @@ -43,19 +43,19 @@ const std::vector ur_adapter_manifests = { }}, {"cuda", MAKE_LIBRARY_NAME("ur_adapter_cuda", "0"), - UR_ADAPTER_BACKEND_CUDA, + UR_BACKEND_CUDA, { UR_DEVICE_TYPE_GPU, }}, {"hip", MAKE_LIBRARY_NAME("ur_adapter_hip", "0"), - UR_ADAPTER_BACKEND_HIP, + UR_BACKEND_HIP, { UR_DEVICE_TYPE_GPU, }}, {"level_zero", MAKE_LIBRARY_NAME("ur_adapter_level_zero", "0"), - UR_ADAPTER_BACKEND_LEVEL_ZERO, + UR_BACKEND_LEVEL_ZERO, { UR_DEVICE_TYPE_CPU, UR_DEVICE_TYPE_GPU, @@ -65,7 +65,7 @@ const std::vector ur_adapter_manifests = { }}, {"level_zero_v2", MAKE_LIBRARY_NAME("ur_adapter_level_zero_v2", "0"), - UR_ADAPTER_BACKEND_LEVEL_ZERO, + UR_BACKEND_LEVEL_ZERO, { UR_DEVICE_TYPE_CPU, UR_DEVICE_TYPE_GPU, @@ -75,7 +75,7 @@ const std::vector ur_adapter_manifests = { }}, {"native_cpu", MAKE_LIBRARY_NAME("ur_adapter_native_cpu", "0"), - UR_ADAPTER_BACKEND_NATIVE_CPU, + UR_BACKEND_NATIVE_CPU, { UR_DEVICE_TYPE_CPU, }}, diff --git a/unified-runtime/source/loader/ur_print.cpp b/unified-runtime/source/loader/ur_print.cpp index 50af3986b2f38..13be66f399774 100644 --- a/unified-runtime/source/loader/ur_print.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/adapter/urAdapterGetInfo.cpp b/unified-runtime/test/conformance/adapter/urAdapterGetInfo.cpp index ed5d356147219..2be5da1c3c53f 100644 --- a/unified-runtime/test/conformance/adapter/urAdapterGetInfo.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index 0dfe242fd5329..9d00f8fb5bda1 100644 --- a/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/exp_command_buffer/fixtures.h b/unified-runtime/test/conformance/exp_command_buffer/fixtures.h index be3df5f973d2d..2afae6c71bbcf 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/fixtures.h +++ b/unified-runtime/test/conformance/exp_command_buffer/fixtures.h @@ -150,7 +150,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 { @@ -187,7 +187,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; }; @@ -235,7 +235,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/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_L0.cpp b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_L0.cpp index bfbe7143c02e2..9805b7972a51d 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_L0.cpp +++ b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_L0.cpp @@ -14,7 +14,7 @@ struct urL0CommandBufferNativeAppendTest void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE( uur::command_buffer::urCommandBufferNativeAppendTest::SetUp()); - if (backend != UR_PLATFORM_BACKEND_LEVEL_ZERO) { + if (backend != UR_BACKEND_LEVEL_ZERO) { GTEST_SKIP() << "Native append test is only supported on L0."; } diff --git a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_cuda.cpp b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_cuda.cpp index 3ecd69aee2289..245a27acc1233 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_cuda.cpp +++ b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_cuda.cpp @@ -13,7 +13,7 @@ struct urCudaCommandBufferNativeAppendTest void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE( uur::command_buffer::urCommandBufferNativeAppendTest::SetUp()); - if (backend != UR_PLATFORM_BACKEND_CUDA) { + if (backend != UR_BACKEND_CUDA) { GTEST_SKIP() << "Native append test is only supported on CUDA."; } diff --git a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_hip.cpp b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_hip.cpp index 130c4133b6bdf..501265e8246b9 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_hip.cpp +++ b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_hip.cpp @@ -15,7 +15,7 @@ struct urHipCommandBufferNativeAppendTest void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE( uur::command_buffer::urCommandBufferNativeAppendTest::SetUp()); - if (backend != UR_PLATFORM_BACKEND_HIP) { + if (backend != UR_BACKEND_HIP) { GTEST_SKIP() << "Native append test is only supported on HIP."; } diff --git a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_opencl.cpp b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_opencl.cpp index 96bc2bcd10447..07e1ab0472cc4 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_opencl.cpp +++ b/unified-runtime/test/conformance/exp_command_buffer/native-command/append_native_opencl.cpp @@ -14,7 +14,7 @@ struct urOpenCLCommandBufferNativeAppendTest void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE( uur::command_buffer::urCommandBufferNativeAppendTest::SetUp()); - if (backend != UR_PLATFORM_BACKEND_OPENCL) { + if (backend != UR_BACKEND_OPENCL) { GTEST_SKIP() << "Native append test is only supported on OpenCL."; } diff --git a/unified-runtime/test/conformance/exp_command_buffer/native-command/common.h b/unified-runtime/test/conformance/exp_command_buffer/native-command/common.h index 1564e86e80c66..33684047cbdcc 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/native-command/common.h +++ b/unified-runtime/test/conformance/exp_command_buffer/native-command/common.h @@ -59,7 +59,7 @@ struct urCommandBufferNativeAppendTest : uur::urQueueTest { UUR_RETURN_ON_FATAL_FAILURE(uur::urQueueTest::TearDown()); } - ur_platform_backend_t backend{}; + ur_backend_t backend{}; ur_exp_command_buffer_handle_t command_buffer = nullptr; static constexpr int val = 42; static constexpr uint32_t global_size = 128; diff --git a/unified-runtime/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp b/unified-runtime/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp index 7331b8806f5b5..5ca00b8465bfa 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp +++ b/unified-runtime/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 @@ -242,7 +242,7 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) { 1, &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 @@ -307,7 +307,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 @@ -384,7 +384,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/unified-runtime/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp b/unified-runtime/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp index 457dcd59040db..0dea12ed4efb9 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/exp_command_buffer/update/local_memory_update.cpp b/unified-runtime/test/conformance/exp_command_buffer/update/local_memory_update.cpp index dfd45c15f465a..8c7d4774d13e9 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/update/local_memory_update.cpp +++ b/unified-runtime/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)); @@ -408,7 +408,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 @@ -446,7 +446,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 @@ -563,7 +563,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 @@ -601,7 +601,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 @@ -719,7 +719,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 @@ -811,7 +811,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 @@ -1099,7 +1099,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)); @@ -1119,7 +1119,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}; @@ -1143,7 +1143,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)); @@ -1160,7 +1160,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/unified-runtime/test/conformance/kernel/urKernelGetInfo.cpp b/unified-runtime/test/conformance/kernel/urKernelGetInfo.cpp index 8e68e1785d016..6684345ddbd14 100644 --- a/unified-runtime/test/conformance/kernel/urKernelGetInfo.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/kernel/urKernelSetArgLocal.cpp b/unified-runtime/test/conformance/kernel/urKernelSetArgLocal.cpp index 850e13e392240..323ee6da97a0f 100644 --- a/unified-runtime/test/conformance/kernel/urKernelSetArgLocal.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp b/unified-runtime/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp index fad0a61e06210..8a70545371275 100644 --- a/unified-runtime/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp +++ b/unified-runtime/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp @@ -98,10 +98,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/unified-runtime/test/conformance/platform/urPlatformGetInfo.cpp b/unified-runtime/test/conformance/platform/urPlatformGetInfo.cpp index d9b22d1efb732..a3a3b664c0457 100644 --- a/unified-runtime/test/conformance/platform/urPlatformGetInfo.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp b/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp index 85031f708711f..3eea89322665b 100644 --- a/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp b/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp index b999ae7a2b1d6..21524981a943f 100644 --- a/unified-runtime/test/conformance/program/urMultiDeviceProgramCreateWithIL.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramBuild.cpp b/unified-runtime/test/conformance/program/urProgramBuild.cpp index 40bffa721e461..1e101fa4c9bad 100644 --- a/unified-runtime/test/conformance/program/urProgramBuild.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramCreateWithIL.cpp b/unified-runtime/test/conformance/program/urProgramCreateWithIL.cpp index 91dc633d0c246..f27ad1f46ad79 100644 --- a/unified-runtime/test/conformance/program/urProgramCreateWithIL.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramCreateWithNativeHandle.cpp b/unified-runtime/test/conformance/program/urProgramCreateWithNativeHandle.cpp index 28c2dfdb595d6..3e0d178c8814d 100644 --- a/unified-runtime/test/conformance/program/urProgramCreateWithNativeHandle.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramGetFunctionPointer.cpp b/unified-runtime/test/conformance/program/urProgramGetFunctionPointer.cpp index 267e4412af26a..92437010002f3 100644 --- a/unified-runtime/test/conformance/program/urProgramGetFunctionPointer.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramGetGlobalVariablePointer.cpp b/unified-runtime/test/conformance/program/urProgramGetGlobalVariablePointer.cpp index bb58fe0c0aeaf..b638d96cf3634 100644 --- a/unified-runtime/test/conformance/program/urProgramGetGlobalVariablePointer.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramGetNativeHandle.cpp b/unified-runtime/test/conformance/program/urProgramGetNativeHandle.cpp index 2e357e5a595c4..f836a83d9821e 100644 --- a/unified-runtime/test/conformance/program/urProgramGetNativeHandle.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/program/urProgramLink.cpp b/unified-runtime/test/conformance/program/urProgramLink.cpp index 18ba3b82eca04..59af0599e69b4 100644 --- a/unified-runtime/test/conformance/program/urProgramLink.cpp +++ b/unified-runtime/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)); @@ -88,15 +87,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/unified-runtime/test/conformance/program/urProgramSetSpecializationConstants.cpp b/unified-runtime/test/conformance/program/urProgramSetSpecializationConstants.cpp index 1e99de684aba4..b3d25a66fb02c 100644 --- a/unified-runtime/test/conformance/program/urProgramSetSpecializationConstants.cpp +++ b/unified-runtime/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/unified-runtime/test/conformance/source/environment.cpp b/unified-runtime/test/conformance/source/environment.cpp index fe7f97782d1c0..76c2975219799 100644 --- a/unified-runtime/test/conformance/source/environment.cpp +++ b/unified-runtime/test/conformance/source/environment.cpp @@ -199,7 +199,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."; @@ -208,14 +208,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: @@ -289,12 +289,10 @@ void KernelsEnvironment::CreateProgram( hDevice}; UUR_KNOWN_FAILURE_ON_PARAM(tuple, uur::OpenCL{"gfx1100"}); - ur_platform_backend_t backend; + ur_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_BACKEND, - sizeof(ur_platform_backend_t), &backend, - nullptr)); - if (backend == UR_PLATFORM_BACKEND_HIP || - backend == UR_PLATFORM_BACKEND_CUDA) { + sizeof(ur_backend_t), &backend, nullptr)); + 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/unified-runtime/test/conformance/testing/include/uur/fixtures.h b/unified-runtime/test/conformance/testing/include/uur/fixtures.h index 9798c6d3c3ba5..8221fec9be718 100644 --- a/unified-runtime/test/conformance/testing/include/uur/fixtures.h +++ b/unified-runtime/test/conformance/testing/include/uur/fixtures.h @@ -1220,11 +1220,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( @@ -1259,11 +1259,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(); } @@ -1432,10 +1432,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, @@ -1669,12 +1669,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/unified-runtime/test/conformance/testing/include/uur/known_failure.h b/unified-runtime/test/conformance/testing/include/uur/known_failure.h index f1341153483a5..447b82f7e5a75 100644 --- a/unified-runtime/test/conformance/testing/include/uur/known_failure.h +++ b/unified-runtime/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/unified-runtime/test/conformance/testing/source/utils.cpp b/unified-runtime/test/conformance/testing/source/utils.cpp index e5aa43f85f197..7ff55963a3161 100644 --- a/unified-runtime/test/conformance/testing/source/utils.cpp +++ b/unified-runtime/test/conformance/testing/source/utils.cpp @@ -684,7 +684,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/unified-runtime/tools/urinfo/urinfo.hpp b/unified-runtime/tools/urinfo/urinfo.hpp index dcf324d32895f..9992b08b51bb8 100644 --- a/unified-runtime/tools/urinfo/urinfo.hpp +++ b/unified-runtime/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/unified-runtime/tools/urinfo/utils.hpp b/unified-runtime/tools/urinfo/utils.hpp index fcc767a2cac98..8e15779a20059 100644 --- a/unified-runtime/tools/urinfo/utils.hpp +++ b/unified-runtime/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"; }