SuperAPI AI Directory

ascend-avi-vnpu

Deployment & operations

View repository

Updated 10-15 17:19

About this skill

Ascend Virtualization Instance (AVI) vNPU Management

This skill is used to manage Huawei Ascend NPU Virtualization Instances (AVI) and vNPUs.

Note: Before executing any modification operation (setting, creating, destroying), the system will check the device status and ask for your confirmation.

Quick Start

Query Operations

# 查询AVI模式
npu-smi info -t vnpu-mode

# 查询所有AVI模板
npu-smi info -t template-info

# 查询指定设备的模板
npu-smi info -t template-info -i <设备ID>
Query vNPU information for a specified chip

npu-smi info -t info-vnpu -i <device ID> -c <chip ID>

Query the vNPU configuration recovery enable status

npu-smi info -t vnpu-cfg-recover -i <device ID> -c <chip ID>


### 修改操作

```bash
# 设置AVI模式 (0=Container, 1=VM)
npu-smi set -t vnpu-mode -d <0|1>

# 创建vNPU实例
npu-smi set -t create-vnpu -i <设备ID> -c <芯片ID> -f <模板名> [-v <vnpu_id>] [-g <vgroup_id>]

# 销毁vNPU实例
npu-smi set -t destroy-vnpu -i <设备ID> -c <芯片ID> -v <vnpu_id>

# 设置vNPU配置恢复使能状态
npu-smi set -t vnpu-cfg-recover -i <设备ID> -c <芯片ID> -d <0|1>

Query Operation Details

1. Query the Ascend Virtualization Instance (AVI) mode

npu-smi info -t vnpu-mode

Return description:

  • 0: Container mode (Docker/container virtualization)
  • VM: VM mode (virtual machine virtualization)

2. Query Ascend Virtualization Instance (AVI) template information

# 查询所有模板
npu-smi info -t template-info

# 查询指定设备的模板
npu-smi info -t template-info -i <设备ID>

Common templates:

Template Name AI Core Count Memory Applicable Scenario
vir02 2 2GB Lightweight workloads
vir04 4 4GB Medium workloads
vir08 8 8GB Heavy workloads

3. Query Ascend Virtualization Instance (AVI) template information for a specified device

npu-smi info -t template-info -i <设备ID>

4. Query the vNPU of a specified chip

npu-smi info -t info-vnpu -i <设备ID> -c <芯片ID>

Returned fields:

Field Description
vNPU ID vNPU identifier
vNPU Group ID vNPU group ID
AI Core Num Number of allocated AI Cores
Memory Size Allocated memory size
Status Current status

5. Query the configuration recovery enable status of the vNPU

npu-smi info -t vnpu-cfg-recover -i <设备ID> -c <芯片ID>

Return:Enable (enabled) or Disable (disabled)

Modification Operation Details

6. Set the Ascend Virtualization Instance (AVI) mode

npu-smi set -t vnpu-mode -d <0|1>

Parameter description:

  • 0: Container mode
  • 1: VM mode

Note: Changing the AVI mode may require restarting the device.

7. Create a vNPU for a specified chip

npu-smi set -t create-vnpu -i <设备ID> -c <芯片ID> -f <模板名> [-v <vnpu_id>] [-g <vgroup_id>]

Parameter description:

Parameter Required Description
i Yes Physical NPU ID
c Yes Chip ID
f Yes Template name (such as vir02, vir04, vir08)
v No Custom vNPU ID: [phy_id*16+100, phy_id*16+115]
g No Group ID: 0, 1, 2, or 3

Example:

# 使用自动分配的vNPU ID创建
npu-smi set -t create-vnpu -i 0 -c 0 -f vir04

# 指定vNPU ID创建
npu-smi set -t create-vnpu -i 0 -c 0 -f vir04 -v 103

# 在指定组中创建
npu-smi set -t create-vnpu -i 0 -c 0 -f vir04 -v 104 -g 1

8. Destroy the vNPU of a specified chip

npu-smi set -t destroy-vnpu -i <设备ID> -c <芯片ID> -v <vnpu_id>

Parameter description:

Parameter Required Description
i Yes Physical NPU ID
c Yes Chip ID
v Yes vNPU ID to destroy

Example:

npu-smi set -t destroy-vnpu -i 0 -c 0 -v 103

9. Set the configuration recovery enable status of the vNPU

npu-smi set -t vnpu-cfg-recover -i <设备ID> -c <芯片ID> -d <0|1>

Parameter description:

  • 0: Disable configuration recovery
  • 1: Enable configuration recovery

Security Check Mechanism

Before performing any modification operation, the system automatically performs the following checks:

  1. Device status check: run npu-smi info -l and npu-smi info -t health to view device health status
  2. Process usage check: run npu-smi info -t proc-mem to check whether any program is using the NPU
  3. User confirmation: before performing a modification operation, you will be asked to confirm whether to continue

If it is detected that a program is using the NPU, the system will:

  • Display information about the programs in use
  • Ask whether you want to kill these programs before performing the operation

⚠️ Important: template name confirmation

When the user uses vague expressions (such as "template 1", "the first template", "the second template"),the specific template name must be confirmed first, and execution must not be guessed directly.

Correct handling process:

  1. The user says "template 1" → display the list of available templates and let the user confirm which one it is
  2. The user says "the first template" → same as above
  3. The user says "use template vir10_3c_16g" → execute directly

Example of the available template list:

No. Template name AICORE Memory
1 vir10_3c_16g 10 16GB
2 vir10_4c_16g_m 10 16GB
3 vir10_3c_16g_nm 10 16GB
4 vir05_1c_8g 5 8GB

Parameter reference

Parameter Description How to obtain
设备ID NPU device ID npu-smi info -l
芯片ID Runtime chip ID npu-smi info -m (usually 0)
vNPU ID vNPU instance ID Range: [phy_id*16+100, phy_id*16+115]

FAQ

Q: How do I view the current vNPU instances?

npu-smi info -t info-vnpu -i 0 -c 0

Q: How do I choose a template when creating a vNPU?

Choose according to workload requirements:

Template name AICORE Memory Description
vir10_3c_16g 10 16GB Standard template
vir10_4c_16g_m 10 16GB Media-enhanced template
vir10_3c_16g_nm 10 16GB Non-media template
vir05_1c_8g 5 8GB Lightweight template

Note: when you say vague expressions such as "template 1" or "the first template", I will list the templates for you to confirm before executing.

Q: Can the vNPU ID be customized?

Yes, the range is [phy_id*16+100, phy_id*16+115]. For example, the vNPU ID range for device 0 is 100-115。

Q: Does changing the AVI mode require a restart?

Usually the device must be restarted for the change to take effect. Please plan your business in advance.

Reference materials

Local documentation

Official documentation