Unfortunately I’m not aware of any remotely accessible and self-contained example in the wild for this, but here are some possible leads. Does overdubbing in generated function inserts inlined code - #7 by Tomas_Pevny has a self-contained snippet, but didn’t seem to work? Cassette’s docs shows how to create a valid CodeInfo output using its API but doesn’t go into details. The underlying code may thus be worth a read. Lastly, the genfuncs in Zygote’s compiler show most of the steps required for ingesting a CodeInfo for a function argument and manipulating it to be compatible with the generated function signature, but you’ll have to read through some IRTools methods to know exactly what it’s doing under the hood and a lot of the AD-related stuff may be a distraction.
1 Like