graal icon indicating copy to clipboard operation
graal copied to clipboard

Use callTarget.id instead of hashCode in OptimizedTruffleRuntime and TraceSplittingListener

Open rwstauner opened this issue 1 year ago • 2 comments

This format is consistent with the format for splits present in the "[engine] opt" lines when tracing compilation.

Using --engine.TraceCompilation --engine.TraceSplitting --engine.TraceTransferToInterpreter the output changes from

[engine] split 297-493b01ef-1     Truffle::RegexpOperations.match_in_region                   |AST   99|Tier 1|Calls/Thres       5/    1|CallsAndLoop/Thres      17/  400|SourceSection /Users/rwstauner/src/truffle-ws/truffleruby/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb~29:881-943
[engine] opt done   id=1722  Truffle::RegexpOperations.match_in_region <split-1722> |Tier 2|Time    90(  42+48  )ms|AST   99|Inlined   2Y   0N|IR    326/   956|CodeSize    3804|Addr 0x11743dcc0|Timestamp 6753643229750|Src regexp_operations.rb:76
[engine] transferToInterpreter at
  Truffle::RegexpOperations.match_in_region(../../../truffle-ws/truffleruby/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb:76) <split-493b01ef>

to

[engine] split 297-1722-1     Truffle::RegexpOperations.match_in_region                   |AST   99|Tier 1|Calls/Thres       5/    1|CallsAndLoop/Thres      17/  400|SourceSection /Users/rwstauner/src/truffle-ws/truffleruby/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb~29:881-943
[engine] opt done   id=1722  Truffle::RegexpOperations.match_in_region <split-1722> |Tier 2|Time    92(  42+50  )ms|AST   99|Inlined   2Y   0N|IR    326/   956|CodeSize    3804|Addr 0x1176b89c0|Timestamp 6604360084708|Src regexp_operations.rb:76
[engine] transferToInterpreter at
  Truffle::RegexpOperations.match_in_region(../../../truffle-ws/truffleruby/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb:76) <split-1722>

The id is a public final https://github.com/oracle/graal/blob/2a77e42419b9fcefb45d0fc5546fd6456359b4f7/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedCallTarget.java#L357

Currently this keeps the format of "splitCount-splitId-callCount" in the TraceSplittingListener the same, but if that isn't valuable it might be nice to reformat it so that each line has split-1722 which might make finding those easier.

What do you think about this? Do we need anything else here?

rwstauner avatar Mar 27 '24 16:03 rwstauner

I think we should also update the line in TraceSplittingListener#onCompilationSplit. It uses the call target hash code as well.

nirvdrum avatar Apr 11 '24 01:04 nirvdrum

I looked for files that contain OptimizedCallTarget and then looked for uses of hashCode and TraceSplittingListenener seemed to be the only other relevant one.

rwstauner avatar Apr 15 '24 17:04 rwstauner