@@ -42,12 +42,22 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
4242
4343### Ascend NPU
4444
45- ** Verified devices **
45+ You can retrieve your Ascend device IDs using the following command:
4646
47- | Ascend NPU | Status |
48- | :-----------------------------:| :-------:|
49- | Atlas 300T A2 | Support |
50- | Atlas 300I Duo | Support |
47+ ``` sh
48+ lspci -n | grep -Eo ' 19e5:d[0-9a-f]{3}' | cut -d: -f2
49+ ```
50+
51+ ** Devices**
52+
53+ | Device Id | Product Series | Product Models | Chip Model | Verified Status |
54+ | :---------:| ----------------| ----------------| :----------:| :---------------:|
55+ | d803 | Atlas A3 Train | | 910C | |
56+ | d803 | Atlas A3 Infer | | 910C | |
57+ | d802 | Atlas A2 Train | | 910B | |
58+ | d802 | Atlas A2 Infer | Atlas 300I A2 | 910B | Support |
59+ | d801 | Atlas Train | | 910 | |
60+ | d500 | Atlas Infer | Atlas 300I Duo | 310P | Support |
5161
5262* Notes:*
5363
@@ -57,6 +67,9 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
5767
5868## Model Supports
5969
70+ <details >
71+ <summary >Text-only</summary >
72+
6073| Model Name | FP16 | Q4_0 | Q8_0 |
6174| :----------------------------| :-----:| :----:| :----:|
6275| Llama-2 | √ | √ | √ |
@@ -118,8 +131,11 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
118131| Trillion-7B-preview | √ | √ | √ |
119132| Ling models | √ | √ | √ |
120133
134+ </details >
135+
136+ <details >
137+ <summary >Multimodal</summary >
121138
122- ** Multimodal**
123139| Model Name | FP16 | Q4_0 | Q8_0 |
124140| :----------------------------| :-----:| :----:| :----:|
125141| LLaVA 1.5 models, LLaVA 1.6 models | x | x | x |
@@ -134,15 +150,22 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
134150| GLM-EDGE | √ | √ | √ |
135151| Qwen2-VL | √ | √ | √ |
136152
153+ </details >
154+
137155
138156
139157## DataType Supports
140158
141- | DataType | Status |
142- | :----------------------:| :-------:|
143- | FP16 | Support |
144- | Q8_0 | Support |
145- | Q4_0 | Support |
159+ | DataType | 910B | 310P |
160+ | :----------------------:| :-------:| :-------:|
161+ | FP16 | Support | Support |
162+ | Q8_0 | Support | Partial |
163+ | Q4_0 | Support | Partial |
164+ | BF16 | Support | |
165+
166+ > ** 310P note**
167+ > - ` Q8_0 ` : data transform / buffer path is implemented, and ` GET_ROWS ` is supported, but quantized ` MUL_MAT ` / ` MUL_MAT_ID ` are not supported.
168+ > - ` Q4_0 ` : data transform / buffer path is implemented, but quantized ` MUL_MAT ` / ` MUL_MAT_ID ` are not supported.
146169
147170## Docker
148171
@@ -160,7 +183,20 @@ npu-smi info
160183
161184# Select the cards that you want to use, make sure these cards are not used by someone.
162185# Following using cards of device0.
163- docker run --name llamacpp --device /dev/davinci0 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc -v /usr/local/dcmi:/usr/local/dcmi -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info -v /PATH_TO_YOUR_MODELS/:/app/models -it llama-cpp-cann -m /app/models/MODEL_PATH -ngl 32 -p " Building a website can be done in 10 simple steps:"
186+ docker run --name llamacpp \
187+ --device /dev/davinci0 \
188+ --device /dev/davinci_manager \
189+ --device /dev/devmm_svm \
190+ --device /dev/hisi_hdc \
191+ -v /usr/local/dcmi:/usr/local/dcmi \
192+ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
193+ -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
194+ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
195+ -v /PATH_TO_YOUR_MODELS/:/app/models \
196+ -it llama-cpp-cann \
197+ -m /app/models/MODEL_PATH \
198+ -ngl 32 \
199+ -p " Building a website can be done in 10 simple steps:"
164200```
165201
166202* Notes:*
@@ -171,69 +207,57 @@ docker run --name llamacpp --device /dev/davinci0 --device /dev/davinci_manager
171207
172208### I. Setup Environment
173209
174- 1 . ** Install Ascend Driver and firmware **
210+ 1 . ** Configure Ascend user and group **
175211
176212 ``` sh
177- # create driver running user.
178- sudo groupadd -g HwHiAiUser
213+ sudo groupadd HwHiAiUser
179214 sudo useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash
180215 sudo usermod -aG HwHiAiUser $USER
181-
182- # download driver from https://www.hiascend.com/hardware/firmware-drivers/community according to your system
183- # and install driver.
184- sudo sh Ascend-hdk-910b-npu-driver_x.x.x_linux-{arch}.run --full --install-for-all
185216 ```
186217
187- Once installed, run ` npu-smi info` to check whether driver is installed successfully.
188- ` ` ` sh
189- +-------------------------------------------------------------------------------------------+
190- | npu-smi 24.1.rc2 Version: 24.1.rc2 |
191- +----------------------+---------------+----------------------------------------------------+
192- | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
193- | Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
194- +======================+===============+====================================================+
195- | 2 xxx | OK | 64.4 51 15 / 15 |
196- | 0 | 0000:01:00.0 | 0 1873 / 15077 0 / 32768 |
197- +======================+===============+====================================================+
198- | 5 xxx | OK | 64.0 52 15 / 15 |
199- | 0 | 0000:81:00.0 | 0 1874 / 15077 0 / 32768 |
200- +======================+===============+====================================================+
201- | No running processes found in NPU 2 |
202- +======================+===============+====================================================+
203- | No running processes found in NPU 5 |
204- +======================+===============+====================================================+
205- ` ` `
218+ 2. ** Install dependencies**
206219
207- 2. ** Install Ascend Firmware **
220+ ** Ubuntu/Debian: **
208221 ` ` ` sh
209- # download driver from https://www.hiascend.com/hardware/firmware-drivers/community according to your system
210- # and install driver.
211- sudo sh Ascend-hdk-910b-npu-firmware_x.x.x.x.X.run --full
222+ sudo apt-get update
223+ sudo apt-get install -y gcc python3 python3-pip linux-headers-$( uname -r)
212224 ` ` `
213- If the following message appears, firmware is installed successfully.
225+
226+ ** RHEL/CentOS:**
214227 ` ` ` sh
215- Firmware package installed successfully!
228+ sudo yum makecache
229+ sudo yum install -y gcc python3 python3-pip kernel-headers-$( uname -r) kernel-devel-$( uname -r)
216230 ` ` `
217231
232+ 3. ** Install CANN (driver + toolkit)**
218233
219- 3. ** Install CANN toolkit and kernels**
234+ > The ` Ascend-cann` package includes both the driver and toolkit.
235+ > ` $ARCH ` can be ` x86_64` or ` aarch64` , ` $CHIP ` can be ` 910b` or ` 310p` .
220236
221- CANN toolkit and kernels can be obtained from the official [CANN Toolkit](https://www.hiascend.com/zh/developer/download/community/result? module=cann) page.
237+ ` ` ` sh
238+ wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.5.T63/Ascend-cann_8.5.0_linux-$ARCH .run
239+ sudo bash ./Ascend-cann_8.5.0_linux-$ARCH .run --install
240+
241+ wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.5.T63/Ascend-cann-$CHIP -ops_8.5.0_linux-$ARCH .run
242+ sudo bash ./Ascend-cann-$CHIP -ops_8.5.0_linux-$ARCH .run --install
243+ ` ` `
244+
245+ 4. ** Verify installation**
222246
223- Please download the corresponding version that satified your system. The minimum version required is 8.0.RC2.alpha002 and here is the install command.
224247 ` ` ` sh
225- pip3 install attrs numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions
226- sh Ascend-cann-toolkit_8.0.RC2.alpha002_linux-aarch64.run --install
227- sh Ascend-cann-kernels-910b_8.0.RC2.alpha002_linux.run --install
248+ npu-smi info
228249 ` ` `
229250
230- Set Ascend Variables:
251+ If device information is displayed correctly, the driver is functioning properly.
252+
231253 ` ` ` sh
232- echo " source ~/Ascend/ascend-toolkit/set_env.sh" >> ~ /.bashrc
233- source ~ /.bashrc
254+ # Set environment variables (adjust path if needed)
255+ source /usr/local/Ascend/cann/set_env.sh
256+
257+ python3 -c " import acl; print(acl.get_soc_name())"
234258 ` ` `
235259
236- Upon a successful installation, CANN is enabled for the available ascend devices .
260+ If the command outputs the chip model, the installation was successful .
237261
238262# ## II. Build llama.cpp
239263
0 commit comments