SVM currently just picks random available sources in the graph which results in it taking an rather unpredictable path though the graph leading to sub optimal stack usage.
this patch uses nodegroups as a heuristic to generate the topological order for svm, nodegroups will not be entered until all the inputs to the group have been satisfied.
by doing this we do not have to solve the optimal path though the graph in regards to stack usage (NP hard problem) and still get decent results on some graphs.
MandelBrot_97.blend goes from just over 256 stack slots at peak pressure to 18.
mandelbrot_16k_nodes.blend , not sure how much it would use, but it goes from un-runnable to < 50 slots
Pro's to this method:
Works wonders on large graphs using nodegroups
Does nothing to help 'flat' graphs, i've gone though most mentions of svm stack issues in the database and most of them have a classic tree with splitting branches layout, we could probably get those running by switching from randomly picking from the available sources to a depth first search approach.