Skip to content

YJIT: incorrect code size accounting? #534

Closed
ruby/ruby
#8433
@maximecb

Description

@maximecb

I was looking at the stats for chunky-png yesterday and I noticed that the code_region_overhead metric that I recently added was negative on this benchmark:

From ruby/master, as of ff329ce

inline_code_size:            619,828
outlined_code_size:          447,776
code_region_size:            999,424
code_region_overhead:        -68,180 (-6.8%)

This failure mode doesn't happen on every run, but for some runs, we get a negative number. The overhead is calculated as follows in yjit.rb:

code_region_overhead = stats[:code_region_size] - (stats[:inline_code_size] + stats[:outlined_code_size])

It seems like we must be doing something wrong somewhere, somehow overcounting inline/outlined code size, or undercounting the code region size, because AFAIK this number should never be negative. It would be good to identify the cause of the error, because it means the metrics we've used so far may have been somewhat off, and the code region overhead value currently being reported is obviously wrong and useless in its current state.

@XrXr could you take a look at this and try to determine where the issue is? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions