Freeing the Allwinner A733 3.0 TOPS NPU on Mainline Linux 7.1: 203 FPS MobileNetV1 & the 10 Driver and Software Bugs We Solved
By Tim Michals Embedded Linux, Edge AI & Robotics Engineering Blog
Spend ten minutes browsing the Radxa Forums, Armbian Forums, or GitHub issues for the Allwinner A733 (Radxa Cubie A7A / A7Z / A7S, Orange Pi 4 Pro), and you will see developers hitting the exact same brick walls:
"Why does vpm_run crash with *_t527.nb models?"
"Why did vip_init break after updating my OS image (2.0.3.4 vs 2.0.3.2)?"
"Why are my Frigate NVR / YOLOv8 bounding boxes completely scrambled?"
"Why won't aw_nna_vip compile on Linux 6.6 / 6.18 / 7.1?"
"Why does Mesa Teflon output all 128 (0x80), ignore input DRAM reads, or hang on 1×1 pointwise layers on 0x9202?"
We brought up the Allwinner A733 NPU from scratch on mainline Linux 7.1.0 PREEMPT_RT (drivers/gpu/drm/etnaviv) + Mesa 26.1.7 Teflon on live Radxa Cubie A7A silicon — with zero proprietary VIPLite/Acuity blobs and zero GPU hangs.
Headline Live Silicon Results (Linux 7.1.0, 1008 MHz, Zero Vendor Blobs)
3.3× faster than Cortex-A76 CPU (17.9 ms), zero hangs
Full InceptionV1 (224×224, 6.5 MB)
18.66 ms
53.6 FPS
2× faster than Cortex-A76 CPU (36.5 ms), Cosine = 0.999624
Vivante PPU Compute Shader (npu-ppu-test)
0.073 ms
13,700/s
5/5 bit-exact IEEE-754 float32
Zero-Copy V4L2 /dev/video0 → PRIME → NPU
0.803 ms
1,245/s
Bit-exact, zero CPU frame copies
Here are the 10 concrete driver, bring-up, and Mesa software bugs we hunted down and solved, how each interacts with the A733 hardware, and where to grab every patch.
Problem 1: Marketing Specs vs. Live Silicon Identity (Why T527 .nb Files Crash A733)
The Problem: Early community notes assumed the A733 used Allwinner's 12-core 0x9113 NPU, and developers routinely tried running T527 (*_t527.nb) models on A733 boards—hitting immediate vpm_run crashes.
What Live Silicon Proved: Reading /sys/kernel/debug/dri/0/gpu on the Cubie A7A proved the A733 silicon is model 0x9000, revision 0x9202, product_id 0x05090009, customer_id 0x1000003b (VeriSilicon VIP9000Nano-DI, HW_V83, chip date 2023-05-18).
Comparing it to T527 (0x9003, cid 0x10000016) explains why .nb binaries can never cross between them:
The Fix: Added exact 0x9202 HWDB entries to both mainline kernel etnaviv_hwdb.c and Mesa (0001-etnaviv-hwdb-add-allwinner-npu-feature-database.patch). Because Mesa Teflon compiles standard .tflite flatbuffers on-device at runtime, the exact same .tflite file runs across A733, T527, i.MX8MP, and Amlogic—no Acuity Docker container and no per-SoC .nb exports.
Problem 2: Vendor aw_nna_vip Build Failures & VIPLite Version Hell
The Problem: Vendor BSP users constantly hit vip_init failures from kernel/userspace version drift (2.0.3.4-AW vs 2.0.3.2) and missing aw_nna_vip headers (sunxi-autogen.h) on Linux 6.6–7.1.
The Fix: Dropped the 44,000-line out-of-tree aw_nna_vip module entirely and bound npu@3600000 directly to in-tree mainline drivers/gpu/drm/etnaviv (/dev/dri/renderD128) paired with Buildroot-compiled Mesa 26.1.7 libteflon.so. Zero proprietary blobs, zero ABI drift.
Problem 3: 0x03600000 Bus Hangs (4 Clocks, 4 Resets, PD_NPU & 1008 MHz)
The Problem: Reading 0x03600000 hangs the A733 bus unless every piece of its power/clock/reset hierarchy is active:
PCK-600 power domain PD_NPU (domain 4) and AXP8191 dcdc2 (800 mV) must be on.
Register access traverses two series AHB gates: CLK_AHB_NPU (0x05c0 bit 6) andCLK_BUS_NPU (0x0b04 bit 0).
DMA stalls silently if CLK_MBUS_NPU (0x05e0 bit 18, 600 MHz) isn't enabled.
A733 splits NPU resets across 4 separate bits in 0x0b04 (CORE bit 16, AXI bit 17, AHB bit 18, SRAM bit 19), whereas mainline etnaviv only fetched one reset line.
The Fix: Parented bus_npu_clk to ahb_npu_clk in ccu-sun60i-a733.c, switched etnaviv_gpu_platform_probe() to devm_reset_control_array_get_optional_exclusive(), and configured npu@3600000 at 1008 MHz (PLL_NPU, matching stock Radxa Bullseye 5.15, verified stable at 800 mV / 42.5 °C with GIC_SPI 65 firing cleanly).
The Problem: On 0x9000 rev >= 0x9100, legacy PTA mode (0x003B4 = 1, 0x00388 = 1) failed to feed NN input/weight DMA streams, and mainline etnaviv's SZ_4K IOVA allocator placed NN buffers at VA 0x00041000..0x00045000—colliding directly with the default 512 KB on-chip VIP SRAM window (0x00000000..0x0007ffff).
The Fix (verified against live Radxa 5.15 MMUv2 page tables):
Reserved MTLB[0] (0x00000000..0x00ffffff) in 1 MB page mode (stlb0_dma | 0x9) with STLB[0][0..5] = 0x5 for VIP SRAM remapped to 0x00400000, and started DRAM IOVAs at SZ_16M (0x01000000).
Fixed the VIVS_MMUv2_CONFIGURATION (0x00184) TLB flush trap: writing 0xffffff7f instead of 0x00000018 preserves the page-table base on every dynamic BO flush.
Problem 5: The Final Boss — SYSCTRL 0x03000008 Bit 1 (512 KB Shared VIP SRAM Ownership)
The Problem: Even after matching vipcore.ko's MODE1_K page tables, initcmd, and power registers—and even in an MMU-OFF (0x0388 = 0) bisection on 32-bit physical dma_alloc_wc buffers—the NN Top Controller read config headers and wrote output bytes cleanly, yet the 8 NN Core streamers still ignored DRAM input/weight changes (while PPU shaders passed 10/10!).
The Breakthrough (Live Radxa Bullseye 5.15 Oracle): Running v3/lenet.nb natively on Radxa's stock Bullseye 5.15 image (/dev/vipcore) worked 100% (orig, 0x00, 0xff all produced valid distinct outputs), and every single NPU MMIO register (0x03600000..0x0664) and NSI M18 register matched Linux 7.1 identically. Only one SoC register differed:
SYSCTRL 0x03000008: Bullseye 5.15 = 0x00000000, Linux 7.1 = 0x00000002!
Bit 1 of SYSCTRL+0x08 switches the A733's 512 KB shared VIP SRAM between CPU/E902 (1, hardware reset default) and the NPU (0).
Live bidirectional proof: Writing 0x03000008 = 0x2 on working Bullseye 5.15 immediately broke/hung lenet.nb (VIPDRV_WAIT_TASK timeout); restoring 0x0 immediately fixed it. (And E902 is completely unaffected—our E902 firmware runs in its DRAM carveout + SRAM A2.)
The Fix: Added allwinner,sun60i-a733-system-control (sun60i_a733_sramc_variant) in drivers/soc/sunxi/sunxi_sram.c + sun60i-a733-cubie-a7a.dts to clear SYSCTRL+0x08 bit 1 at boot. Immediately, all 6 /usr/bin/npu-smoke-test models passed 100% bit-exact (max_diff = 0, Cosine = 1.000000) on clean cold boot!
Problem 6: HW_V83 NN Descriptors (FP_INIMAGE_POST_SCALE & NN_CMD_SUPPORT_SLICE)
The Problem: A733 0x9202 is the first chip in Mesa with FP_INIMAGE_POST_SCALE = 1 (NN_INT8_SCALE = 0) and one of only three with NN_CMD_SUPPORT_SLICE = 1. Unmodified Mesa output 128 (0x80) everywhere and only wrote 1 of 4 channels.
The Fix (0002-etnaviv-teflon-add-hw-v83-and-no-tp-support.patch):
FP_INIMAGE_POST_SCALE = 1: Pass the raw IEEE-754 biased exponent (scale_bits >> 23, including bit 7 in w15[30]) directly alongside the 23-bit mantissa.
NN_CMD_SUPPORT_SLICE = 1: Program in_image_y_stride and out_image_y_stride as channel-slice byte strides (x * y), not row counts (y).
NN_TENSOR_ADD_FIELD_MOVE_TO_EXT_CMD = 1: Decline legacy v8 ADD/SUBTRACT cleanly so TFLite runs them on CPU until extended-command ADD lowering is added.
The Problem: Even after npu-smoke-test passed 6/6, real MobileNetV2 layers with h ≥ 36 (002.tflite, 004.tflite, 010.tflite) hung the NN engine after ~1,442 cycles (IDLE = 0x7FFBFFF6, zero MMU/AXI faults).
The Fix (0003-etnaviv-teflon-hw-v83-ext-cmd-and-nn-config.patch): Matched the exact HW_V83 dispatch state captured from v3/lenet.nb:
That eliminated 100% of GPU hangs across all 65 MobileNetV2 layers (000..064), full MobileNetV1, full MobileNetV2, full InceptionV1, and YOLOX-Nano.
Problem 8: TP_ENGINE = 0 & the 6.3× Uncached ETNA_BO_WC Transpose Speedup
The Problem: Upstream Mesa forced tp_core_count = 1 even when db->TP_ENGINE == 0, turning TRANSPOSE/DETRANSPOSE into silent no-ops that zeroed output tensors. Once we added a scalar CPU fallback (0002), MobileNetV2 ran in 17.3 ms and InceptionV1 took 118.4 ms because strided 1-byte reads/writes directly on uncached write-combining (ETNA_BO_WC) GPU buffers stalled the memory bus on every byte!
The Fix (0004-etnaviv-teflon-fast-cached-neon-tp-cpu.patch): Stage ETNA_BO_WC buffers with linear memcpy bursts through cached L1/L2 RAM and run an AArch64 NEON 8×8 vtrn transpose before writing back linearly:
MobileNetV1: 10.26 ms → 4.92 ms (203 FPS)
MobileNetV2: 17.33 ms → 5.37 ms (186 FPS)
InceptionV1: 118.38 ms → 18.66 ms (53.6 FPS — 6.3× speedup!)
mobilenetv2/010: 11.12 ms → 1.65 ms (451,584/451,584 exact)
Problem 9: Post-Processing Accuracy (NMS, TopK, Softmax)
The Problem: Forcing NMS, TopK, or Softmax through INT8 quantization inside a monolithic .nb binary destroys bounding-box precision.
The Fix: Because Mesa Teflon plugs in as a standard TFLite external delegate, heavy quantized convolutions run on the 8× NN cores while precision-sensitive float32 post-processing stays seamlessly on the Arm Cortex-A76/A55 CPU—zero manual model surgery.
Problem 10: Unlocking General-Purpose Vivante PPU Compute Shaders & Zero-Copy V4L2 PRIME
The Problem: Proprietary VIPLite .nb blobs hide the NPU's programmable Vivante PPU shader core completely.
The Fix: Built and verified npu_ppu_compute_test.c (28-DWORD deterministic PPU compute shader with explicit u2 uniform, 0.073 ms, 5/5 bit-exact IEEE-754 float32) and npu_v4l2_dmabuf_test.c (0.803 ms, zero-copy /dev/video0VIDIOC_EXPBUF → DRM_IOCTL_PRIME_FD_TO_HANDLE → etnaviv PPU shader).
By Tim Michals Featured for Hackster.io — Open-Source Edge AI, Mainline Linux &
Embedded Vision
Introduction:
What Does It Actually Take to Accelerate AI at the Edge?
Pick up almost any modern single-board computer and the headline spec
jumps right off the box: “Octa-Core CPU + 3.0 TOPS AI NPU!” For
robotics, smart cameras, and edge-vision projects, that promise sounds
simple—plug in a camera, run a neural network, and detect objects in
real time without needing a desktop GPU or sending video to the
cloud.
Before diving into Linux drivers or silicon registers, it helps to
step back and ask a simpler question: what is an AI accelerator
actually doing, and why does a normal CPU struggle with it?
1. Why AI
Needs So Much Math (and What “Convolution” Means)
When a computer vision model looks at a camera frame—say, a
1920×1080 image—it doesn’t “see” a person or a stop sign
all at once. Instead, it passes the image through dozens of layers of
convolution (CONV_2D).
A convolution is surprisingly simple: imagine taking
a tiny 3×3 magnifying glass (called a
kernel or filter) and sliding it
across every single pixel of the image. At each stop, the computer
multiplies those 9 pixel values by 9 learned weights
and adds them up into one output number. Early layers look for simple
things like vertical edges or bright spots; deeper layers combine those
patterns into wheels, faces, or text. A single modern vision model might
perform billions of these tiny multiply-and-add steps
on every single frame—30 times a second. A general-purpose CPU is built
for complex logic and branching, not doing billions of repetitive
multiplies per second, so it quickly gets hot, burns power, and drops
frames.
2. Why “8-Bit
Quantization” Is the Secret Behind TOPS
Models are usually trained on big server GPUs using 32-bit
floating-point numbers (FP32—high-precision decimals). On a
tiny embedded board, you don’t need 32 bits of decimal precision just to
tell a cat from a coffee mug. Quantization converts
those FP32 weights and pixel values into compact
8-bit whole numbers (INT8 or
UINT8, from -128..127 or
0..255).
Shrinking from 32-bit decimals to 8-bit integers makes each
multiply-add circuit roughly 15–20× smaller and more
power-efficient, and cuts memory traffic by
4×. When a chip advertises “3.0 TOPS”
(Tera Operations Per Second), it means 3 trillion 8-bit integer
operations per second—not 32-bit desktop floating point.
3.
Fixed-Function NN Cores vs. Programmable Shaders (and Why You Need
Both)
An NPU (Neural Processing Unit) isn’t just one giant
calculator. Real AI pipelines do more than convolutions: you also have
to resize/normalize camera pixels before inference, or run custom math,
activations, and image filters afterward. Inside modern NPUs like the
Vivante VIP9000 on Allwinner’s A733, the silicon is split into two
complementary helpers: - NN (Neural Network) Cores:
Fixed-function hardware arrays packed with hundreds of 8-bit
multipliers. They are unbeatable at convolutions, but they
cannot run arbitrary if/else code or general math.
- PPU / Shader Core: A small programmable parallel
processor (like a mini compute GPU) that runs short parallel programs
(shaders) across hundreds of pixels or tensor elements
at once—handling custom math, image pre/post-processing, and ops the
fixed-function NN cores don’t support.
4. Why “Zero-Copy”
Memory Matters for Live Video
Even with a fast NPU, copying a 1080p camera frame from the camera
driver into CPU memory, converting it, and copying it back to the NPU
wastes huge amounts of memory bandwidth. On Linux,
dma-buf lets the camera hardware, video
encoder, and NPU share the exact same physical memory
buffer—so frames move from camera to NPU with zero CPU
copies.
Breaking Out of the Vendor
BSP Trap
Most SBCs lock this NPU hardware inside an old vendor kernel
(5.15), closed-source userspace libraries
(libVIPlite.so), and proprietary offline .nb
model compilers. On the Radxa Cubie A7A (Allwinner
A733) and Cubie A5E (Allwinner T527), we set
out to unlock this stack on 100% open-source mainline Linux
7.1 using the upstream etnaviv
DRM driver (/dev/dri/renderD128), Mesa 26.1.8
Teflon (libteflon.so, which runs standard
.tflite models directly), and V4L2dma-buf zero-copy camera pipelines.
Real silicon bring-up is messy, and this article shares the whole
journey—what already works on live Cubie A7A hardware (PPU shader
compute at 0.059–0.396 ms, zero-copy V4L2/dev/video0 and CMA dma-buf -> NPU PRIME at
0.401–0.487 ms, and ov5647 CSI +
Cedrus H.265 video), as well as the open
HW_V83 NN conv2d DRAM-read investigation still
underway.
Why
Edge AI Matters (and CPU vs. GPU vs. NPU at a Glance)
Running AI locally on the board (“at the edge”) instead of in the
cloud delivers sub-millisecond latency (critical for
robotics and drones), privacy (camera feeds never leave
the device), offline reliability, and high
performance per watt: - CPU: Great for
operating systems, networking, and branching logic
(if/else); poor at billions of repetitive matrix
multiplies. - GPU: Built for 32-bit floating-point
graphics and parallel math, but power-hungry and absent or small on many
headless embedded SoCs. - NPU: Purpose-built for
quantized 8-bit neural network math and on-chip SRAM dataflow at a
fraction of the power.
Companion Articles,
Guides & How You Can Help
If you want to go deeper—or help crack the remaining open
HW_V83 NN bring-up items—these companion guides cover each
layer of the stack: - Use Cases & Workload Mapping:
Inside
an Edge AI Chip: NN Cores, Shaders, and Why You Need Both —
plain-English guide to matching workloads across NPU, PPU shaders, Arm
NEON, ISP/VE, and the on-die XuanTie E902 RISC-V core. - Silicon
Debugging War Stories: Freeing
the Allwinner A733 NPU on Mainline Linux 7.1: The 8 Real-World Problems
We Solved — deep dive into 0x9003
vs. 0x9202, TP_ENGINE=0, MMUv2 PDMODE, and the
ongoing HW_V83 NN DRAM-read investigation. -
Copy-Pasteable Build, C++, PPU & Video Examples: Allwinner
T527 & A733 Mainline NPU Guide — complete build instructions and
verified npu-ppu-test / npu-v4l2-dmabuf-test
commands. - Camera & Hardware Video Encoding: Camera
/ ISP 602 V4L2 Guide and A733
Cedrus H.264/H.265 Encoder Guide. - Upstream
References: Mesa
Teflon Documentation and Linux kernel
drivers/gpu/drm/etnaviv/. - Want to pitch
in? Community kernel/Mesa hackers are especially welcome to
help test or trace the two remaining open items: the HW_V83
(0x9202) NN conv2d DRAM-read bug and
etnaviv.kormmod/insmodPD_NPU re-probe (GC0 after power-domain
cycle).
๐
1. Silicon Architecture: How the A733 & T527 NPUs Work Under the
Hood
If you have ever deployed a computer vision model (like YOLOv8,
MobileNetV2, or PoseNet) on an embedded Linux single-board computer, you
have felt the wall that general-purpose CPU cores hit when processing
real-time 1080p video.
Even on a modern octa-core processor like the Allwinner
A733 (2× Arm Cortex-A76 @ 2.0 GHz + 6× Cortex-A55 @ 1.8 GHz,
powering the Radxa Cubie A7A) or the Allwinner
T527 (8× Cortex-A55 @ 1.8 GHz, powering the Radxa Cubie
A5E), running millions of multiply-accumulate operations per
frame on the CPU means: - Burning 3–5 Watts of CPU
thermal budget on matrix math instead of application logic. - Saturating
the CPU’s L1/L2 caches and external DRAM bus by repeatedly fetching
weights and writing intermediate feature maps. - Dropping frames
whenever the CPU also has to handle camera capture, H.264/H.265 video
encoding, or network streaming.
To solve this, silicon designers place a dedicated Neural
Processing Unit (NPU) right on the SoC die. On the
Allwinner A733 (verified on live Radxa Cubie
A7A silicon), that NPU is a 3.0 TOPS-class VeriSilicon
Vivante VIP9000Nano-DI (npu@3600000,
model 0x9000, rev 0x9202,
HW_V83); on the Allwinner T527,
it is a 2.0 TOPS VeriSilicon Vivante VIP9000Nano-SI+
(npu@7120000, rev 0x9003).
How Does an NPU
Work Compared to a CPU or GPU?
Unlike a CPU (which fetches scalar or small SIMD instructions one by
one) or a GPU (which runs general-purpose 32-bit floating-point
shaders), a neural network accelerator is a spatial dataflow
engine purpose-built around four hardware principles:
8-Bit Quantized Tensor Math (INT8 /
UINT8): Neural networks trained in 32-bit floating
point (FP32) are quantized to 8-bit integers
(INT8 or UINT8) using per-tensor or
per-channel scale and zero-point parameters. An 8-bit integer
multiply-accumulate (MAC) circuit takes roughly
15–20× less silicon area and switching energy than an
FP32 fused multiply-add, allowing the A733 NPU to pack
8 parallel NN cores × 64 MADs/core (with ZDP3 spatial
reuse, delivering up to 3.0 TOPS marketed peak at high
OPP clocks) into a compact silicon footprint.
Spatial Weight & Activation Broadcast Across 8 NN
Cores: In a 2D convolution (3×3 or 1×1), the exact same kernel
weights slide across thousands of (x, y) pixel locations,
while the same input pixel patch is multiplied against dozens of output
channels. Instead of reading weights from DRAM over and over, the NPU
loads weights and input tiles once into 512 KB of ultra-wide
on-chip VIP SRAM (128 bytes / 1024 bits per
cycle physical width on the A733) and broadcasts them
simultaneously across its 8 Neural Network (NN)
cores.
On-the-Fly Hardware Weight Decompression (Huffman +
ZRL): Neural network weights contain large runs of zeros and
clustered small integer values. When a model is loaded, its weights are
compressed using Huffman coding and Zero-Run-Length
(ZRL) encoding. Inside the NPU, a dedicated hardware bitstream
decoder decompresses weights as DMA streams them from LPDDR5—cutting
external memory bandwidth by 2–4× with zero CPU
overhead.
Fused Hardware Pooling, Activation &
Requantization: Before a partial sum ever leaves an NN core,
dedicated inline stages apply 32-bit bias addition, non-linear
activation (ReLU, ReLU6, Clamp),
2×2 max or average pooling, and 8-bit requantization in a single pass.
On SoCs with a dedicated Tensor Processor (TP) (such as
the T527), layout transposes and LUT activations run on TP cores; on the
A733 0x9202 (TP_ENGINE = 0), non-NN ops fall
to the companion Programmable Shader / PPU core
(NumShaderCores = 1) or CPU.
NN
Cores vs. PPU Shaders vs. Missing TP Engine: Why Both Paths Matter (and
Best Use Cases)
A common misconception is that an “NPU” is one single black-box
circuit. On the Allwinner A733 (VIP9000Nano-DI, rev
0x9202), the block at 0x03600000 is actually a
two-engine heterogeneous compute cluster sharing one
Front-End DMA parser and MMUv2:
8× NN Cores (Fixed-Function Convolution Arrays):
Ultra-dense INT8 multiply-accumulate hardware (512 MACs/cycle). Blazing
fast for CONV_2D, DEPTHWISE_CONV_2D, and
FULLY_CONNECTED (90%+ of a YOLO or MobileNet backbone),
but unable to run general-purpose code
(if/else, float32 math, FFTs, image filters, or
bounding-box NMS).
1× PPU / Shader Core (Programmable Processing Unit, 256
Hardware Threads): A shader is simply a small
parallel program (OpenCL / SIMD vector kernel) that executes across
hundreds of pixels or tensor elements simultaneously—like a mini compute
GPU bolted onto the NPU die. It handles everything fixed-function NN
cores cannot: float32/fp16 math, image pre/post-processing, optical
flow, custom activations, and tensor layout shuffles.
No Dedicated TP Engine
(TP_ENGINE = 0): Older Vivante NPUs (T527
0x9003, i.MX8MP 0x8002) included a third
dedicated Tensor Processor (TP) to transpose tensors
(NHWC ↔︎ NCHW) and run LUT activations. On A733
0x9202, Vivante removed the TP hardware to save die
area—making software support for both the NN engine
(Path A) and PPU/CPU ops (Path B) essential.
Real edge-vision and robotics pipelines are never
100% convolutions. Matching each stage to the right silicon block on the
A733 is why this dual-path mainline stack matters:
Allwinner A733 Heterogeneous AI &
Vision Workload Mapping
Allwinner
A733 (0x9202) vs. Allwinner T527 / A527
(0x9003): What Live Silicon Revealed
A common pitfall when reading vendor headers is guessing which
gc_feature_database.h row matches an SoC without checking
silicon. Before booting the A7A, it was easy to assume the A733 carried
Allwinner’s 12-core 0x9113 (VIP9000UL-DI+)
block—live hardware readback on the Radxa Cubie A7A
(/sys/kernel/debug/dri/0/gpu) proved the A733 silicon is
actually model 0x9000, revision 0x9202
(product_id 0x05090009,
customer_id 0x1000003b, eco_id 0x08000000,
chip date 2023-05-18) — VeriSilicon
VIP9000Nano-DI (HW_V83,
VIP_VERSION 0x398).
Live silicon register readbacks and VeriSilicon’s hardware feature
database (allwinner/gc_feature_database.h) highlight the
exact architectural differences between the A733 and T527:
๐
2. Breaking Out of the Proprietary Vendor Trap: Why Mainline
etnaviv + Mesa Teflon?
Traditionally, using a Vivante VIP9000 NPU on an Allwinner SoC meant
accepting a locked-down vendor BSP stack: * Kernel
Space: A ~44,000-line out-of-tree kernel module
(vipcore.ko or galcore.ko exposing
/dev/vipcore or /dev/galcore) that breaks on
every minor Linux kernel upgrade (EXTRA_CFLAGS removal,
in_irq() deprecation, MAX_ORDER rename,
platform_driver.remove signature changes). *
Userspace: Precompiled closed-source shared libraries
(libVIPlite.so, libVIPuser.so, or
TIM-VX) tied to a specific glibc/Android ABI. *
Offline Model Lock-In: You cannot load a standard
.tflite model directly. Instead, you must run a proprietary
x86 offline compiler (acuity-toolkit /
pegasus) to convert your model into a locked
.nb (network_binary.nb) blob tailored to a
single chip revision.
To run on mainline Linux 7.1 with zero binary blobs,
we replaced the entire vendor stack with upstream open-source
components:
Legacy Vendor NPU Stack vs. Mainline
Open-Source Stack
To be fair to the vendor stack, Allwinner and VeriSilicon’s
proprietary tools (ACUITY + .nb +
libVIPlite.so / libNBGlinker.so + Allwinner
awnn) exist for a reason and do offer real
advantages today when running on the vendor 5.15 BSP: *
Ahead-of-Time Whole-Graph Optimization
(.nb): ACUITY compiles ONNX, PyTorch,
or TFLite models offline on an x86 PC into a pre-scheduled
.nb binary—eliminating runtime graph compilation overhead
and fusing Conv + Bias + ReLU + Pool aggressively. *
Hardware Weight Compression & VIP SRAM Tiling:
ACUITY emits Huffman + Zero-Run-Length
(ZRL) compressed weights (2–4× less LPDDR5 traffic) and
statically tiles intermediate feature maps inside the 512 KB
on-chip VIP SRAM across consecutive layers so tensors stay
on-die instead of bouncing through external DRAM. * Broader
Operator & Precision Coverage: Supports INT8,
UINT8, and INT16, custom OpenVX/PPU kernels,
and turnkey Allwinner awnn / vpm_run demos
(YOLOv5, YOLOv8, face/pose) out of the
box.
Can we use libVIPlite.so, ACUITY,
or awnn inside our open-source mainline stack?No — not directly.libVIPlite.so,
libNBGlinker.so, awnn, and the
ACUITY compiler are closed-source proprietary binaries tied
to the out-of-tree /dev/vipcore ioctl ABI (not Linux DRM
/dev/dri/renderD128), and vipcore.ko cannot be
upstreamed into mainline Linux.
Wait—doesn’t ACUITY need an x86 PC? Can open
source actually match its speed on the board? VeriSilicon ships
ACUITY as an x86-only offline tool largely for convenience
and IP protection, not because the Arm SoC can’t do the
graph compilation. Compressing quantized weights (Huffman/ZRL), planning
512 KB VIP SRAM tiles, and building the command stream take a fraction
of a second once at model-load time on the A733’s Cortex-A76/A55 cores
(and can be cached to disk so subsequent runs load in
milliseconds)—no x86 Docker container required.
Because all of the underlying capabilities
(Huffman/ZRL weight compression, VIP SRAM tiling, multi-layer batching,
and PPU shaders) are hardware features of the VIP9000 die, we are
still resolving the HW_V83 NN DRAM-read issue
first, and our next steps are to bring those
exact optimizations clean-room into MIT-licensed Mesa
etnaviv / Teflon so the open-source stack can
match proprietary .nb performance without binary blobs or
kernel lock-in.
๐ฌ
3. Inside the Chip: How the A733 NPU Works (Clocks, MMUv2, DMA & 8
NN Cores)
To understand what happens inside the silicon at
0x03600000 when an AI inference job runs—and why specific
clock, reset, and MMUv2 registers had to be unlocked for the Allwinner
A733—let’s trace the internal hardware blocks from the power rail down
to the 8 NN cores.
3.1 Power
Domain, 4-Clock CCU Hierarchy & Triple Reset Lines
Before a single register at 0x03600000 responds to CPU
reads, three hardware prerequisites must be satisfied in strict
order:
Power Supply & Silicon Island
(AXP8191 dcdc2 + PCK-600 PD_NPU):
The external vdd-gpu-npu power rail is driven by the
AXP8191 PMIC dcdc2 buck converter
(800 mV at 492–852 MHz boot nominal, scaling up to
960–1080 mV at 1008–1120 MHz OPP bins).
Inside the A733 SoC, the PCK-600 Power Controller
(7060000.power-controller) controls power isolation for the
NPU island via domain PD_NPU (id 4,
pstate=0x8, on). When etnaviv calls
pm_runtime_resume_and_get(), Linux genpd
powers on PD_NPU and releases isolation clamps.
The 4-Clock Tree in Mainline
ccu-sun60i-a733.c:
CLK_NPU (0x0b00,
"core"): The high-speed compute clock driving the
8 NN cores and 512 KB VIP SRAM (840 MHz default from
pll-npu, muxable across pll-npu,
pll-periph0-800M/600M/480M, pll-ve0,
pll-ve1, pll-de-3x) with a 5-bit divider
(M) and gate BIT(31).
CLK_AHB_NPU (0x05c0 bit 6) →
CLK_BUS_NPU (0x0b04 bit 0, "reg",
200 MHz): On the A733, CPU register reads/writes
to 0x03600000 traverse two series AHB clock
gates: the top-level NPU AHB master gate (0x05c0
bit 6) and the NPU module bus gate (0x0b04 bit 0). In
drivers/clk/sunxi-ng/ccu-sun60i-a733.c, we parented
bus_npu_clk (CLK_BUS_NPU) directly to
ahb_npu_clk (CLK_AHB_NPU). That way, when
etnaviv enables its "reg" clock, the Linux
Common Clock Framework automatically enables both0x05c0[6] and 0x0b04[0].
CLK_MBUS_NPU (0x05e0 bit 18,
"bus", 600 MHz): Gates the 128-bit
AXI/MBUS DMA master port, parented to mbus_clk
(600 MHz, synced with Junhui Liu’s upstream A733 CCU
v7 patch series). If CLK_MBUS_NPU is left
gated, MMIO register reads work fine, but the NPU’s DMA engine stalls
forever the moment it tries to fetch its first command buffer from
LPDDR5!
Triple Reset Lines (0x0b04 bits 16, 17,
18):
Unlike the T527 (which has a single RST_BUS_NPU bit),
A733 register 0x0b04 splits the NPU reset into active-low
lines: RST_BUS_NPU_CORE
(BIT(16)), RST_BUS_NPU_AXI
(BIT(17)), RST_BUS_NPU_AHB
(BIT(18)) (plus RST_BUS_NPU_SRAM at
BIT(19), read back as 0x000F0000 deasserted on
silicon).
Mainline etnaviv previously called
devm_reset_control_get_optional(), which only supports a
single reset line. By switching
etnaviv_gpu_platform_probe() to
devm_reset_control_array_get_optional_exclusive(&pdev->dev)
(and updating vivante,gc.yaml to maxItems: 3),
etnaviv cleanly asserts and deasserts all three reset lines
as a unit.
3.2 The Front-End
(FE) Wait-Link DMA Command Parser
How does the NPU execute a multi-layer neural network without CPU
intervention between layers?
At the front of the NPU sits the Front-End (FE) Command
Parser. It is a dedicated DMA state machine that reads 64-bit
instructions (LOAD_STATE, END,
NOP, WAIT, LINK,
STALL) directly from system memory:
Wait-Link Ring Buffer: The kernel maintains a small
circular ring buffer in DMA memory ending in a 16-byte
WAIT (200 cycles) → LINK
(back to WAIT) loop. While the NPU is idle or
finishing a job, the FE parser continuously loops between those two
instructions.
Dynamic Job Chaining: When userspace submits an
inference command stream, the kernel writes a LINK
instruction at the end of the user buffer pointing back to the kernel’s
new WAIT -> LINK tail, and then overwrites the previous
LINK target in the active ring to jump into the user’s
command stream. The FE seamlessly follows the new link on its very next
cycle without ever stopping.
Why ETNA_SEC_KERNEL (0x003A4) Is
Mandatory: The VIP9000Nano-DI (0x9202) implements
Vivante’s Security AHB feature
(MINOR_FEATURES7_BIT_SECURITY +
MINOR_FEATURES10_SECURITY_AHB). On this hardware, the
legacy VIVS_FE_COMMAND_CONTROL (0x00658) kick
register is a no-op. By adding the Allwinner 0x9000 NPU
entries (0x8303, 0x9003, 0x9113,
0x9202) to the kernel’s etnaviv_hwdb.c,
etnaviv enables
gpu->sec_mode = ETNA_SEC_KERNEL: it unlocks non-secure
register writes at 0x003A8, writes the command buffer
address to VIVS_FE_COMMAND_ADDR (0x00654), and
starts the FE via VIVS_MMUv2_SEC_COMMAND_CONTROL
(0x003A4).
Every memory address inside an NPU job—the command buffer, compressed
weights, bias tables, input feature maps, and output tensors—is a
32-bit NPU Virtual Address (NPU_VA).
Two-Level Page Walk (PTA → MTLB →
STLB):
The NPU’s internal MMUv2 translates every 32-bit
NPU_VA into a 40-bit LPDDR5 Physical Address
(PA) using a Page Table Array (PTA at
0x0038C/0x00390), a 1024-entry Master TLB
(MTLB, bits [31:22]), and 1024-entry Slave TLB
page tables (STLB, bits [21:12], 4 KB
pages).
Because the MMU translates scatter-gather physical pages into a
contiguous virtual range, large neural network weight buffers do
not need physically contiguous CMA memory—standard
paged Linux GEM buffers work out of the box.
The Revision 0x9202MMU_PAGE_DESCRIPTOR (PDMODE) Architecture
(0x003B4, 0x00388,
0x00184):
On older Vivante cores like the T527 (0x9003),
etnaviv_iommuv2_restore_sec() initializes MMUv2 via a Page
Table Array (PTA at
0x0038C/0x00390/0x00394), runs a
physical-mode FE command buffer
(load_state(VIVS_MMUv2_PTA_CONFIG)), and writes
0x00388 = 0x01.
On the A733 (0x9202), VeriSilicon enabled
MMU_PAGE_DESCRIPTOR = 1
(mmu_pd_mode = 1 in Allwinner’s
vip_drv_hardware.c). Instead of PTA indirection, the kernel
writes the 4 KB Master TLB physical frame directly to
0x003B4 = ((mtlb_dma >> 12) << 4) | MODE4_K
(bit 0 = 0 for etnaviv’s 4 KB MTLB / 4 MB
per-MTLB layout, vs 1 for 1 KB / 16 MB
MODE1_K), skips PTA_CONTROL, configures
0x0055C = 0x00FFFFFF (MC_L2_CACHE_CONFIG) and
0x00090 |= BIT(6) (bypass_reorder), and
enables PDMODE via 0x00388 = 0x21
(BIT(5) | ENABLE).
Subtle TLB Flush Trap in
etnaviv_buffer.c: Mainline etnaviv
flushes the MMUv2 TLB by writing 0x00000018
(MODE_MASK | FLUSH) to
VIVS_MMUv2_CONFIGURATION (0x00184)—which
leaves bit 8 (ADDRESS_MASK) as 0, zeroing the
MTLB base address under PDMODE! Matching Allwinner’s
vip_drv_mmu.c, PDMODE flushes must write
0xffffff7f (ADDRESS_MASK = 1,
MODE_MASK = 1, FLUSH_MASK = 0,
FLUSH = 1) so dynamic BO mappings flush the TLB without
clobbering the page-table base.
3.4
Inside the Compute Engines: 8 NN Cores, 1 PPU Shader Core & 512 KB
VIP SRAM
Once the FE parses a layer kick (VIVS_PS_NN_INST_ADDR at
0x010A0 + VIVS_PS_UNK10A4 at
0x010A4), the actual tensor math runs across the internal
blocks wired to the 512 KB on-chip VIP SRAM:
8 Parallel NN Cores (HW_V83,
VIP_VERSION = 0x398): The NN cluster fetches a
128-byte descriptor from VIVS_PS_NN_INST_ADDR, streams
compressed weights from LPDDR5 into the 512 KB VIP SRAM
(128-byte physical width, mapped via
VIVS_GL_OCB_REMAP_START/END), and executes
64 MADs/core across all 8 NN cores in
parallel (32 lanes/output cycle). On 0x9202,
VeriSilicon enabled HW_V83,
NN_SMALL_BATCH_PHASE2 = 1,
NN_TENSOR_ADD_FIELD_MOVE_TO_EXT_CMD = 1,
and ZRL_8BIT = 0.
1 Programmable Shader / PPU Core (No Dedicated TP
Block): Unlike the T527 (2 TP cores), the A733’s
0x9202 silicon sets
TP_ENGINE = 0 and
TPEngine_CoreCount = 0. All non-NN tensor
manipulation (such as NHWC ↔︎ NCHW layout transpose,
padding, or custom elementwise activations) must execute on the single
USC / PPU Shader core (256 threads,
64 temp regs, 512 instructions) or the Arm
CPU—a key architectural difference that surfaced immediately during our
live Mesa Teflon bring-up below.
๐งฉ 4.
How It Interfaces: The 4-Layer Open-Source Driver & AI Stack
How does a Python script or C/C++ application loading a standard
.tflite file end up driving 8 NN cores through
/dev/dri/renderD128? The software stack is cleanly split
into four layers.
Open-Source NPU Software Stack: TFLite C
API -> Mesa Teflon -> Etnaviv Gallium -> Linux DRM
4.1
Layer 1: Application & TensorFlow Lite Runtime
(libtensorflow-lite.so)
Your application uses the standard TensorFlow Lite C
API (<tensorflow/lite/c/c_api.h>) or Python
tflite_runtime. You do not link against any proprietary NPU
SDK. Instead, you load Mesa’s /usr/lib/libteflon.so as a
standard TFLite external delegate plugin
(tflite_plugin_create_delegate):
When TfLiteInterpreterCreate() and
TfLiteInterpreterAllocateTensors() execute: 1. DRM
Render Node Discovery: Teflon opens
/dev/dri/renderD128 via
pipe_loader_drm_probe_fd() and instantiates a Gallium
pipe_screen and pipe_context backed by
etnaviv. 2. Automatic Graph Partitioning
(Prepare): Teflon walks every node in the
.tflite flatbuffer graph. Supported quantized
(INT8 / UINT8)
operators—CONV_2D,
DEPTHWISE_CONV_2D,
FULLY_CONNECTED (lowered to 1×1
convolution), ADD,
AVERAGE_POOL_2D,
MAX_POOL_2D,
PAD,
LOGISTIC, and fused
RELU / RELU6—are claimed by
the Teflon delegate and merged into contiguous NPU subgraphs. Any
unsupported operator (such as a final SOFTMAX
dequantization node) automatically remains on the Arm CPU. 3.
Lowering to Gallium ML: Teflon converts the partitioned
TFLite subgraph into an array of hardware-agnostic Gallium
struct pipe_ml_operation descriptors and hands them to
context->ml_subgraph_create().
4.3
Layer 3: Mesa Etnaviv Gallium ML Backend
(src/gallium/drivers/etnaviv/)
Inside Mesa’s etnaviv driver, the neural network
subgraph is compiled directly into VIP9000 hardware descriptors,
compressed weight bitstreams, and FE command buffers:
At screen creation, Mesa queries the kernel via
DRM_IOCTL_ETNAVIV_GET_PARAM for MODEL
(0x9000), REVISION (0x9202),
PRODUCT_ID (0x05090009),
CUSTOMER_ID (0x1000003b), and
ECO_ID (0x08000000).
etna_query_feature_db() in
src/etnaviv/hwdb/etna_hwdb.c looks up the exact silicon row
in src/etnaviv/hwdb/allwinner/gc_feature_database.h and
configures the compiler for the A733’s
nn_core_count = 8,
nn_mad_per_core = 64,
on_chip_sram_size = 524288
(512 KB),
physical_vip_sram_width = 128
(128 bytes/cycle),
nn_zdp3 = true, and
nn_lanes_per_out_cycle = 32.
The TP_ENGINE = 0 Discovery on Live
0x9202 Silicon: Earlier Mesa patches forced
info->npu.tp_core_count = db->TPEngine_CoreCount ? db->TPEngine_CoreCount : 1;
assuming a single TP unit existed whenever
TPEngine_CoreCount was 0. Live silicon testing
on the A7A (0x9202, where
gcFEATURE_BIT_TP_ENGINE = 0 and
TPEngine_CoreCount = 0) proved that the
hardware truly has no TP engine—TP
transpose/detranspose ops become silent no-ops, leaving intermediate and
final buffers zeroed unless lowered to the PPU shader core or CPU!
One-Time Compilation During AllocateTensors()
(etna_ml_subgraph_create):
Hardware Transpose & Channel Reshuffle Insertion
(etnaviv_ml_tp.c): Whenever an input or output
tensor layout requires realignment between TFLite’s NHWC
and the NN engine’s NCHW, Mesa wraps the graph with
transpose/detranspose stages (which use hardware TP cores on T527
0x9003, and need a PPU shader / CPU fallback on A733
0x9202).
V8 Superblock Tiling & Weight Compression
(etnaviv_ml_nn_v8.c): Filter weights and biases
are tiled into V8 superblocks matched to 8 NN cores and
the 512 KB VIP SRAM, compressed into a bitstream, and
uploaded into a write-combined GEM buffer object
(coefficients).
Command Stream Generation
(etnaviv_ml.c): Mesa records the entire sequence
of FE register writes (VIVS_GL_OCB_REMAP_START/END,
VIVS_GL_NN_CONFIG, VIVS_PS_NN_INST_ADDR,
VIVS_PS_UNK10A4, and VIVS_GL_FLUSH_CACHE
barriers).
Zero-Recompile Inference During Invoke()
(etna_ml_subgraph_invoke):
Every call to TfLiteInterpreterInvoke() simply updates
the input tensor BO, submits the pre-compiled command stream via
DRM_IOCTL_ETNAVIV_GEM_SUBMIT, and waits on the hardware
fence via DRM_IOCTL_ETNAVIV_WAIT_FENCE.
In kernel space, etnaviv provides: *
Unprivileged Compute Access
(/dev/dri/renderD128): AI applications run as
normal non-root users via the DRM render node. * Per-Process
MMUv2 Isolation & dma-buf PRIME Import: Every
process gets isolated MMUv2 page tables, and camera/video buffers from
V4L2 or G2D can be imported directly into NPU virtual memory via
DRM_IOCTL_PRIME_FD_TO_HANDLE. * DRM GPU Scheduler
(drm_gpu_scheduler) & Runtime PM: Fair job
scheduling, hardware hang detection with automatic triple-reset
recovery, and runtime power gating of PD_NPU when idle.
๐ฅ
5. Zero-Copy Video Processing: Connecting MIPI CSI-2, ISP 602, Hardware
H.264/H.265 VE, and the 3.0 TOPS NPU
In a real vision application—an autonomous drone, agricultural
sprayer, security camera, or industrial inspection rig—the NPU does not
live in isolation. It consumes live video frames from a camera while a
video encoder simultaneously records or streams those frames over
RTSP/WebRTC.
If the CPU had to copy every 1080p (1920 × 1088)
NV12 frame (3.13 MB/frame, or ~94
MB/s at 30 fps) between the camera driver, the H.265 video
encoder, and the NPU preprocessor, memcpy() and cache
flushes alone would saturate an entire CPU core.
On the Allwinner A733 (Radxa Cubie A7A), we
eliminate CPU frame copies by passing Linux dma-buf
file descriptors allocated in shared LPDDR5 CMA memory directly
across all hardware engines:
5.1
Stage 1: Photon to Shared NV12dma-buf
(0% CPU Pixel Math)
MIPI CSI-2 Sensor (OV5647) & D-PHY
(0x05800000): The camera sensor streams 10-bit Raw
Bayer (SRGGB10_1X10) at 1920 × 1080 @ 30 fps
over a 2-lane MIPI CSI-2 link into the A733 combo D-PHY and CSI0
receiver (0x05811000).
In-Line Hardware ISP 602 (0x05809400,
sun60i-isp): Running in on-the-fly
(online) mode directly from the CSI parser FIFO at
~148.5 Mpixels/s, the Hardware ISP 602
performs black-level correction, lens shading, 2D noise reduction, Bayer
demosaicing, color correction (CCM), gamma, and
RGB-to-NV12 color space conversion in dedicated silicon
(0% CPU). Userspace aw-isp-2a runs only once
per frame (30 Hz) to read compact 3A histogram statistics and update
sensor exposure/gain over I²C.
CSI DMA0 (0x05813000,
/dev/video0): Writes stride-aligned
1920 × 1088 planar NV12
frames (Y luma + interleaved UV chroma)
directly into contiguous LPDDR5 CMA ring buffers
(vb2-dma-contig) and exports each buffer as a
dma-buf PRIME file descriptor via
VIDIOC_EXPBUF.
5.2
Stage 2: Parallel Zero-Copy Fan-Out to Hardware Video Encoder, 3.0 TOPS
NPU & RISC-V
When V4L2 dequeues a completed camera frame
(VIDIOC_DQBUF), userspace hands the
dma-buf FD to three hardware blocks in
parallel without copying the 3.13 MB frame on the
CPU:
Branch A — Hardware H.264 / H.265 Video Encoding
(ve@1c10000, < 1.6% CPU):
The V4L2 dma-buf FD is imported directly into the
Allwinner A733 Video Engine (ve@1c10000,
VE300 / V3102_0016) with
VE_BUFFER_FLAG_DMA_BUF.
The VE’s internal hardware CSI /
ISP preprocessor (+0xA00) and
AVC (+0xB00) / HEVC
(+0xC00) encoder sub-engines read the
Y and UV planes directly from the camera CMA
buffer over the 128-bit MBUS DMA port (CLK_MBUS_VE at 600
MHz).
Measured Hardware Performance on Radxa Cubie A7A:
1080p30 H.264 (AVC) Hardware Encoding: 3.09
ms/frame (323.5 fps max throughput),
0.89% total system CPU usage.
1080p30 H.265 (HEVC) Hardware Encoding:
6.34 ms/frame (157.8 fps max
throughput), 1.55% total system CPU usage.
Branch B — 3.0 TOPS-Class VIP9000Nano-DI NPU Inference
(npu@3600000):
Simultaneously, the NPU processes the detection tensor
(e.g. 640 × 640 × 3 or 320 × 320 × 3UINT8/INT8).
Using Allwinner’s G2D 2D hardware blitter
(g2d@1480000 — hardware YUV-to-RGB color conversion +
bilinear downscaler accepting the source V4L2 dma-buf FD
and writing directly into an etnaviv GEM
dma-buf BO via drmPrimeFDToHandle()), or a
fast NEON stride-gather into the write-combined Teflon input BO, the
input tensor is mapped into the NPU’s MMUv2
(0x00388) page table.
Calling TfLiteInterpreterInvoke() runs the pre-compiled
Teflon command stream across the 8 NN
cores and 512 KB VIP SRAM, outputting bounding
boxes, class IDs, and confidence scores while the Arm cores remain
largely idle.
Branch C — Hard Real-Time Actuation on the On-Die 200 MHz
RISC-V Core (rproc@7032000):
When the NPU detects a target
(ฮx, ฮy, class, confidence), Linux writes a 16-byte
setpoint into System SRAM A2 (0x00044000)
and rings the Hardware MSGBOX0
(0x07033000) doorbell.
Within 14.47 ยตs, the on-die 200 MHz XuanTie
E902 RISC-V coprocessor updates its bare-metal PID / motor
control loop with zero Linux scheduling jitter (see our companion
Hackster.io guide on Unlocking
the On-Die 200 MHz XuanTie RISC-V Core).
Here is the exact Device Tree, Kernel, Buildroot, and verification
setup used on the Radxa Cubie A7A (Allwinner A733) in
this repository.
6.1 Device Tree Node
(sun60i-a733-cubie-a7a.dts)
In
arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts, we
define the NPU node at 0x03600000 with its 3 clocks
(bus, core, reg), 3 reset lines
(core, axi, ahb), PCK-600 power
domain (PD_NPU), and the AXP8191 dcdc2
(vdd-gpu-npu) regulator:
6.2
Summary of the 6 Mainline Kernel & Mesa Fixes for Allwinner A733
(0x9202)
Summary of the 6 Mainline Kernel &
Mesa Fixes for Allwinner A733 (0x9202)
6.3
Live Silicon Verification on Radxa Cubie A7A (Two Complementary Compute
Paths)
Because the VIP9000Nano-DI (0x9202)
combines a programmable Vivante PPU (OpenCL/Shader)
core with an 8-core HW_V83 Neural Network
(NN) engine, we validate and expose both
compute paths on /dev/dri/renderD128 for different
workloads:
Path A — Neural Network Inference
(Mesa 26.1.8 Teflon + 8× NN Cores): Zero-compile
TFLite delegation for quantized CNNs (CONV_2D,
DEPTHWISE_CONV_2D, FULLY_CONNECTED).
Path B — General-Purpose Compute (etnaviv DRM +
Vivante PPU Shader Core): Low-latency custom kernels
(npu_ppu_compute_test.c) for image pre/post-processing, DSP
math, or custom non-CNN algorithms.
Booting our mainline Linux 7.1.0 PREEMPT_RT Buildroot
image on the Radxa Cubie A7A confirmed full kernel
bring-up and live PPU + NN execution:
# 1. Verified live kernel boot log on Radxa Cubie A7A:dmesg|grep-iE"etnaviv|npu"# [ 0.111755] sunxi-pck-600 7060000.power-controller: domain "NPU" (id 4) pstate=0x8, on# [ 0.125867] etnaviv etnaviv: bound 3600000.npu (ops gpu_ops)# [ 0.125975] etnaviv-gpu 3600000.npu: model: GC9000, revision: 9202# [ 0.125986] etnaviv-gpu 3600000.npu: etnaviv has been instantiated on a NPU, for which the UAPI is still experimental# [ 0.126585] [drm] Initialized etnaviv 1.4.0 for etnaviv on minor 0# 2. Verified live silicon identity, clocks, power & thermals:cat /sys/kernel/debug/dri/0/gpu# model: 0x9000 | revision: 0x9202 | product_id: 0x5090009# customer_id: 0x1000003b | eco_id: 0x8000000# shader_core_count: 1 | nn_core_count: 8 | thread_count: 256# pll-npu / npu = 840 MHz | mbus-npu = 600 MHz | bus-npu = 200 MHz# vdd-gpu-npu (AXP8191 dcdc2) = 800 mV (in spec for SID vf0500/vf0501) | NPU temp = 35.9 C
✅ Verified Live on A733
Silicon
Path B — Vivante PPU Compute Shader
(npu_ppu_compute_test.c): Executing a 28-DWORD
cold-boot-deterministic Vivante PPU compute shader
(img_load.u8 → lshift.s32 →
rshift.s32 → i2f.s32 → mov t2, u2
→ mul → img_store.u8) directly on
3600000.npu via DRM_IOCTL_ETNAVIV_GEM_SUBMIT
completed in 0.052–0.950 ms per dispatch
across 10/10 consecutive runs with 0 MMU
faults, 0 hangs, clean
GIC_SPI 65 interrupts, and
bit-exact IEEE-754 float32 outputs across all tested
inputs:
fill = 1 → 0x3d808000
(0.062744)
fill = 2 → 0x3e008000
(0.125488)
fill = 3 → 0x3e40c000
(0.188232)
fill = 5 → 0x3ea0a000
(0.313721)
fill = 7 → 0x3ee0e000
(0.439209)
Zero-Copy V4L2 / CMA dma-buf PRIME → NPU PPU
Shader (npu_v4l2_dmabuf_test.c): Exporting a V4L2
capture buffer via VIDIOC_EXPBUF (/dev/video0,
0.206 ms) or allocating a CMA
dma-heap buffer
(/dev/dma_heap/default_cma_region,
0.220 ms) and importing it into
etnaviv via DRM_IOCTL_PRIME_FD_TO_HANDLE
executed the PPU compute shader directly on the video buffer with
bit-exact IEEE-754 float32 output
(0x3ea0a000) and zero CPU
memcpy.
Path A — Live Silicon Reverse-Engineering of
HW_V83 (0x9202) NN Descriptors (WIP):
Comparing 0x9202 against every other NPU in Mesa’s HWDB
revealed that Allwinner A733 is the first chip in Mesa
combining four new Vivante HW_V83 features. Live register
and descriptor sweeps on the Cubie A7A proved every single bitfield on
silicon:
FP_INIMAGE_POST_SCALE = 1
(NN_INT8_SCALE = 0): On earlier V8 chips
(e.g. Amlogic 0x8302), Mesa wrote
shift = 127 - exp (e.g. 8) into
post_shift. On 0x9202, HW_V83
interprets post_shift (w2[31:27] +
w15[29:28] + w15[30]) as the raw
IEEE-754 biased exponent (scale_bits >> 23,
e.g. 119/120), paired with the 23-bit
mantissa in post_multiplier* (w22[25:18],
w17[31:24], w15[27:22], w2[26])
and sign bit in w27[28]. Writing 8 multiplied
every accumulator by 2^(8-127) ≈ 0 (producing
0 + out_zero_point = 128 everywhere); switching to the raw
IEEE-754 exponent immediately produced real spatially-structured 3×3
SAME-padded Conv2D feature maps on silicon
(0.11 ms per dispatch).
NN_CMD_SUPPORT_SLICE = 1:
w8[31:16] (out_image_y_stride) and
w16[31:16] (in_image_y_stride) are
channel-slice byte strides (x * y), not
row counts (y). Programming
out_image_y_stride = 64 (8 * 8) immediately
wrote all 4 output channels cleanly (256/256 bytes,
TotalWrites = 0x20).
TP_ENGINE = 0
(TPEngine_CoreCount = 0): Vivante removed the
hardware TP block on 0x9202 (replacing it with a Stream
Processor, SP_VECTOR_DEPTH = 0x400). Our Mesa patch
(0002-etnaviv-teflon-add-hw-v83-and-no-tp-support.patch)
reports tp_core_count = 0 and executes internal
NHWC ↔︎ NCHW layout transposes and strided
reshuffles on CPU with GPU batch synchronization.
MMU_PAGE_DESCRIPTOR = 1
(mmu_pd_mode = 1) & Current WIP Status:
Controlled live probes showed that under legacy PTA mode
(0x003B4 = 0x1, 0x00388 = 0x01), NN descriptor
and output writes hit DRAM while NN input/coefficient DMA streams read
0xFF. Cross-checking Allwinner’s vendor
vip_drv_hardware.c and vip_drv_mmu.c confirmed
0x9202 requires native MODE4_K MMUv2
PDMODE
(0x003B4 = ((mtlb_dma >> 12) << 4) | 0x0,
0x00388 = 0x21, skipping PTA_CONTROL, plus
0xffffff7f TLB flushes). On live
/usr/bin/npu-smoke-test, quantized_add_8x8x3
matches CPU 192/192 (0.002 ms), and
quantized_conv2d_8x8x3x4 dispatches cleanly
(0.105 ms), but still hits an open NN engine DRAM-read
issue (max_abs_diff = 31, constant per-channel output
[104,104,104,104,92,92,92,92]; run_lenet0 on
official lenet_v3.nb returns constant 62).
Testing vendor #[initial states kernel] +
0x038C0=0, 0x038C4=1, 0x03818=1 confirmed it does not yet
resolve this remaining NN DRAM-read bug.
๐ฌ
7. Community Questions, Common Allwinner A733 NPU Issues & How We
Addressed Them
Developers on the Radxa Forums, Armbian
Forums, and GitHub (Cubie A7A / A7Z / A7S,
Orange Pi 4 Pro, Frigate NVR, and YOLOv8/YOLO11 projects) repeatedly run
into the same set of A733 NPU roadblocks. Below is each real-world
issue, its silicon root cause, and how our mainline etnaviv
+ Mesa Teflon stack resolves it:
Common Allwinner A733 NPU Issues &
How Mainline etnaviv + Teflon Solves Them
๐ Related Guides &
Source Repositories
Mainline Linux Kernel Tree: linux-cubie on
GitHub (branch a7a_remoteproc_camera_usb)
Big progress on mainline Linux 7.1 (PREEMPT_RT) for the
Radxa Cubie A7A (Allwinner A733): we now have a working,
zero-copy camera-to-encoder pipeline running on mainline drivers without any
vendor 5.10 BSP blobs.
Highlights:
Hardware H.264 & H.265 (HEVC) encoding via Cedrus VE at 1080p30 using
~0.89%–1.55% of one CPU core, hardware ISP 602
(sun60i-isp) with AE/AWB/CCM/Gamma/BLC, and a dedicated
rkisp1-style libcamera pipeline handler & IPA.
1. Zero-Copy Camera → Hardware Video Encoder (H.264 & H.265)
Using the mainline sun6i-mipi-csi2 → sun6i-csi
capture path with an OV5647 sensor (1080p30, NV12), CMA dma-bufs
are passed zero-copy directly into the Allwinner A733 Cedrus Video Engine
V4L2 stateful M2M encoder:
UAPI & Hardware Blocks: Versioned parameter buffer (sun60i_isp_params_cfg) supporting Black Level Correction (BLC), White Balance (WB), Color Correction Matrix (CCM), Gamma, plus AE/AWB/Histogram statistics readout.
Dedicated libcamera Pipeline Handler & IPA: Built an rkisp1-style sun60i-isp pipeline handler and IPA module (ipa_sun60i_isp.so + sun60i_isp_ipa_proxy) rather than hacking SoftISP into simple — giving a clean, upstreamable userspace counterpart for a future linux-media RFC.
3. What's Next
Finish silicon verification of the sun60i-isplibcamera AE/AWB closed loop on 1080p30 captures.
Prepare an upstream RFC for sun60i-isp with the open libcamera pipeline handler as userspace proof.
Continue A7A bring-up: cpufreq OPP tables, stress_rpmsg on the E902 RISC-V co-processor, and GMAC210 TX DMA fix.