Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: incorrect code size accounting? #534

Closed
maximecb opened this issue Sep 13, 2023 · 1 comment · Fixed by ruby/ruby#8433
Closed

YJIT: incorrect code size accounting? #534

maximecb opened this issue Sep 13, 2023 · 1 comment · Fixed by ruby/ruby#8433
Labels
bug Something isn't working

Comments

@maximecb
Copy link

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? 🤔

@maximecb maximecb added the bug Something isn't working label Sep 13, 2023
@k0kubun
Copy link
Member

k0kubun commented Sep 13, 2023

It seems like we could run self.past_page_bytes += self.current_page_bytes(); multiple times for the same page when we're moving from an old page to the next page. I'll work on a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants