XSci

Codelets: One Source for Device-Side Asynchronous Execution and Synchronous Fallback

Jiangning Liu, Hao Liu

Submitted by Jiangning Liu

Published November 26, 2026 · Version v1, November 26, 2026 · DOI 10.66977/xsci.2611.004w

Programming Languages

Declaration of AI use (v1): AI was used for analysis of the paper quality, including grammar, logic, wording, and layout etc.

Abstract

CUDA-like languages make data-parallel kernels convenient, but their conventional asynchronous interface is host-driven: host code launches kernels and enqueues memory operations into streams, records events, and synchronizes at an appropriate boundary. When a device-resident controller discovers fine-grained work dynamically, conventional device-side control code is commonly synchronous; applications that need an asynchronous task model on the device typically introduce a custom task runtime and manage task descriptors and argument storage explicitly.

This paper presents codelets, an extension to a CUDA-like heterogeneous C/C++ model that introduces an asynchronous codelet function kind. A designated device-resident controller thread executing ordinary device control code dispatches codelets with explicit dependence handlers, constructing a device-resident dependency graph, and later joins it through ac_start, which completes the graph work required by its selected handler and reconnects codelet execution to the controller's synchronous control flow. Compiler-generated stubs marshal arguments from a synchronous activation record into a runtime-managed invocation context and reconstruct them at the codelet entry. The same source can also execute synchronously, subject to data-race and side-effect restrictions. We present the programming model, its argument transfer and control-flow correctness discipline, its extension to multiple controllers, and the implementation support needed to realize it.

View PDF