r/ProgrammingLanguages • • Mar 08 '26

Introducing Eyot - A programming language where the GPU is just another thread

https://www.cowleyforniastudios.com/2026/03/08/announcing-eyot/
95 Upvotes

48 comments sorted by

View all comments

Show parent comment

2

u/akomomssim Mar 09 '26

I don't have an example in the playground, but that is totally possible right now. If you want to capture global state in a worker you can partially apply a function and use that when creating a worker.

If you had an inference_function that takes the job as a first parameter, and the weights as a second parameter, you could write:

let infer = partial inference_function(_, some_weights)
let worker = gpu infer

while true {
   let job = get_work
   send(worker, job)
   print_result(drain worker)
}

The infer function captures the weights. let worker = gpu infer would transfer that state to the GPU, where it stays, so each inference would just transfer the job specific data.

That GPU memory would be freed when worker is garbage collected.

The partial keyword is honestly a little odd, so a longstanding TODO for me is to implement proper lambdas instead (and improve the playground so I can share examples more easily!)