Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPEC] Replace VPU naming with NPU #1444

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -1721,14 +1721,14 @@ inline ur_result_t printFlag<ur_device_init_flag_t>(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);
Expand Down Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/loader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/null/ur_null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/opencl/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -329,7 +329,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
clGetDeviceInfo(cl_adapter::cast<cl_device_id>(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).
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/device/urDeviceGet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ur_device_type_t> &info) {
std::stringstream ss;
ss << info.param;
Expand Down
4 changes: 2 additions & 2 deletions test/loader/loader_lifetime/urLoaderInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ur_device_init_flags_t> &info) {
std::stringstream ss;
ur::details::printFlag<ur_device_init_flag_t>(ss, info.param);
Expand Down