From 8310f4d15b2bd1c4000e1a99af623ad8d8e915b7 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 14 Mar 2024 19:27:08 +0000 Subject: [PATCH] [SPEC] Replace VPU naming with NPU --- include/ur_api.h | 8 ++++---- include/ur_print.hpp | 14 +++++++------- scripts/core/device.yml | 4 ++-- scripts/core/loader.yml | 4 ++-- source/adapters/null/ur_null.cpp | 2 +- source/adapters/opencl/device.cpp | 4 ++-- source/loader/layers/validation/ur_valddi.cpp | 2 +- source/loader/ur_libapi.cpp | 4 ++-- source/ur_api.cpp | 4 ++-- test/conformance/device/urDeviceGet.cpp | 2 +- test/loader/loader_lifetime/urLoaderInit.cpp | 4 ++-- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 6291dbcd6d..ca7656bd54 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -551,7 +551,7 @@ typedef enum ur_device_init_flag_t { UR_DEVICE_INIT_FLAG_CPU = UR_BIT(1), ///< initialize CPU device adapters. UR_DEVICE_INIT_FLAG_FPGA = UR_BIT(2), ///< initialize FPGA device adapters. UR_DEVICE_INIT_FLAG_MCA = UR_BIT(3), ///< initialize MCA device adapters. - UR_DEVICE_INIT_FLAG_VPU = UR_BIT(4), ///< initialize VPU device adapters. + UR_DEVICE_INIT_FLAG_NPU = UR_BIT(4), ///< initialize NPU device adapters. /// @cond UR_DEVICE_INIT_FLAG_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -1334,7 +1334,7 @@ typedef enum ur_device_type_t { UR_DEVICE_TYPE_CPU = 4, ///< Central Processing Unit UR_DEVICE_TYPE_FPGA = 5, ///< Field Programmable Gate Array UR_DEVICE_TYPE_MCA = 6, ///< Memory Copy Accelerator - UR_DEVICE_TYPE_VPU = 7, ///< Vision Processing Unit + UR_DEVICE_TYPE_NPU = 7, ///< Neural Processing Unit /// @cond UR_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -1367,7 +1367,7 @@ typedef enum ur_device_type_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -1410,7 +1410,7 @@ urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetSelected( diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 35f0f2e9df..2a264340b7 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -1663,8 +1663,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_init_flag_t val case UR_DEVICE_INIT_FLAG_MCA: os << "UR_DEVICE_INIT_FLAG_MCA"; break; - case UR_DEVICE_INIT_FLAG_VPU: - os << "UR_DEVICE_INIT_FLAG_VPU"; + case UR_DEVICE_INIT_FLAG_NPU: + os << "UR_DEVICE_INIT_FLAG_NPU"; break; default: os << "unknown enumerator"; @@ -1721,14 +1721,14 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t f os << UR_DEVICE_INIT_FLAG_MCA; } - if ((val & UR_DEVICE_INIT_FLAG_VPU) == (uint32_t)UR_DEVICE_INIT_FLAG_VPU) { - val ^= (uint32_t)UR_DEVICE_INIT_FLAG_VPU; + if ((val & UR_DEVICE_INIT_FLAG_NPU) == (uint32_t)UR_DEVICE_INIT_FLAG_NPU) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_NPU; if (!first) { os << " | "; } else { first = false; } - os << UR_DEVICE_INIT_FLAG_VPU; + os << UR_DEVICE_INIT_FLAG_NPU; } if (val != 0) { std::bitset<32> bits(val); @@ -2114,8 +2114,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value) { case UR_DEVICE_TYPE_MCA: os << "UR_DEVICE_TYPE_MCA"; break; - case UR_DEVICE_TYPE_VPU: - os << "UR_DEVICE_TYPE_VPU"; + case UR_DEVICE_TYPE_NPU: + os << "UR_DEVICE_TYPE_NPU"; break; default: os << "unknown enumerator"; diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 8acdfafed5..6227bc2ddb 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -103,8 +103,8 @@ etors: desc: "Field Programmable Gate Array" - name: MCA desc: "Memory Copy Accelerator" - - name: VPU - desc: "Vision Processing Unit" + - name: NPU + desc: "Neural Processing Unit" --- #-------------------------------------------------------------------------- type: function desc: "Retrieves devices within a platform" diff --git a/scripts/core/loader.yml b/scripts/core/loader.yml index b5ad1eadec..47a8930ae0 100644 --- a/scripts/core/loader.yml +++ b/scripts/core/loader.yml @@ -25,8 +25,8 @@ etors: desc: "initialize FPGA device adapters." - name: MCA desc: "initialize MCA device adapters." - - name: VPU - desc: "initialize VPU device adapters." + - name: NPU + desc: "initialize NPU device adapters." --- #-------------------------------------------------------------------------- type: function desc: "Create a loader config object." diff --git a/source/adapters/null/ur_null.cpp b/source/adapters/null/ur_null.cpp index 84ad1ba352..58ddff97ab 100644 --- a/source/adapters/null/ur_null.cpp +++ b/source/adapters/null/ur_null.cpp @@ -105,7 +105,7 @@ context_t::context_t() { if (hPlatform == nullptr) { return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } - if (UR_DEVICE_TYPE_VPU < DevicesType) { + if (UR_DEVICE_TYPE_NPU < DevicesType) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } if (phDevices != nullptr && NumEntries != 1) { diff --git a/source/adapters/opencl/device.cpp b/source/adapters/opencl/device.cpp index 115b9b2e09..f681f73dae 100644 --- a/source/adapters/opencl/device.cpp +++ b/source/adapters/opencl/device.cpp @@ -71,7 +71,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, break; case UR_DEVICE_TYPE_FPGA: case UR_DEVICE_TYPE_MCA: - case UR_DEVICE_TYPE_VPU: + case UR_DEVICE_TYPE_NPU: Type = CL_DEVICE_TYPE_ACCELERATOR; break; case UR_DEVICE_TYPE_DEFAULT: @@ -329,7 +329,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, clGetDeviceInfo(cl_adapter::cast(hDevice), CLPropName, sizeof(cl_device_type), &CLType, nullptr)); - /* TODO UR: If the device is an Accelerator (FPGA, VPU, etc.), there is not + /* TODO UR: If the device is an Accelerator (FPGA, NPU, etc.), there is not * enough information in the OpenCL runtime to know exactly which type it * is. Assuming FPGA for now */ /* TODO UR: In OpenCL, a device can have multiple types (e.g. CPU and GPU). diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 1ad5cede4d..ae6467c35d 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -439,7 +439,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_DEVICE_TYPE_VPU < DeviceType) { + if (UR_DEVICE_TYPE_NPU < DeviceType) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 7cbbdffb1c..4735ef0dfb 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -746,7 +746,7 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -799,7 +799,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGetSelected( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 665e75548b..cc162072fc 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -648,7 +648,7 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -695,7 +695,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_NPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGetSelected( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance diff --git a/test/conformance/device/urDeviceGet.cpp b/test/conformance/device/urDeviceGet.cpp index 5ce4c45906..b5d1aec1d4 100644 --- a/test/conformance/device/urDeviceGet.cpp +++ b/test/conformance/device/urDeviceGet.cpp @@ -48,7 +48,7 @@ INSTANTIATE_TEST_SUITE_P( , urDeviceGetTestWithDeviceTypeParam, ::testing::Values(UR_DEVICE_TYPE_DEFAULT, UR_DEVICE_TYPE_GPU, UR_DEVICE_TYPE_CPU, UR_DEVICE_TYPE_FPGA, - UR_DEVICE_TYPE_MCA, UR_DEVICE_TYPE_VPU), + UR_DEVICE_TYPE_MCA, UR_DEVICE_TYPE_NPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; ss << info.param; diff --git a/test/loader/loader_lifetime/urLoaderInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp index dc1fdfa8ce..6887f3e6fe 100644 --- a/test/loader/loader_lifetime/urLoaderInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -11,10 +11,10 @@ INSTANTIATE_TEST_SUITE_P( , urLoaderInitTestWithParam, ::testing::Values(UR_DEVICE_INIT_FLAG_GPU, UR_DEVICE_INIT_FLAG_CPU, UR_DEVICE_INIT_FLAG_FPGA, UR_DEVICE_INIT_FLAG_MCA, - UR_DEVICE_INIT_FLAG_VPU, + UR_DEVICE_INIT_FLAG_NPU, /* Combinations */ UR_DEVICE_INIT_FLAG_GPU | UR_DEVICE_INIT_FLAG_CPU, - UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_VPU), + UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_NPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; ur::details::printFlag(ss, info.param);