CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules
cs.PL, cs.CL, cs.GR
Submitted: 2025-08-28
Updated: 2026-10-18
Comments: 57 pages (30 main text). Replication package in the ancillary files
License: http://creativecommons.org/licenses/by/4.0/
The gist: GPU programs are written in vendor languages that disagree about integer overflow, division by zero, NaN handling, floating-point contraction, data layout and dispatch, so a translated program can
Terminology
Abstract
GPU programs are written in vendor languages that disagree about integer overflow, division by zero, NaN handling, floating-point contraction, data layout and dispatch, so a translated program can compile and still compute something else. We describe CrossTL, an open-source translator that routes ten GPU source languages to eleven targets through CrossGL, a textual hub language, with repository-scale porting, contracts that loaders check, and native parity tests. We define faithful translation as refinement up to rejection under a compile configuration, and test whether a hub that records each source rule and lowers it through one per-target table keeps rules that a syntax-only hub loses. On an internally pre-registered suite of 66 hazard kernels in six languages, run on an Apple GPU through Metal, MoltenVK and WebGPU and on CPU implementations of Vulkan, OpenGL and an emulated Direct3D 12, SPIRV-Cross, naga, Tint, Slang and CrossTL each lose some source rule, and outcomes change with Metal's math mode and between two Vulkan implementations. A rule-carrying prototype of the hub removes 34 of 39 divergences on the rules it carries, against 14 for local fixes to four SPIR-V defects, and refuses where WGSL cannot express a rule. The registered hypothesis that it keeps every rule fails: MoltenVK, a non-conformant Vulkan layer, drops a rule that correct SPIR-V carries natively. On 2,585 programs written by third parties, 31% of CrossTL's translations are usable, established translators produce valid output significantly more often in 31 of 39 comparisons, and carrying the rules changes no target's accepted share by more than 0.2 points. Recording each operation's source rule suffices for the rules tested but is not necessary: one strongest rule would keep them too, at about nine times as many rewrites and 58 more refusals on the corpus.
Related papers
- Language-Based Agent Control
- ANEForge: Python for direct computation on the Apple Neural Engine
- Volition Elicitation: Operational Semantics for People and Their Machines
- Griotte: Verified Compartmentalisation via Capabilities
- GraphMend: Code Transformations for Fixing Graph Breaks in PyTorch 2
- Two Birds One Stone: Effective Static Detection of Resource and Communication Deadlocks in Rust Programs