edvardo1

edvardo1

Hello, I’ve found an interesting non-backwards-compatible change in Elixir 1.20.

For context: There exists a project called PolyHok, which is a DSL that is embedded in Elixir, its aim is to make GPU programming easier in Elixir, I am one of the people participating in the development of this DSL.

The main way you’re supposed to use it is by using the PolyHok.defmodule macro, which basically overloads the defmodule construct, it processes the defk (define kernel) and defd (define device function) expressions, takes them out of the module body, then process that module normally. Now, I know that that’s not the most orthodox way to do it, as Nx doesn’t do it like that, but it worked in previous versions. Here’s an example:

require PolyHok

PolyHok.defmodule Wow do
  defk myk(a) do
    a[1] = 9.2
  end

  def f() do
    2
  end
end

In Elixir 1.19.6, it functions normally and you can use the defk definition for whatever you wanna use it for, but for Elixir 1.20 and later, it spits out this error:

    error: undefined function defk/2 (there is no such import)
    │
  4 │   defk myk(a) do
    │   ^
    │
    └─ elixir/examples.exs:4:3: Wow (module)

** (CompileError) elixir/examples.exs: cannot compile module Wow (errors have been logged)

Does anyone why this happens, why the behavior was changed, and if there is an easy way to fix this?

Links for the curious:
PolyHok website: PolyHok: GPGPU in Elixir []
PolyHok repository: GitHub - lups-ufpel/poly_hok: PolyHok DSL repository. · GitHub

Where Next? Top

Trending in Troubleshooting Top

edvardo1
Hello, I’ve found an interesting non-backwards-compatible change in Elixir 1.20. For context: There exists a project called PolyHok, whi...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews