
CUDA to CANN: CANN vs CUDA and How to Run Your Models on Huawei Ascend

Written by Muhammad Rizwan
December 2, 2026
5 min Read
Moving from CUDA to CANN means running AI models built for NVIDIA GPUs on Huawei Ascend NPUs. For most standard models this is a plugin and a configuration change, not a rewrite: PyTorch models run through TorchNPU (formerly Ascend Extension for PyTorch, or torch_npu), and large language models are served through vLLM Ascend. Only custom code written directly for CUDA needs to be ported, and that part is real engineering work.
Think of it like moving a car from petrol to a different fuel. Most of the car stays the same; you swap the parts that touch the fuel. In AI, the "car" is your model and its framework (PyTorch, vLLM), and the "fuel system" is the chip's software layer: CUDA on NVIDIA, CANN on Ascend.
Teams in Pakistan and the Middle East increasingly run AI on both NVIDIA and Ascend hardware. Stixor AI Hub serves models across mixed NVIDIA and Ascend fleets, and Stixor's team helps plan and test the move.
Key terms in plain English
| Term | What it means |
|---|---|
| GPU / NPU | The chip that runs AI. NVIDIA makes GPUs; Huawei Ascend chips are called NPUs (neural processing units) |
| CUDA | NVIDIA's software layer that lets AI programs use its GPUs |
| CANN | Huawei's equivalent software layer for Ascend NPUs |
| Kernel | A small piece of low-level code that does one maths operation on the chip |
| Plugin / adapter | An add-on that lets a framework such as PyTorch talk to a new chip without changing your model |
| Inference / serving | Running a trained model to answer requests, as opposed to training it |
Key Takeaways
- CANN is to Huawei Ascend what CUDA is to NVIDIA: the software layer that runs AI workloads on the chip.
- Most standard transformer models run on Ascend with little code change, through TorchNPU or vLLM Ascend.
- The planning work is finding any custom CUDA kernels, special quantization formats or hand-written multi-GPU code.
- Test outputs and speed on Ascend before moving production traffic.
What Is CANN, and How Does It Compare to CUDA?
CANN (Compute Architecture for Neural Networks) is Huawei's software stack for Ascend NPUs. Like CUDA for NVIDIA GPUs, it provides the runtime, compiler, kernel language and communication library that AI frameworks build on.
| Layer | NVIDIA | Huawei Ascend |
|---|---|---|
| Runtime | CUDA runtime | AscendCL |
| Custom kernel language | CUDA C++ | Ascend C |
| Model compiler | TensorRT | ATC |
| Multi-chip communication | NCCL | HCCL |
| PyTorch support | Built into PyTorch | TorchNPU, a PyTorch adapter plugin for Ascend NPU |
| LLM serving | vLLM and others | vLLM Ascend and MindIE |

