Agentic AI
Open-source GPU translator CrossTL struggles to preserve source language rules across hardware targets
A new hub-based system for translating GPU code across ten source languages and eleven targets finds that preserving semantic rules during compilation remains a stubborn challenge.
GPU programming presents a persistent portability problem: different manufacturers' languages handle integer overflow, floating-point behavior, memory layout, and task dispatch in conflicting ways. A program that compiles successfully on one platform can silently compute wrong results on another, creating what researchers call "semantic divergence."
The CrossTL System#
Researchers have released CrossTL, an open-source translator that attempts to route GPU code from ten different source languages—including CUDA, Metal, and GLSL—through a single intermediate textual representation called CrossGL, ultimately targeting eleven output formats. The approach resembles a hub-and-spoke architecture: instead of building translators between every source-target pair, all languages funnel through one common layer, with per-target lowering tables that attempt to preserve the source program's computational semantics.
The team tested CrossTL and four established translators (SPIRV-Cross, Naga, Tint, and Slang) against carefully designed hazard kernels—test cases that expose divergences in how platforms handle edge cases. Tests ran on Apple GPUs via Metal and MoltenVK, WebGPU, CPU implementations of Vulkan and OpenGL, and emulated Direct3D 12. Results showed that every translator lost some source rules across these diverse targets, and behavior shifted depending on Metal's math mode and which Vulkan implementation was used.
Rule Preservation Results#
The core innovation was a rule-carrying prototype that records which source language rule applies to each operation and attempts to enforce it on the target side. This approach resolved 34 of 39 rule divergences in test kernels, compared to just 14 improvements from fixing four SPIR-V defects locally. However, the technique has limits: it refused to compile programs when the target language (notably WGSL) couldn't express the required rule.
A sobering finding emerged from the broader test suite: on 2,585 real-world GPU programs, only 31% of CrossTL translations produced usable output. Established translators achieved valid output more often in 31 of 39 test comparisons. Even more striking, tracking individual source rules changed no target platform's acceptance rate by more than 0.2 percentage points—suggesting the technique may matter less for production code than for edge-case correctness.
Why It Matters#
The research underscores why GPU code portability remains fundamentally difficult. Many rule violations stem not from translator bugs but from : MoltenVK, a Vulkan compatibility layer for Apple hardware, dropped a rule that correct SPIR-V should carry natively. This reveals that even perfect translation logic cannot guarantee correctness if the underlying runtime doesn't follow its own specification.

