30276

Compile-Time Resource Safety for GPU APIs: A Low-Overhead Typestate Framework

Tihomir Thomas Bicanic
University of Trier, Trier, Rheinland-Pfalz, Germany
University of Trier, 2025

@inproceedings{bicanic2025compile,

   title={Compile-Time Resource Safety for GPU APIs: A Low-Overhead Typestate Framework},

   author={Bicanic, Tihomir Thomas},

   booktitle={Tagungsband des FG-BS Herbsttreffens 2025},

   pages={10–18420},

   year={2025},

   organization={Gesellschaft f{"u}r Informatik eV}

}

GPU APIs such as OpenCL require correct host-side sequencing of buffer and queue operations; errors in state transitions and synchronization typically only become visible at runtime in C bindings. We present TypeSec, a lightweight Rust typestate framework that encodes buffer and event protocols in the type system and thereby excludes invalid states already at compile time. The design combines phantom types and linear event tokens with zero-cost abstractions. In micro- and macro-benchmarks (Copy/Read/Write as well as complete Write->Kernel->Read workflow) on an RTX 3090 we show practically no runtime overhead (median within 2%, worst case < 4% compared to raw OpenCL). Binary size and assembly analyses demonstrate that hot paths compile identically to direct API calls. A suite of trybuild tests provides machine-readable compile-fail evidence for central error classes (sequence, mapping, in-flight, event, ABI).
No votes yet.
Please wait...

You must be logged in to post a comment.

* * *

* * *

HGPU group © 2010-2025 hgpu.org

All rights belong to the respective authors

Contact us: