Skip to content

Sbregiuz/eter

 
 

Repository files navigation

Eter logo

The Eter Programming Language

EterA wordplay on Heterogeneous and Ether.

Why Eter?Getting the Source Code and Building EterLicense


Warning

Eter is currently in the early stages of development. The language design and implementation are subject to significant changes, and the implementation is not started yet.

While The Eter Reference serves as the primary source of language specification, including its syntax and semantics, the API Reference provides the doxygen-generated documentation for the Eter compiler's C++ API, which is intended for contributors and advanced users interested in extending or interfacing with the compiler.

//===--- ML Model as First-Class Citizen ---===//
// The @model attribute acts as a compiler-driven linker.
// It embeds 'mobilenet_v2' into the binary and optimizes the execution
// for the CPU (using SIMD like AVX-512) to handle the @host memory input.
@model<TF(version = V1), target = CPU>("mobilenet_v2")
extern fn imm mobilenet_infer(imm x: [f32; 1, 224, 224, 3] @host): [f32; 1, 1000] @host;

//===--- Optimized GPU Kernel ---===//
// A tile of 112x112 is a "perfect fit" for a 224x224 image.
// It divides the work into exactly 4 quadrants (2x2 grid),
// eliminating the need for boundary checks or padding logic.
@gpu_tile(112, 112)
fn custom_preprocess_kernel(proj data: [f32; 1, 224, 224, 3] @global) {
    // 'proj' defines a memory projection: the data exists on the Host
    // but is mapped to Global GPU VRAM for the duration of this call.
    for tile in data.tiles() {
        // Data is moved to @shared memory (SRAM), the fastest on-chip cache.
        let mut sram_tile: Tile<f32, [112, 112]> @shared = tile.load();
        // Element-wise tanh applied via high-throughput GPU vector units.
        sram_tile = tanh(sram_tile);
        // Results are committed back to the projected Global memory space.
        tile = sram_tile;
    }
}

fn main() {
    // Initialize image in System RAM (@host).
    let mut input: [f32; 1, 224, 224, 3] @host = tsor::from_image("dog.jpg");
    // The 'as _ @global' cast triggers an implicit PCIe DMA transfer.
    // The '&' ensures we are projecting a reference, not moving ownership.
    custom_preprocess_kernel(&input as _ @global);
    // The compiler detects that 'input' was modified on the GPU.
    // Before calling the CPU-based model, it automatically syncs the
    // data back to @host and ensures the GPU work is finished.
    let output = mobilenet_infer(input as _ @host);
}

Why Eter?

Modern software development increasingly relies on heterogeneous computing, yet writing performant code across diverse hardware remains a significant challenge. Existing solutions—ranging from libraries and compiler extensions to domain-specific and system programming languages—often face technical limitations or practical trade-offs. Currently, machine learning (ML) models are compiled via specialized tools like XLA, Glow, or TVM, making their integration into general-purpose languages such as Python, C++, or Rust difficult and often requiring wrappers that introduce overhead and complexity. Furthermore, achieving high performance across different architectures such as GPUs and specialized accelerators often demands a deep understanding of hardware-specific models, which compromises both efficiency and portability.

Eter is a new programming language designed to bridge these gaps. It provides a high-level, expressive syntax that compiles efficiently to a wide range of targets, including CPUs, GPUs, and specialized accelerators. Eter empowers developers to write native GPU kernels and manage distributed resources—such as device meshes and sharded tensors—directly within the language. In Eter, machine learning models are first-class citizens, making inference on a pre-trained model as seamless as a standard function call. Built on the LLVM and MLIR infrastructure, Eter leverages industry-leading optimization and code generation capabilities to deliver native performance with high-level elegance.

Getting the Source Code and Building Eter

See GETTING_STARTED.md for build instructions and a quick-start guide. For the full contributor workflow, see CONTRIBUTING.md.

License

Eter is licensed under the Apache License v2.0 with LLVM Exceptions. See the LICENSE file for more information.

About

The Eter Programming Language

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 79.8%
  • Shell 9.3%
  • CMake 6.6%
  • MLIR 1.9%
  • TeX 1.2%
  • Makefile 0.6%
  • Other 0.6%