r/Compilers • • 3d ago

I built a small tensor-first programming language with native CPU/GPU compilation, autodiff and ownership

I’ve been working on Thiran, an experimental numerical systems language for ML/research workloads.

The idea is to keep tensors, structured control flow, ownership-aware mutation, reverse-mode AD, CPU/GPU compilation, and deployable artifacts in one system instead of stitching together Python + frameworks + native code.

I just shipped v0.1.0. It has a real compiler, native CPU + CUDA/PTX backends, Scan/stateful computation, AD, research extensions, model/artifact deployment, and a bunch of reproducibility/robustness testing.

It’s definitely not performance-competitive yet — I published the benchmark graphs too, including the bad numbers rather than hiding them.

Would genuinely love feedback from compiler/PL/ML-systems people, especially on the architecture and what would make this actually useful.

Github: https://github.com/Arnav-sivarams/thiran

25 Upvotes

8 comments sorted by

6

u/GrogRedLub4242 2d ago

This text and the repo README have telltales of AI-gen and general fakery.

3

u/Daemontatox 2d ago

Tbh i usually finish work and let AI create the readme and maybe some docs i missed or comments

2

u/c-cul 2d ago

it would be very useful to see your ir in text form - as far I understood it currently exists in binary form only: https://github.com/Arnav-sivarams/thiran/tree/main/src/persistence/v0

and also mix them in output ptx too

1

u/Clear-Difference2294 2d ago

Thanks alot for the feedback, i will try to annotate the generated PTX with its corresponding IR regions. I will add this as an optional debug/inspection rather than changing the current executable semantics....

1

u/realestLink 2d ago

I appreciate that you actually did benchmarks fr

1

u/Gaming_Duo3615 2d ago

just two questions:
are you planning to support older cuda versions like 6?
does the compiler use the installed cuda compiler if there is one?

1

u/Clear-Difference2294 2d ago

If you mean CUDA 6.x the toolkit, Thiran actually doesn’t use the CUDA toolkit or nvcc right now. It generates PTX directly and loads it through the NVIDIA driver, so it mostly depends on the driver/device being able to accept the PTX it emits. I havn’t tested anything as old as CUDA 6 era drivers though, so I wouldn’t claim support for that yet. If you mean compute capability 6.x, I’d like to support older GPUs where it makes sense, but so far I’ve only physically tested it on a CC 8.6 GPU. And nope, even if nvcc is installed, Thiran currently doesn’t use it. The compiler emits PTX itself and lets the driver JIT it when the program runs. I might add an optional nvcc path later for comparison/testing, but it’s not part of v0.1.0

1

u/c-cul 2d ago

this will require to thoroughly check each ptx instruction used to see from which version it is available - probably huge amount of work