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

Ensure that math calls into the CRT are tracked as needing vzeroupper #112011

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tannergooding
Copy link
Member

The root issue was that GenTreeCall::NeedsVzeroupper was only looking at IsPInvoke() methods, while calls like Math.Sin are represented as regular CT_USERCALL, thus we lost track of the fact that this was not actually in managed.

This then resolves #111016 by ensuring that we correctly mark such calls as being "special" (via GTF_CALL_M_SPECIAL_INTRINSIC) which then allows us to decide to do the additional signature checking and determine that a vzeroupper is needed.

If any of these calls are later moved to managed, then we can avoid the vzeroupper by not marking these particular cases as "special". This already applies to cases like Sqrt which are never rewritten back as user calls or cases like Max where we know the fallback is in managed, rather than into the C runtime.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 30, 2025
Copy link
Contributor

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

// A few other special cases exist that can't be found by signature alone, so we handle
// those explicitly here instead.
needsVzeroupper = IsHelperCall(comp, CORINFO_HELP_BULK_WRITEBARRIER);
break;

Choose a reason for hiding this comment

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

The signature only needs to be checked when needsVzeroupper is still false: checkSignature = !needsVzeroupper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance regression come again on dotnet 9
2 participants