Is there @code_warntype output documentation anywhere?

Where can I find more information on understanding the output of @code_warntype mentioned in Turing Performance Tips?

I’m trying to use it to debug some ForwardDiff Dual Type errors mentioned often (e.g. one recent example) but the output is difficult to decipher.

I found this but it wasn’t very comprehensive.

There is some documentation here: Performance Tips · The Julia Language

1 Like

Welcome @zenkavi! The Turing @model macro rewrites your model code (i.e., the tilde ~ statements etc.) into straight Julia code, which requires generating/mangling variable names in the process. Hence, using @code_warntype on a Turing model is harder to read than normal, an issue I run into myself pretty frequently. My only useful advice is to read through the output carefully, starting with the block at the top (where all the variables are listed with their original names). Often I can figure out which ones are causing issues from that section, then go back to reread my own code to try and figure out where any type instabilities came from.

If you can supply a MWE of your model, we may be able to help debug it…

1 Like

Thanks! I will work on fixing it for a little more and if (i.e. when) I fail start another topic with an example.

1 Like