A developer's AI model moves between two connected server stacks and is served through a live API window

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

    Muhammad Rizwan

    Written by Muhammad Rizwan

    December 2, 2026

    5 min Read

    CUDA to CANNCANN vs CUDAHuawei AscendNVIDIASovereign AI

    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

    TermWhat it means
    GPU / NPUThe chip that runs AI. NVIDIA makes GPUs; Huawei Ascend chips are called NPUs (neural processing units)
    CUDANVIDIA's software layer that lets AI programs use its GPUs
    CANNHuawei's equivalent software layer for Ascend NPUs
    KernelA small piece of low-level code that does one maths operation on the chip
    Plugin / adapterAn add-on that lets a framework such as PyTorch talk to a new chip without changing your model
    Inference / servingRunning 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.

    LayerNVIDIAHuawei Ascend
    RuntimeCUDA runtimeAscendCL
    Custom kernel languageCUDA C++Ascend C
    Model compilerTensorRTATC
    Multi-chip communicationNCCLHCCL
    PyTorch supportBuilt into PyTorchTorchNPU, a PyTorch adapter plugin for Ascend NPU
    LLM servingvLLM and othersvLLM Ascend and MindIE
    CUDA stack vs CANN stack: model weights, PyTorch, vLLM and Hugging Face models stay the same; NVIDIA uses CUDA runtime, TensorRT, CUDA C++ and NCCL while Huawei Ascend uses TorchNPU, vLLM Ascend, AscendCL, ATC, Ascend C and HCCL
    CUDA stack vs CANN stack. Diagram · Stixor

    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.

    PathHow it worksBest forEffort
    1. TorchNPU adapterInstall the plugin and move the model and data to the NPU instead of the GPUStandard PyTorch modelsLowest
    2. Export and compileExport the model to ONNX, then compile it for Ascend with ATCStable inference modelsLow
    3. LLM serving frameworkLoad the Hugging Face model in vLLM Ascend or MindIEProduction LLM inferenceLow, for supported models
    4. Port custom kernelsRewrite CUDA-specific kernels in Ascend CProprietary model architecturesHighest

    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.

    python
    # 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.

    1. Inventory: list the framework version, quantization format and any custom CUDA code.
    2. Start with the simplest path: run the model through TorchNPU or vLLM Ascend.
    3. Port what remains: rewrite or replace any custom operators.
    4. Test equivalence: compare outputs on the same inputs.
    5. Benchmark: measure throughput and latency at your real batch sizes.
    6. 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.

    Run Your CUDA Models on Ascend

    Our engineers port, validate and deploy your models on Huawei Ascend, and Stixor AI Hub serves them alongside NVIDIA on one platform.

    Talk to Our Team

    Frequently Asked Questions

    FAQs

    icon
    icon

    Discuss Your Enterprise Use Case

    From small to large scale enterprises, we deliver next-gen AI, data engineering, and actionable insights.