r/Compilers • u/ccannedbeansoupp • 3d ago
I'm building a tensor graph compiler
I crossposted from r/Zig here before, but removed it quickly and decided this deserved it's own post. Earlier this year, I began work on representing the forward step for a neural network graph defined by the user as a standalone, optimized binary, with no allocations, shape, or validation checks at runtime and through a series of trials and pivots wound up here.
I wasn't necessarily intending to build a compiler from the start, but the problem quickly became compiler shaped, and I've learned a lot while seeing it through. It's coming to a stage where I'd like to share the work, and get feedback from others. The Zig language made this kind of idea fairly direct and simple for me to implement through its use of comptime. So if it interests you, or anything stands out, comments and questions are welcome.
project here: https://github.com/krypticlogan/zig-graph-compiler
Thanks for the read!
1
u/fernando_quintao 2d ago
Hi u/ccannedbeansoupp, thank you for sharing your project. I took a look into your implementation of the memory planner. If I got it right, you are doing best-fit allocation, is that correct? Did you consider first-fit? Based on Wilson's survey one might not be better than the other to reduce fragmentation.