Figure: The NVIDIA CUDA stack and the Huawei Ascend CANN stack side by side. Your model and framework stay the same; the layers below the framework change. Diagram · Stixor
What Are the Four Ways to Move From CUDA to CANN?
Choose the path by what you are moving: a standard PyTorch model, a model you can export, an LLM to serve, or code with custom CUDA kernels.
| Path | How it works | Best for | Effort |
|---|---|---|---|
| 1. TorchNPU adapter | Install the plugin and move the model and data to the NPU instead of the GPU | Standard PyTorch models | Lowest |
| 2. Export and compile | Export the model to ONNX, then compile it for Ascend with ATC | Stable inference models | Low |
| 3. LLM serving framework | Load the Hugging Face model in vLLM Ascend or MindIE | Production LLM inference | Low, for supported models |
| 4. Port custom kernels | Rewrite CUDA-specific kernels in Ascend C | Proprietary model architectures | Highest |
For most companies serving open-source LLMs, path 3 is the right default. vLLM Ascend is a community-maintained hardware plugin for running vLLM on Huawei Ascend NPUs, and it is the vLLM community's recommended approach for Ascend (vLLM Ascend on GitHub). At the time of writing, its requirements list Atlas 800I A2 and A3 servers, the Atlas 300I Duo card and Ascend 950 products, with CANN 9.2.1.
What the code change looks like
For a standard PyTorch model, the change is usually a few lines: import the Ascend plugin and send the model and data to the NPU instead of the GPU.
# Before (NVIDIA)
model = model.to("cuda")
inputs = inputs.to("cuda")
# After (Huawei Ascend)
import torch_npu # TorchNPU plugin
model = model.to("npu")
inputs = inputs.to("npu")For LLM serving, you install the vLLM Ascend plugin next to vLLM and serve the same Hugging Face model; vLLM picks up the Ascend backend through the plugin. Always check the plugin's support matrix for your model and versions.
What Runs Out of the Box, and What Needs Porting?
Standard transformer building blocks run as they are; code written specifically for NVIDIA hardware is what needs porting.
Runs as is: matrix multiplication, standard attention, layer norm and RMSNorm, feed-forward layers, embeddings and rotary position encoding, softmax and standard loss functions.
Needs porting or adjusting:
- Custom CUDA kernels: rewrite them in Ascend C, or replace them with an existing Ascend operator.
- Quantization: standard formats such as BF16, FP16 and INT8 are the simplest path; check any other format before you start.
- Multi-chip code: direct NCCL calls move to HCCL; serving frameworks such as vLLM Ascend handle this for you.
- Manual memory management: adapt it through TorchNPU, which mirrors PyTorch's familiar memory functions.
Be realistic about custom code. A model that uses only standard PyTorch layers usually moves with little code change. A training or inference pipeline built around hand-written CUDA kernels is a different project: each kernel has to be rewritten, tested and tuned, so budget time for it and do it first.
How Do You Plan a CUDA to CANN Migration?
Start with the simplest path, port only what remains, and move traffic after side-by-side tests.
- Inventory: list the framework version, quantization format and any custom CUDA code.
- Start with the simplest path: run the model through TorchNPU or vLLM Ascend.
- Port what remains: rewrite or replace any custom operators.
- Test equivalence: compare outputs on the same inputs.
- Benchmark: measure throughput and latency at your real batch sizes.
- Move traffic gradually: shift a share first, then the rest.
Why Does This Matter in Pakistan and the Middle East?
Sovereign AI programs in the region are building on more than one accelerator family, so models that run on both NVIDIA and Ascend give teams more choice of hardware and keep data in-country.
- Choice of hardware: run on whichever capacity is available and best priced.
- Mixed fleets: the same model can serve from NVIDIA and Ascend side by side.
- Data residency: local Ascend capacity keeps data inside national borders.
How Stixor Helps
Stixor's AI and ML team helps plan, test and deploy models on Huawei Ascend, and Stixor AI Hub serves them next to NVIDIA. Stixor AI Hub treats the accelerator as a job setting, so the same model can be served on NVIDIA or Ascend in one fleet. The platform supports nine accelerator families, including NVIDIA, AMD and Huawei Ascend, and runs inside your own data center or cloud, including air-gapped sites.
The Bottom Line
Start by listing any custom CUDA code your model uses. If there is none, running on Ascend is mostly configuration; if there is, plan a port with side-by-side testing. Talk to our team to plan the move.
Frequently Asked Questions
FAQs
It is the process of running AI models built for NVIDIA GPUs, which use the CUDA software stack, on Huawei Ascend NPUs, which use the CANN stack. It covers moving framework code, porting any custom kernels, and testing that outputs and speed meet your needs before production traffic moves.
For standard models, usually yes. TorchNPU (formerly torch_npu) lets PyTorch models run on Ascend by moving the model and data to the NPU, and vLLM Ascend serves supported LLMs straight from their Hugging Face weights. Only custom CUDA kernels need rewriting, usually in Ascend C.
Both are the software layer that runs AI workloads on a chip. CUDA serves NVIDIA GPUs and CANN serves Huawei Ascend NPUs. Each has its own runtime, compiler, kernel language and communication library, and both connect to PyTorch and vLLM through plugins or built-in support.
Yes. Huawei's CANN for Ascend NPUs, AMD's ROCm for AMD GPUs and Intel's oneAPI are the main alternatives. Frameworks such as PyTorch and vLLM support several of them through built-in backends or plugins, which is what makes moving between chips practical.
Yes. TorchNPU is the current name of the PyTorch adapter plugin for Ascend NPUs, previously called Ascend Extension for PyTorch, and it is still imported in code as torch_npu.
Check the supported-models list of vLLM Ascend or MindIE for your version. Popular open model families are commonly supported, and very new architectures may need a newer framework release.
No. A trained model's weights can be loaded on Ascend as they are. You only change the software path that runs them, then test that outputs match.
At the same precision, such as BF16 or FP16, outputs should match closely. Quantized models can differ slightly because quantization tools differ, so run an output test on your own prompts or data before moving production traffic.
Yes. Stixor's AI and ML team helps plan, test and deploy the move, and Stixor AI Hub serves the models alongside NVIDIA in one fleet, inside your own data center or cloud.
Discuss Your Enterprise Use Case
From small to large scale enterprises, we deliver next-gen AI, data engineering, and actionable insights.