Show a trace of geometry node execution?

Is there a debug flag or such to show the execution of a GN tree as it is computed? I saw the thread on displaying execution time, but I’m looking to better understand execution order and inspect any warnings/errors during execution (if these are generated). This is both for debugging, as well as learning GN trees.

Edit: one of the weird things I see is that the viewer node doesn’t always seem to trigger execution of upstream nodes, without any warnings on node(s) visible

Could you be more clear about what information you would like? Execution is generally left to right, but keep in mind that executing a field node just creates a larger field that is passed to the right to be executed somewhere else. Warnings and errors will show up in the UI, you don’t need any debug flag for that.

I mean the order in which nodes execute. I also assume there’s some caching going on where a node can determine it doesn’t need to re-execute because its inputs and parameters haven’t changed, etc. Basically I’m trying to get a log of the way the complete GN graph was executed, including details on why some nodes were executed and others were not.

Nothing like that log exists really, though you can fairly easily output information from the executor to display in the node tree (see LocalGeoLogger::log_debug_message).

Generally a node is only executed once, and the result stays in memory until it is no longer needed. An exception is nodes like switch, where the executor first executes the boolean, then later only executes the input that is actually necessary.

When the visual order is not trivial (e.g. a tree instead of a chain of nodes), the execution order won’t be trivial either, since there is multi-threading at a node-level too.

As for which nodes are calculated, the executor starts at the end of the node tree and starts scheduling operations at the necessary group output sockets and viewer nodes. As soon as a node finds that its inputs haven’t been calculated yet, it will schedule the nodes that compute them. Searching force_compute_sockets and output_sockets should take you to the relevant code.