Tensor Edge TPU & Mali-G78 GPU
Google Tensor GS101 packs two major compute accelerators: the Abrolhos Edge TPU (NPU) for ultra-low-power INT8 neural inference (~0.31 W), and an ARM Mali-G78 MP20 GPU with full OpenCL 3.0 support (20 compute units @ 848 MHz, 11.5 GiB shared memory).
Google Tensor Edge TPU (tpu-ctl)
Section titled “Google Tensor Edge TPU (tpu-ctl)”tpu-ctl compiles standard INT8 .tflite models directly on the phone into Abrolhos .dgc executables (chip_type=5) and runs inference over /dev/abrolhos with zero Android Binder or servicemanager.
- Verified live (
raven): MobileDet COCO 320×320 compiles in ~0.71–0.8 s and runs at 1.24 ms pure TPU / 3.3 ms persistent pipe (~300 FPS at 0.31 W on the TPU power rail).
Quick Start: Object Detection on the Edge TPU
Section titled “Quick Start: Object Detection on the Edge TPU”-
Check Edge TPU status & firmware counters (unprivileged)
Terminal window tpu-ctl statusReports
/dev/abrolhospresence, runtime readiness, firmware type/version, and hardware sysfs counters (inference_count,tpu_active_cycle_count,firmware_crash_count). -
Strip CPU post-processing from Coral / Frigate SSD models (unprivileged)
Most Coral/Frigate SSD
.tflitemodels append a CPU-onlyTFLite_Detection_PostProcesscustom op plusDEQUANTIZElayers.strip-ssdpatches the FlatBuffer in pure Python, extracts quantized anchors into a sidecar JSON file, and leaves a pure INT8 subgraph ready for the TPU compiler:Terminal window tpu-ctl strip-ssd \ssdlite_mobiledet_coco_qat_postprocess.tflite \mobiledet_tpu.tflite \--meta mobiledet_tpu.json -
Compile once to an Abrolhos
.dgcexecutableTerminal window sudo tpu-ctl compile mobiledet_tpu.tflite mobiledet_tpu.dgc -
Run single-image detection or persistent worker mode
Terminal window # Single-shot SSD object detection + NMS on a JPEG/PNG (uses ffmpeg) or raw .rgbsudo tpu-ctl detect-ssd mobiledet_tpu.dgc \--meta mobiledet_tpu.json \--input photo.jpg \--labels coco_labels.txt \--threshold 0.4# Benchmark raw inference speed (10 warmup + 200 timed iterations)sudo tpu-ctl infer mobiledet_tpu.dgc --warmup 10 --iters 200 --power-state 7
Persistent Streaming Worker (serve)
Section titled “Persistent Streaming Worker (serve)”For high-throughput daemons like Frigate NVR, serve keeps the .dgc loaded in TPU memory and speaks a dead-simple binary stdin/stdout framing protocol (~3.3 ms/frame):
sudo tpu-ctl serve mobiledet_tpu.dgc --power-state 6- Writes one newline-terminated JSON readiness line to stdout containing
status,power_state,dgc_bytes,compile_ms,inputs, andoutputs(exact byte sizes and shapes). - Loops reading exact concatenated input tensor bytes from stdin and writing exact concatenated output tensor bytes to stdout until clean EOF.
tpu-ctl Flag Reference
Section titled “tpu-ctl Flag Reference”Top-level options (must precede subcommand): --runtime-dir <PATH> (default /run/headless-tpu), --lib-dir <PATH> (default /usr/local/lib/headless-tpu), -v/--verbose.
| Subcommand | Arguments & Defaults | Root? |
|---|---|---|
setup |
--force |
Yes |
teardown |
(removes ephemeral /run/headless-tpu runtime & cache) |
Yes |
status |
(always emits JSON) | No |
strip-ssd |
<input_model> <output_model> [--meta <PATH>] |
No |
compile |
<input_model> <output_dgc> [--token headless_model] [--chip-type 5] |
Yes |
infer |
<model> [--input <PATH>] [--output-prefix <PATH>] [--power-state 6] [--iters 1] [--warmup 0] [--chip-type 5] |
Yes |
serve |
<model> [--power-state 6] [--chip-type 5] |
Yes |
detect-ssd |
<model> --meta <PATH> --input <PATH> [--labels <PATH>] [--threshold 0.4] [--iou 0.5] [--max-detections 20] [--power-state 6] [--chip-type 5] |
Yes |
(Note: --power-state accepts 0..7; higher values request higher DarwiNN DVFS clock states, with 6 balancing throughput and power and 7 delivering peak burst speed.)
Mali-G78 MP20 OpenCL 3.0 GPU (gpu-ctl)
Section titled “Mali-G78 MP20 OpenCL 3.0 GPU (gpu-ctl)”gpu-ctl exposes the phone’s ARM Mali-G78 MP20 (/dev/mali0) over stock /vendor/lib64/libOpenCL.so using the shared /run/headless-bionic runtime.
- Verified live (
raven): OpenCL 3.0, 20 Compute Units @ 848 MHz, 11.5 GiB global memory, 549.7 GFLOPS FP32 FMA compute, 21.5 GB/s verified SAXPY memory bandwidth.
Query, Benchmark & Run Custom OpenCL Kernels
Section titled “Query, Benchmark & Run Custom OpenCL Kernels”# Check driver/worker/DVFS readiness (unprivileged)gpu-ctl status
# Query OpenCL 3.0 device capabilities + live Mali DVFS telemetrysudo gpu-ctl infosudo gpu-ctl --json info
# Run verified SAXPY memory bandwidth + FP32 FMA GFLOPS benchmarksudo gpu-ctl bench --elements 1048576 --iters 20Running Your Own .cl Compute Kernel
Section titled “Running Your Own .cl Compute Kernel”Write any OpenCL C kernel matching the signature __kernel void <name>(__global const float *in, __global float *out):
__kernel void scale(__global const float *in, __global float *out) { int i = get_global_id(0); out[i] = in[i] * 2.5f + 1.0f;}Execute it directly on Mali-G78 (--input defaults to in[i] = (float)i when omitted):
sudo gpu-ctl run scale.cl --kernel scale --size 65536 --output result.bingpu-ctl Flag Reference
Section titled “gpu-ctl Flag Reference”Top-level options (must precede subcommand): --runtime-dir /run/headless-bionic, --lib-dir /usr/local/lib/headless-gpu, --json.
| Subcommand | Arguments & Defaults | Notes |
|---|---|---|
setup |
--force |
Extracts /run/headless-bionic (root). |
teardown |
(none) | Removes /run/headless-bionic (root). |
status |
(none) | Unprivileged; checks /dev/mali0, OpenCL libs, worker, and Mali DVFS sysfs. |
info |
(none) | OpenCL 3.0 platform/device specs + sysfs frequency/utilization. |
bench |
--elements 1048576 (1..67108864), --iters 20 (1..10000) |
Exits 0 iff saxpy_verify_errors == 0. |
run |
<kernel_file> --kernel <NAME> [--size 1024] [--input <PATH>] [--output <PATH>] |
--size up to 67108864 float32 elements. |