Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Merged
merged 3 commits into from
Feb 1, 2025

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
@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib for review

@tannergooding tannergooding merged commit 6f221b4 into dotnet:main Feb 1, 2025
111 of 113 checks passed
@tannergooding tannergooding deleted the fix-111016 branch February 1, 2025 19:06
grendello added a commit to grendello/runtime that referenced this pull request Feb 3, 2025
* main:
  System.Net.Http.WinHttpHandler.StartRequestAsync assertion failed (dotnet#109799)
  Keep test PDB in helix payload for native AOT (dotnet#111949)
  Build the RID-specific System.IO.Ports packages in the VMR (dotnet#112054)
  Always inline number conversions (dotnet#112061)
  Use Contains{Any} in Regex source generator (dotnet#112065)
  Update dependencies from https://github.com/dotnet/arcade build 20250130.5 (dotnet#112013)
  JIT: Transform single-reg args to FIELD_LIST in physical promotion (dotnet#111590)
  Ensure that math calls into the CRT are tracked as needing vzeroupper (dotnet#112011)
  Use double.ConvertToIntegerNative where safe to do in System.Random (dotnet#112046)
  JIT: Compute `fgCalledCount` after synthesis (dotnet#112041)
  Simplify boolean logic in `TimeZoneInfo` (dotnet#112062)
  JIT: Update type when return temp is freshly created (dotnet#111948)
  Remove unused build controls and simplify DotNetBuild.props (dotnet#111986)
  Fix case-insensitive JSON deserialization of enum member names (dotnet#112028)
  WasmAppBuilder: Remove double computation of a value (dotnet#112047)
  Disable LTCG for brotli and zlibng. (dotnet#111805)
  JIT: Improve x86 unsigned to floating cast codegen (dotnet#111595)
  simplify x86 special intrinsic imports (dotnet#111836)
  JIT: Try to retain entry weight during profile synthesis (dotnet#111971)
  Fix explicit offset of ByRefLike fields. (dotnet#111584)
# for free to join this conversation on GitHub. Already have an account? # 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
3 participants