TruffleSOM Update and Issues with Splitting

Stefan Marr java at stefan-marr.de
Mon Mar 10 11:23:00 UTC 2014


Hi:

In order to finally get TruffleSOM up to reasonable speeds, I adopted the new design for function invocation/message sends of SimpleLanguage.

== New design:

This means, TruffleSOM does no longer use the distinction between unary, binary, ternary, and keyword message sends.
Instead, it uses a single MessageSendNode. To facilitate specialization, I now use direct n-ary expression nodes, which are subclassed by specializing classes for instance for control structures, and primitives. This design disentangles the notion of message sending from the specialization, which was previously conflated.

As a side note, I am also using this distinction, and the logic in UninitalizedMessageSendNode to eagerly specialize message send nodes for basic operations such as addition to their primitive expression nodes by wrapping them into a simple [U|Bi|Ter]naryEagerPrimitiveSpecializationNode [1], which catches the UnsupportedSpecializationException and only then goes to a full message send. Not sure whether that’s the best way to do it, but so far it gives good results. It reduces warmup time and improves peak performance on micrbenchmarks (it seems to have a negative impact on DeltaBlue)
It would probably still be nicer if I could specify my GenericMessageSendNode to be the generic case for all specializations.

Overall, with the new design, I can avoid significant amounts for code duplication I had before because of the direct use of subclasses for message send nodes for specialization as well.
Unfortunately, performance is generally worse.

== @ExplodeLoop not enough to avoid ‘escaping frames’:

I again ran into issues with escaping frames. Eventually, I fixed the issue with the change in [2].
Essentially, the  @ExplodeLoop annotation did not properly work on the method as long as there was the tail call to executeEvaluated(.). Such things are really really hard to figure out for me, because I have no idea how to get hints on what is going on. The only information was, as usual that there was a call to executeGeneric(frame) that let the frame escape. By now I already know that it means the call could not be devirtualized. And that I should look out for loops that are not unrolled. Ok, fine. But this time there was no loop that missed the @ExplodeLoop annotation. And it was guessing which of the many changes I introduce could be the culprit. The change in [2] was a random guess that happened to work and leaves me with a very unsatisfied feeling. 

Anyway, on to the real problem.

== Execution Tree is not stabilizing with splitting:

With splitting is enabled, only a handful of benchmarks stabilize.
Things like the simple WhileLoop benchmark, but also Richards and DeltaBlue seem to be ok.

Highly recursive benchmarks such as Fibonacci seem to be problematic.
After a while, I get for Fibonacci output like the one below [3].
I don’t see any specialization going on anymore, instead I see those ‘inline success’ reports perpetually.
I am not sure what to make of that. What exactly is indicated by this message?
Are the tree copies, i.e., splitted copies gradually inlined? Could it indicate that an upper limit on inlining doesn’t trigger while it probably should?
Any hints what that could mean are highly appreciate!

Thanks
Stefan



[1] https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/nodes/nary/EagerBinaryPrimitiveNode.java#L47
[2] https://github.com/SOM-st/TruffleSOM/commit/3f01afebfbf603e21519c608beff201af3d11a90

[3] Output for Fibonacci:

[truffle] opt done         Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 3a507beb <split>|ASTSize  1482 (0/109) |Time   797( 648+149 )ms |Nodes      1246/ 1323 |CodeSize         6768 |Source Examples/Benchmarks//Fibonacci.som:38
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 23877e40 <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount       54 |inlinedTotalCount     86 |score            0.06 |frequency        1.00 |callCount        1000
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 2ede6d8e <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount       86 |inlinedTotalCount    118 |score            0.06 |frequency        1.00 |callCount        1000
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 1fc40e10 <split>|ASTSize      54 (0/1) |shallowCount       54 |currentCount      118 |inlinedTotalCount    226 |score            0.02 |frequency        1.00 |callCount         999
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 7895b698 <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount      226 |inlinedTotalCount    290 |score            0.06 |frequency        1.00 |callCount         998
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at e424bba <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount      290 |inlinedTotalCount    354 |score            0.06 |frequency        1.00 |callCount         998
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 89ab152 <split>|ASTSize      54 (0/1) |shallowCount       54 |currentCount      354 |inlinedTotalCount    570 |score            0.02 |frequency        1.00 |callCount         997
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 4203f936 <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount      570 |inlinedTotalCount    698 |score            0.06 |frequency        1.00 |callCount         996
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 30cd607d <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount      698 |inlinedTotalCount    826 |score            0.06 |frequency        1.00 |callCount         996
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at c20f79c|ASTSize      15 (0/1) |shallowCount       15 |currentCount      826 |inlinedTotalCount    946 |score             NaN |frequency         NaN |callCount           0
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 3a3e575d <split>|ASTSize      54 (0/1) |shallowCount       54 |currentCount      946 |inlinedTotalCount   1054 |score            0.02 |frequency        1.00 |callCount         999
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 32579775 <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount     1054 |inlinedTotalCount   1118 |score            0.06 |frequency        1.00 |callCount         998
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 4acce36b <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount     1118 |inlinedTotalCount   1182 |score            0.06 |frequency        1.00 |callCount         998
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 55766e96|ASTSize      15 (0/1) |shallowCount       15 |currentCount     1182 |inlinedTotalCount   1242 |score             NaN |frequency         NaN |callCount           0
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 23d9bebe <split>|ASTSize      54 (0/1) |shallowCount       54 |currentCount     1242 |inlinedTotalCount   1674 |score            0.02 |frequency        1.00 |callCount         995
[truffle] inline success     Method Fibonacci>>#fibonacci::Examples/Benchmarks//Fibonacci.som:37 at 313a51b <split>|ASTSize      16 (0/2) |shallowCount       16 |currentCount     1674 |inlinedTotalCount   1930 |score            0.06 |frequency        1.00 |callCount         994
[truffle] inline success     Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 5c07f072|ASTSize      15 (0/1) |shallowCount       15 |currentCount     1930 |inlinedTotalCount   2170 |score             NaN |frequency         NaN |callCount           0
[truffle] opt queued       Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 4d27d539 <split>|ASTSize  2170 (0/149) |C/T        1000/ 1001 |L/T        1000/ 1010 |Inval#/Replace#     0/   38
[truffle] opt start        Method Fibonacci>>#$block method:Examples/Benchmarks//Fibonacci.som:38 at 4d27d539 <split>|ASTSize  2170 (0/149) |C/T        1000/ 1001 |L/T        1000/ 1010 |Inval#/Replace#     0/   38

-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list