Skip to content
olekkutPublic

About

Turn Google Pixel phones into high-performance Edge AI accelerators via Linux kernel driver & USB 3.2

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

TANDrv

High-Performance Host Driver and Zero-Copy DMA Accelerator for Google Tensor NPUs

GitHub Stars Version DKMS Linux Kernel Performance Benchmark Rust 2024 License


curl -fsSL https://raw.githubusercontent.com/olekkut/tandrv/main/install.sh | bash

Quickstart • Benchmarks • Terminal Vision • Plugins • Architecture


Overview & Technical Motivation

Google Pixel devices (Pixel 6 through Pixel 11 Pro) contain custom Google Tensor TPUs (NPUs) capable of 15 to 50+ TOPS of INT8/FP16 matrix compute paired with 8 to 24 GB of unified LPDDR5X memory.

Legacy USB edge accelerators (such as the Google Coral Edge TPU) are limited to 4 TOPS, draw 2W of power, and fail to execute modern neural network operators (such as Atrous Spatial Pyramid Pooling and dynamic attention layers).

TANDrv (Tensor ADB NPU Driver) bridges host operating systems (Linux / Windows) directly to connected Google Tensor hardware. Via a host DKMS kernel module (/dev/tandrv0), zero-copy USB 3.2 AOA bulk transport, and an optimized Android LiteRT execution engine, TANDrv provisions connected Pixel phones as native hardware accelerators for computer vision, object detection, and generative language models.


Quickstart

1. Automated Installation

Run the bootstrap installer on your host system:

curl -fsSL https://raw.githubusercontent.com/olekkut/tandrv/main/install.sh | bash

Or via local clone:

git clone https://github.com/olekkut/tandrv.git && cd tandrv && bash install.sh

2. Device Onboarding

Connect your Google Pixel via USB (with USB Debugging enabled) and run:

tandrv onboard

tandrv configures udev rules, verifies the USB 3.2 SuperSpeed link, deploys the headless NPU service, and verifies /dev/tandrv0.

3. Launch Real-Time Terminal Vision

python examples/tandrv_vision_tui.py

Benchmarks vs. Google Coral Edge TPU

Empirical evaluation results comparing a dedicated Google Coral USB Accelerator (Edge TPU) against a tethered Google Pixel 8 Pro (Tensor G3) running TANDrv over USB 3.2:

Model Architecture Workload Type Google Coral USB (Edge TPU) TANDrv Pixel 8 Pro (Tensor G3) Evaluation Delta
MobileNet V2 (224x224 INT8) Classification Throughput 390 FPS (2.56 ms) 395 FPS (2.53 ms) Throughput Parity: Zero-copy kernel DMA matches dedicated ASIC throughput.
YOLOv8n (320x320 INT8) Real-Time Object Tracking 31.2 FPS (32.1 ms) 35.2 FPS (28.4 ms) +13% Throughput: Sustains multi-channel video tracking at 30+ FPS.
DeepLab V3 (513x513 Dense) Semantic Segmentation ❌ Failed (CPU Fallback: 350 ms) 44.5 ms (22.5 FPS) 8x Speedup: Native hardware execution of ASPP and dynamic atrous ops.
Gemma-2B / MobileLLM Autoregressive LLM Streaming ❌ Unsupported (Out of Memory) 6.15 tokens/sec (162 ms/tok) Architecture Support: Full KV-cache allocation in 12 GB unified RAM.

Terminal Vision Preview

 ┌─ TANDrv Real-Time Vision Pipeline (/dev/tandrv0 & ADB Bridge) ──────┐
 │                                                                      │
 │  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⢛⣛⣛⣛⣛⣛⣛⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⡟⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⡇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⡇⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⣷⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢁⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡙⠻⠿⠿⠿⠿⠿⠿⠟⢋⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  │
 │                                                                      │
 │  [PERSON] 89.2% confidence (bbox: [160, 80, 480, 400])              │
 │  [FRAME]  640x480 @ 24-bit RGB -> 320x320 Normalized Tensor          │
 └──────────────────────────────────────────────────────────────────────┘
 ┌─ Google Pixel 8 Pro Hardware Telemetry ──────────────────────────────┐
 │  Target: Tensor G3 TPU Core           Thermal Headroom: 55.5%        │
 │  Transport Latency: 161.0 ms          NPU Compute: 172.7 ms          │
 │  Total E2E Latency: 358.5 ms          Framerate: 2.8 FPS             │
 └──────────────────────────────────────────────────────────────────────┘

Ecosystem Plugins

TANDrv includes native integrations for homelab, edge NVR, and machine learning infrastructure:


Hardware Reliability & Safeguards

  • Battery Cycle & Overcharge Protection: Automated smart-plug integration cycles battery between 60% and 80% state-of-charge, mitigating lithium-ion degradation during 24/7 continuous operation.
  • Closed-Loop Thermal Controller: Continuously monitors PowerManager.getThermalHeadroom() and dynamically modulates request rates to maintain optimal operating temperatures.
  • Dynamic Host Fallback: Routes inference requests to host CPU/GPU when thermal throttling is detected, resuming NPU offloading once the device has cooled.

Repository Layout

tandrv/
├── core/                               # Kernel drivers and low-level transport
│   ├── dkms/                           # Linux Host Kernel Driver (/dev/tandrv0)
│   ├── android-gadget/                 # Bare-Metal Android Kernel Gadget (f_tandrv.c)
│   └── udev/                           # udev auto-mount rules
├── cli/                                # tandrv CLI utility (Rust)
│   └── src/                            # onboard, doctor, vision, bench commands
├── sdk/                                # Developer SDKs (Python, C, Rust)
├── plugins/                            # Ecosystem plugins (Frigate, Home Assistant, ONNX, Ollama)
├── mobile/                             # Android NPU daemon & C++ NDK engine
├── examples/                           # Standardized benchmark and vision demos
├── scripts/                            # Installation and documentation scripts
├── docs/                               # Architecture, benchmark, and compatibility documentation
├── install.sh                          # Universal bootstrap installer
└── README.md                           # Project documentation

Author & Maintainer

  • Aleksander Kutycki (@olekkut) — Architecture, Kernel Drivers & Core Engineering

Split Licensing Architecture

TANDrv utilizes a split licensing model to ensure Linux kernel compliance while supporting frictionless enterprise adoption:

  • Userspace (cli/, sdk/, plugins/, mobile/, examples/): Licensed under the Apache License 2.0 (Enterprise-friendly with explicit patent grant protection).
  • Kernel Space (core/dkms/, core/android-gadget/): Licensed strictly under GNU GPL v2.0 (Compliant with Linux Ring-0 symbol exports and memory management).
  • Linux UAPI Header (core/dkms/tandrv_ioctl.h): Dual-licensed under (GPL-2.0 WITH Linux-syscall-note) OR Apache-2.0.

About

Turn Google Pixel phones into high-performance Edge AI accelerators via Linux kernel driver & USB 3.2

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages