CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.
Tom: Hi, I'm Tom.
Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.
Tom: We're looking at the paper: "CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules".
Jane: Here's the gist of the paper. The gist The CrossTL system presents a universal programming language translator that enables bidirectional translation between multiple high-level programming languages through a unified intermediate representation called CrossGL.
Tom: Architecture and Components The system consists of three main components: "language-specific lexers and parsers that convert source code to abstract syntax trees (ASTs), bidirectional CrossGL translation modules that implement both ToCrossGLConverter classes for importing existing code and dedicated CodeGen classes for generating target code from CrossGL, and comprehensive backend implementations that handle the full translation pipeline for each supported platform".
Jane: The overall architecture is guided by design principles including "Modularity: Each language frontend and backend is implemented as an independent module, enabling parallel development and easy maintenance".
Tom: The system employs a "three-stage translation pipeline consisting of languagespecific frontends, a universal intermediate representation, and target-specific backends".
Title and authors: Tom: So, let's talk about the title and who wrote this paper, "CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules". It points out that they are focusing specifically on GPU programs right now.
Jane: They are also emphasizing that the key is preserving those original rules from the source code while translating it to another language. That means when you translate, you don't accidentally change how the program actually behaves at a fundamental level.
Lu: That preservation aspect is really important because if you just convert syntax, things break in complex GPU tasks or simulations.
Meng: I mean, if you're running production code and it suddenly starts doing something weird on a new platform because of a translation hiccup, that's a nightmare for deployment.
Lalam: The paper is really about creating this hub—this central representation—that acts as the translator between all those different GPU languages.
The paper's summary: Tom: So, looking at the summary of "CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules", they lay out their entire system structure pretty clearly. It uses this three-stage pipeline.
Jane: It starts with language-specific frontends that turn your source code into something common, then it goes through that universal intermediate representation, CrossGL, and finally a target-specific backend generates the actual machine code you need.
Lu: The summary highlights that CrossGL has a unified type system and includes things like expression trees and control flow graphs, which captures the essential semantics of different programming paradigms.
Meng: It’s not just about syntax; it’s about capturing the meaning of what you're trying to do with your GPU kernels or shaders.
Lalam: They explicitly mention that this approach aims to reduce the translation problem from something exponential, which they say is O(n2), down to linear complexity, O(n).
The paper's improvements: Tom: Now, the authors point out what they actually improved over previous methods. They are showing how their hub-based approach handles the translation problem more efficiently.
Jane: They argue that existing solutions either sacrifice performance for abstraction or they become unmanageable when you add more languages because you end up with those O(n2) translators we talked about before.
Lu: The main improvement is definitely the introduction of CrossGL, which acts as this single intermediate language that captures the essential semantics across all these different programming languages.
Meng: So, if I'm looking at deployment, this means you don't have to maintain a separate CUDA translator and a separate Vulkan translator; it’s one system handling the conversion.
Lalam: And they suggest that because of this universal IR, you get target-agnostic optimizations. You can analyze the program across all target language semantics at once to find better ways to run it.
Conclusion: Tom: So, wrapping up this discussion on "CrossTL: Hub-Based Translation of GPU Programs and the Preservation of Source Rules", the paper shows that a unified intermediate representation can make cross-language translation practical for many languages.
Jane: It sets up a foundation where developers can write code once and deploy it across multiple GPU platforms, which is really helpful for complex graphics or compute tasks.
Lu: The implication is that adding new languages to this system becomes much simpler because you only need to implement the language-specific parts and map them into CrossGL.
Meng: From a deployment standpoint, this means less maintenance overhead across the board when you are targeting different GPU architectures.
Lalam: And they confirm that they have achieved linear complexity scaling, which means it can handle more languages efficiently than the previous exponential growth we saw.
Nripesh Niketan, Vaatsalya Shrivastva
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/
Importance score: 82/100
The gist: The gist The CrossTL system presents a universal programming language translator that enables bidirectional translation between multiple high-level programming languages through a unified
Key concepts
- CrossGL
- This is a universal intermediate representation that captures the core meaning of all supported programming languages without focusing on their specific syntax. It includes features like a unified type system for arithmetic and logical operations, statements for control flow, and data structures, acting as a common language bridge.
- Three-Stage Translation Pipeline
- The translation process is structured in three distinct stages: first, language-specific frontends convert the source code into an abstract syntax tree (AST); second, this AST is translated into the universal CrossGL representation; and finally, target-specific backends generate the final executable code for a specific platform.
- Bidirectional Translation Modules
- The system uses dedicated modules for both importing existing code (ToCrossGLConverter) and generating new target code from the intermediate representation (CodeGen). These modules are implemented separately for each language pair and platform, ensuring that translation flows correctly in both directions.
Terminology
Summary
The gist The CrossTL system presents a universal programming language translator that enables bidirectional translation between multiple high-level programming languages through a unified intermediate representation called CrossGL.
Architecture and Components
The system consists of three main components: "language-specific lexers and parsers that convert source code to abstract syntax trees (ASTs), bidirectional CrossGL translation modules that implement both ToCrossGLConverter classes for importing existing code and dedicated CodeGen classes for generating target code from CrossGL, and comprehensive backend implementations that handle the full translation pipeline for each supported platform. The overall architecture is guided by design principles including
Modularity: Each language frontend and backend is implemented as an independent module, enabling parallel development and easy maintenance. The system employs a
three-stage translation pipeline consisting of languagespecific frontends, a universal intermediate representation, and target-specific backends".
Universal Intermediate Representation (CrossGL)
CrossGL serves as the universal intermediate representation that captures the essential semantics of all supported languages while abstracting away syntactic differences
. This representation features a Unified Type System
and includes constructs such as Expressions: Arithmetic, logical, and comparison operations with explicit type information,
Statements: Variable declarations, assignments, control flow (if/else, loops, switch),
and Data Structures: Struct definitions and member access
. Furthermore, CrossGL includes an Attribute System that preserves language-specific information needed for target code generation
.
Translation Pipeline
The translation process follows a structured pipeline where the frontend stage is responsible for parsing source code into a common AST representation. The backend stage then generates target-specific code from the CrossGL intermediate representation
. Each backend follows a consistent architecture with specialized components for bidirectional translation, such as the CUDA Backend: CudaLexer/CudaParser for parsing, CudaCrossGLCodeGen for import, and CudaCodeGen for export
. The code generators use a template-based approach with context-sensitive transformations,
including Template Matching
and Context Analysis
to select appropriate translations.
Evaluation and Scalability
The evaluation demonstrates the practical viability of universal code translation across diverse domains, achieving a 100% Success Rate: All test programs compile and execute correctly across all 8 fully supported languages
. The system achieves O(n) Scaling: Linear complexity enables practical universal language support
. This linear scaling is contrasted with traditional approaches which suffer from O(n2) translators for n languages in the worst case
. The evaluation covers various programming domains, including Basic Graphics,
Advanced Graphics,
and GPU Computing,
with test programs ranging from simple shaders to complex PBR renderers.
Extensibility
The modular architecture is designed for extensibility, allowing the system to accommodate emerging languages by requiring only the implementation of languagespecific frontend and backend components
. The evaluation confirms that adding a new language involves implementing Lexer, Parser, Code Generator
and mapping to the universal IR. This modular design significantly streamlines the process of adding new languages compared to implementing separate translators for each language pair
.
Conclusion
CrossTL represents a significant step toward language-agnostic programming, enabling developers to write code once and deploy across multiple platforms and programming environments. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates that CrossTL generates functionally correct code that preserves the intended semantics across all supported target languages. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains. The system successfully handles complex programming constructs and generates code that compiles and executes correctly across all supported platforms. This work shows that CrossTL enables any source language to generate any target language through the unified CrossGL intermediate representation, ensuring semantic preservation and enabling cross-language optimization opportunities. The universal approach establishes a foundation for sophisticated cross-language development workflows and optimization strategies. This work demonstrates the practical viability of universal code translation across diverse programming domains.
Improvements for AI systems
-
Universal Code Generation for Heterogeneous AI Models: The system can write a single high-level program that is automatically translated into optimized code for CUDA, HIP, Metal, DirectX HLSL, OpenGL GLSL, Vulkan SPIR-V, Rust, and Mojo backends.
-
Automated Cross-Platform Deployment: Developers can write one algorithm once and deploy it across NVIDIA GPUs (CUDA), AMD GPUs (HIP), Apple devices (Metal), Windows platforms (DirectX/OpenGL), and systems languages (Rust/Mojo).
-
Scalable Language Integration: Adding a new programming language to the system requires only implementing
languagespecific lexers and parsers
anddedicated CodeGen classes,
enabling the system to support emerging AI or HPC languages with minimal effort. -
Semantic Preservation in Complex AI Tasks: The CrossGL intermediate representation ensures that the translation process preserves the
semantic meaning of programs while adapting to syntactic differences between languages,
which is critical for maintaining correctness in complex simulations and graphics shaders. -
Cross-Language Optimization Opportunities: The universal IR enables
target-agnostic optimizations
and allows for developingsophisticated cross-language optimization strategies
by analyzing the program across all target language semantics simultaneously.
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