# keep-xylent/mali-bench architecture

> Architecture diagram of the GitHub repository keep-xylent/mali-bench, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keep-xylent/mali-bench
- Repository: https://github.com/keep-xylent/mali-bench

## Overview

mali-bench benchmarks Android Vulkan compute drivers, either through ADB from a PC or directly in Termux. The user selects a driver package or shared library; the native engine loads a Vulkan driver and shader, dispatches compute work, and reports timing and device details. The README documents SVG and log outputs. The C engine’s Vulkan flow is visible, but the Python runner and shader implementation were not sampled, so their internal connections are not asserted beyond documented behavior.

Main entry points: [`bench.py`](https://github.com/keep-xylent/mali-bench/blob/main/bench.py) (Python Runner), [`vk_bench.c`](https://github.com/keep-xylent/mali-bench/blob/main/vk_bench.c) (Vulkan Engine), [`bench.comp`](https://github.com/keep-xylent/mali-bench/blob/main/bench.comp) (Compute Shader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Driver Workflow"]
  node_driver_input["Driver ZIP / SO"]
  node_runner["Python Runner<br/>[bench.py]"]
end

subgraph group_compute["Compute Benchmark"]
  node_shader["Compute Shader<br/>[bench.comp]"]
  node_vulkan_engine["Vulkan Engine<br/>[vk_bench.c]"]
end

subgraph group_results["Benchmark Results"]
  node_benchmark_output["SVG and Log<br/>[bench.py]"]
end

node_pc_user(("PC User"))
node_termux_user(("Termux User"))
node_android_device(("Android Device"))

node_pc_user -->|"runs on PC"| node_runner
node_termux_user -->|"runs in Termux"| node_runner
node_android_device -->|"provides drivers"| node_runner
node_driver_input -->|"selects driver"| node_runner
node_shader -->|"loads SPIR-V"| node_vulkan_engine
node_runner -.->|"runs engine"| node_vulkan_engine
node_runner -->|"writes results"| node_benchmark_output

click node_runner "https://github.com/keep-xylent/mali-bench/blob/main/bench.py"
click node_shader "https://github.com/keep-xylent/mali-bench/blob/main/bench.comp"
click node_vulkan_engine "https://github.com/keep-xylent/mali-bench/blob/main/vk_bench.c"
click node_benchmark_output "https://github.com/keep-xylent/mali-bench/blob/main/bench.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_driver_input,node_runner,node_pc_user,node_termux_user toneBlue
class node_shader,node_vulkan_engine toneAmber
class node_benchmark_output toneMint
class node_android_device toneIndigo
```

## Components

### Driver Workflow

- **Driver ZIP / SO**
- [Python Runner](https://github.com/keep-xylent/mali-bench/blob/main/bench.py): `bench.py`

### Compute Benchmark

- [Compute Shader](https://github.com/keep-xylent/mali-bench/blob/main/bench.comp): `bench.comp`
- [Vulkan Engine](https://github.com/keep-xylent/mali-bench/blob/main/vk_bench.c): `vk_bench.c`

### Benchmark Results

- [SVG and Log](https://github.com/keep-xylent/mali-bench/blob/main/bench.py): `bench.py`

### Other components

- **PC User**
- **Termux User**
- **Android Device**

## Connections

- PC User → Python Runner: runs on PC (evidence: `README.md`)
- Termux User → Python Runner: runs in Termux (evidence: `README.md`)
- Android Device → Python Runner: provides drivers (evidence: `README.md`)
- Driver ZIP / SO → Python Runner: selects driver (evidence: `README.md`)
- Compute Shader → Vulkan Engine: loads SPIR-V (evidence: `vk_bench.c`)
- Python Runner → Vulkan Engine: runs engine
- Python Runner → SVG and Log: writes results (evidence: `README.md`)
