Two new Elixir-related papers at the 28th Brazilian Symposium on Programming Languages

I attended the Brazilian Symposium on Programming Languages, where two papers related to Elixir were presented. One of them, the one about Hok, won the Best Paper award. Congrats to the authors!

Below are the titles, authors, abstracts, keywords and links to the full texts of the articles (the first one is a long paper and the second one is a short paper). The best part: unlike many events, the PDFs are open! You can view, download, or send them to your Kindle. Enjoy!

Hok: Higher-Order GPU kernels in Elixir

link to PDF

Authors: André Rauber Du Bois, Tiago Perlin, Frederico Peixoto Antunes, Gerson Cavalheiro

GPUs (Graphics Processing Units) are usually programmed using low-level languages like CUDA or OpenCL. Although these languages allow the implementation of very optimized software, they are difficult to program due to their low-level nature, where programmers have to mix coordination code, i.e., how tasks are created and distributed, with the actual computation code. In this paper we present Hok, an extension to the Elixir functional language that allows the implementation of higher-order GPU kernels, granting programmers the ability to clearly separate coordination from computation. The Hok system provides a DSL (Domain-Specific Language) for writing low-level GPU kernels that can be parameterized with the computation code. Hok allows device functions, including anonymous functions, to be created and referenced in the host code so that they can configure a kernel before it is launched.We demonstrate that Hok can be used to implement high-level abstractions such as algorithmic skeletons and array comprehensions. We also present experiments that demonstrate the usability of the current implementation of Hok, and show that high speedups can be obtained in comparison to pure Elixir, specially in computationally intensive programs with large inputs.

Keywords: parallel programming, gpu, actors model, Elixir

Towards Random Elixir Code Generation

Link to PDF

Authors: Bernardo Beltrame Facchi, Andrei de Almeida Sampaio Braga, André Rauber Du Bois, Samuel da Silva Feitosa

Developers expect compilers to be correct. Unfortunately, these tools are not entirely bug-free. A failure introduced by the compiler could compromise a critical system and consequently have catastrophic consequences, specially in applications of great complexity, affecting both end users and developers. Such failures can lead to significant financial losses, security vulnerabilities, and a loss of trust in the software’s reliability. Therefore, testing and validating all the compiler functionalities to assure its correctness is essential given their importance in software development. In light of the given context, this paper describes a random code generation tool using Haskell that generates well-typed Elixir code by adhering to a specified syntax and typing rules, which serves as input for property-based tests, striving to contribute to the overall quality and dependability of software systems built using Elixir.

Keywords: Code generation, Elixir Compiler, Property-based Testing

18 Likes

These were both very interesting. Thanks for sharing.

I thought I’d share 10 things from my notes on what I think was most salient from the first one, ‘Hok: Higher-Order GPU kernels in Elixir’.


Q1: What is Hok?
A1: Hok is an extension of Elixir designed for GPU programming, simplifying the use of GPUs for high-performance tasks like machine learning.


Q2: Why is Hok useful for Elixir developers?
A2: Hok allows Elixir developers to leverage GPUs without needing to learn low-level languages like CUDA, while maintaining Elixir’s concurrency and distribution features.


Q3: What is a G-Matrix?
A3: G-Matrix is a matrix stored in GPU memory, used in Hok for parallel computations, and managed with automatic garbage collection via the BEAM VM.


Q4: How does Hok simplify GPU programming?
A4: Hok introduces higher-order kernels and algorithmic skeletons, enabling reusable GPU code and easier development of parallelized programs.


Q5: What is G-Potion?
A5: G-Potion is Hok’s domain-specific language for writing GPU kernels, extending Elixir with CUDA features and supporting in-place updates.


Q6: Can Hok be used for machine learning?
A6: Yes, Hok can implement neural networks and other matrix-heavy computations, with ongoing improvements for broader data type support.


Q7: How does Hok manage memory on the GPU?
A7: Hok automatically frees GPU memory when G-Matrices are no longer needed, using the BEAM VM’s garbage collection.


Q8: What are higher-order kernels in Hok?
A8: Higher-order kernels allow passing functions as arguments to GPU kernels, enabling dynamic configurations and flexible code reuse.


Q9: How does Hok compare to traditional GPU programming?
A9: Hok offers a higher-level abstraction, reducing complexity and eliminating the need to manage low-level GPU details like memory and synchronization.


Q10: What are the current limitations of Hok?
A10: Hok currently supports only floats for G-Matrix operations, with work underway to expand its capabilities through the NX library.

5 Likes