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

Revert "Fix NativeAOT ThunksPool thunk data block size handling." #110983

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Dec 29, 2024

Reverts #110732

@jkotas
Copy link
Member Author

jkotas commented Dec 29, 2024

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only outerloop failure looks to be the known CRT bug (since we finished the test and then crashed on shutdown - I'm not going to look at the dump). Reminds me to look into #109006 once I'm back at work.

@MichalStrehovsky
Copy link
Member

@lateralusX are the ARM32 failures something you could look into this week? Otherwise I'd prefer we merge the revert so that native AOT outerloop can be green again. It's very difficult to watch for regressions when every outerloop run is red. See #110852 (comment) for more context.

@MichalStrehovsky
Copy link
Member

@lateralusX are the ARM32 failures something you could look into this week? Otherwise I'd prefer we merge the revert so that native AOT outerloop can be green again. It's very difficult to watch for regressions when every outerloop run is red. See #110852 (comment) for more context.

This keeps generating noise, such as in #110828 CI run. Reverting.

@MichalStrehovsky MichalStrehovsky merged commit a29d5f9 into main Jan 7, 2025
108 of 110 checks passed
@MichalStrehovsky MichalStrehovsky deleted the revert-110732-lateralusX/fix-thunkpool-av branch January 7, 2025 06:44
@lateralusX
Copy link
Member

lateralusX commented Jan 7, 2025

@lateralusX are the ARM32 failures something you could look into this week? Otherwise I'd prefer we merge the revert so that native AOT outerloop can be green again. It's very difficult to watch for regressions when every outerloop run is red. See #110852 (comment) for more context.

This keeps generating noise, such as in #110828 CI run. Reverting.

OK, I can take a look during the week and see how we could get the ARM32 outloop tests working with this fix.

@jkotas my original suggestion, 200f3aa, didn't have this issue since it returns the actual size of the matching thunk data block size from the source using separate functions in asm/cpp implementation instead of doing the calculation in managed code that could end up with a mismatch if the size of the data thunk is not close to the size of the code thunk ending up with a thunk data block size that will be to small since num of thunks per block will reflect number of code thunks and not data thunks, but since data thunk is only 8 bytes (two pointers) on 32-bit, it will probably end up as 204 (NumThunksPerBlock code thunk size 20 and page size 4096) * 8 (ThunkDataSize) + 4 (IntPtr.Size) = 1636 and then doing RoundUpToPowerOf2 would only put us up to 2048, while the page size is probably 4096, meaning we won't update common stub address that is left at 0.

Since the calculation of RhpGetNumThunksPerBlock seems to be the min of number of code or data thunks that fits into a page (similar logic included in all asm implementations as well):

FCIMPL0(int, RhpGetNumThunksPerBlock)
{
    return min(
        OS_PAGE_SIZE / THUNK_SIZE,                              // Number of thunks that can fit in a page
        (OS_PAGE_SIZE - POINTER_SIZE) / (POINTER_SIZE * 2)      // Number of pointer pairs, minus the jump stub cell, that can fit in a page
    );
}
FCIMPLEND

We would need to know these details to calculate the correct thunk data block size in managed code, meaning we probably need to take max of THUNK_SIZE and POINTER_SIZE * 2 in managed code and use that to calculate the size of code and data thunk block. If it is acceptable to add this logic in managed code I believe we could just tweak the PR with that change, alternative is to move back to the initial commit adding explicit functions to return the size of the data thunk block.

@lateralusX
Copy link
Member

New attempt, #111149.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants