logoalt Hacker News

Ask12jtoday at 7:43 PM1 replyview on HN

Lol, a yaml file for function signatures of which to generate a giant switch statement.

The "compiler" dynamo part is also a hack that calls real compilers like gcc and Triton.

It is a big bowl of spaghetti.


Replies

akhalillitoday at 8:06 PM

the yaml thing is not a switch statement though. torchgen takes native_functions.yaml and generates the bindings, autograd nodes and dispatch entries from that one file. there are ~~3700 ops. try keeping that in sync by hand.

also dynamo never calls gcc. it just captures the graph from python bytecode. inductor is what writes triton/cpp and sends it to real compilers. they built their own compiler stack once (torchscript), it's dead now. so this time they reused what exists.

spaghetti yes. 10 years of layers. you can see every era in the repo.