Skip to content

Updating LSRA to prevent eGPR use as GC tracked regs. #117991

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

Merged
merged 4 commits into from
Aug 4, 2025

Conversation

DeepakRajendrakumaran
Copy link
Contributor

@DeepakRajendrakumaran DeepakRajendrakumaran commented Jul 23, 2025

This is a draft PR to discuss these changes and ensure everyone is on the same page. These is not ready for review and is in very early stage(so there are comments etc. in there)

Please ignore the following commits

  1. Knob to turn APX on via superpmi
  2. Bug fixes already being addressed by other PRs - 1 and 2

Relevant commits and what they do

  1. Commit adding GC asserts
    This a temporary change for me to test the proposed PR and will be reverted in the actual PR. The goal here is to ensure the JIT never allocates eGPR when the register is GC tracked. These asserts allow me to verify that this doesn't happen when I run superpmi with APX enabled

  2. How I understand Jakob's proposed change to look
    This is based on the Jakob's comment where he proposed looking for the places that call stressLimitReg sand applying similar logic when the interval is a GC interval

This is currently not useful since we do not pass in a specific type to LinearScan::getTempRegForResolution. Instead, it's either TYP_INT or TYP_FLOAT. I need to figure out how to handle this

  1. The original idea which is currently reverted - this doesn't cover all required changes. But the general idea here is to mask away eGPR if we can determine the node generates an instruction using GC tracked reg

I still have a whole lot of fails(due to the asserts mentioned above which I'm looking into currently

For eg Running aspnet.run.windows.x64.checked results in following
Loaded 199503 Jitted 199503 FailedCompile 1589 Excluded 0 Missing 660

@JulieLeeMSFT

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 23, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 23, 2025
Copy link
Contributor

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

@JulieLeeMSFT
Copy link
Member

@jakobbotsch, please review it this week.
CC @tannergooding, @EgorBo, @jkotas.

@jakobbotsch
Copy link
Member

This is currently not useful since we do not pass in a specific type to LinearScan::getTempRegForResolution. Instead, it's either TYP_INT or TYP_FLOAT. I need to figure out how to handle this

It is fine to limit this set indiscriminately. Having more registers available for this resolution is not going to help much.

@DeepakRajendrakumaran
Copy link
Contributor Author

This is currently not useful since we do not pass in a specific type to LinearScan::getTempRegForResolution. Instead, it's either TYP_INT or TYP_FLOAT. I need to figure out how to handle this

It is fine to limit this set indiscriminately. Having more registers available for this resolution is not going to help much.

Sounds good. I am thinking something like the following

SingleTypeRegSet freeRegs = allRegs(type);
// Force TYP_INT to not have access to eGPR since it could be  a GC ref
freeRegs = getAvailableGPRsForType(freeRegs, (type == TYP_INT) ? TYP_REF : type);

@DeepakRajendrakumaran
Copy link
Contributor Author

@jakobbotsch I have done the following for now

  • Rebased the branch to latest main
  • Removed everything else from this PR except the actual proposed change
  • Verified that this version of change doesn't cause any superpmi fails in stress mode with asserts.

There is one pending open being discussed(if varTypeIsLong check is needed). I have added comments explaining what I believe is happening. Let me know if you would like to explore any other changes

@DeepakRajendrakumaran DeepakRajendrakumaran marked this pull request as ready for review July 24, 2025 23:43
@Copilot Copilot AI review requested due to automatic review settings July 24, 2025 23:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the Linear Scan Register Allocator (LSRA) to prevent extended General Purpose Registers (eGPRs) from being used for GC-tracked registers on AMD64, ensuring proper garbage collection tracking and code generation compatibility.

  • Introduces filtering logic to restrict eGPR usage for GC types and long types to low GPRs only
  • Adds new method getAvailableGPRsForType to encapsulate platform-specific register restrictions
  • Integrates the filtering into register selection paths for both normal and minimal selection

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/jit/lsra.h Adds declaration for new getAvailableGPRsForType method
src/coreclr/jit/lsra.cpp Implements register filtering logic and integrates it into register selection process

@DeepakRajendrakumaran DeepakRajendrakumaran changed the title Draft - Updating LSRA to prevent eGPR use as GC tracked regs. Updating LSRA to prevent eGPR use as GC tracked regs. Jul 25, 2025
@jakobbotsch
Copy link
Member

/azp run runtime-coreclr jitstressregs, runtime-coreclr jitstress2-jitstressregs, runtime-coreclr libraries-jitstressregs

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@DeepakRajendrakumaran
Copy link
Contributor Author

DeepakRajendrakumaran commented Jul 25, 2025

@jakobbotsch

This has been our general testing strategy for APX

For this particular change, testing was done with this pending PR too - #117791

SuperPMI

This step will give us the chance to check if there is any assertion failure or internal error within JIT so we can verify the encoding correctness. With the updated coredistools, superpmi also highlights incorrect encoding now

The test result from the runs below show no failures related to this PR

SuperPMI was run with the following commit to force the JIT to assert if we use eGPR for GC tracked registers

PS C:\deepak_repos\runtime\src\coreclr\scripts> python .\superpmi.py replay -arch x64 -core_root "C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root" -jitoption JitBypassApxCheck=1
[10:54:43] ================ Logging to C:\deepak_repos\runtime\artifacts\spmi\superpmi.1.log
[10:54:43] Using JIT/EE Version from jiteeversionguid.h: 2d40ec46-2e41-4a8b-8349-3c1267b95821
[10:54:43] Found download cache directory "C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64" and --force_download not set; skipping download
[10:54:43] SuperPMI replay
[10:54:43] JIT Path: C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit.dll
[10:54:43] Using MCH files:
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[10:54:43] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[10:54:47] Clean SuperPMI replay (28968 contexts processed)
[10:54:47] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[10:55:12] Clean SuperPMI replay (152941 contexts processed)
[10:55:12] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[10:55:24] Clean SuperPMI replay (28972 contexts processed)
[10:55:24] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[10:57:28] Clean SuperPMI replay (638318 contexts processed)
[10:57:28] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[10:58:13] Clean SuperPMI replay (274636 contexts processed)
[10:58:13] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[10:58:56] SuperPMI encountered missing data for 1 out of 287952 contexts
[10:58:56] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:01:23] SuperPMI encountered missing data for 1 out of 768659 contexts
[11:01:23] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:02:17] Clean SuperPMI replay (368307 contexts processed)
[11:02:17] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:02:21] Clean SuperPMI replay (29243 contexts processed)
[11:02:21] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:02:26] Clean SuperPMI replay (34038 contexts processed)
[11:02:26] Replay summary:
[11:02:26]   All replays clean

This was also run with JitStressRegs=4000 which forces eGPR usage whenever possible

PS C:\deepak_repos\runtime\src\coreclr\scripts> python .\superpmi.py replay -arch x64 -core_root "C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root" -jitoption JitBypassApxCheck=1 -jitoption JitStressRegs=4000
[11:03:42] ================ Logging to C:\deepak_repos\runtime\artifacts\spmi\superpmi.2.log
[11:03:42] Using JIT/EE Version from jiteeversionguid.h: 2d40ec46-2e41-4a8b-8349-3c1267b95821
[11:03:42] Found download cache directory "C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64" and --force_download not set; skipping download
[11:03:42] SuperPMI replay
[11:03:42] JIT Path: C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit.dll
[11:03:42] Using MCH files:
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:03:42] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[11:03:48] Clean SuperPMI replay (28968 contexts processed)
[11:03:48] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[11:04:13] Clean SuperPMI replay (152941 contexts processed)
[11:04:13] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[11:04:17] Clean SuperPMI replay (28972 contexts processed)
[11:04:17] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[11:05:52] Clean SuperPMI replay (638318 contexts processed)
[11:05:52] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[11:06:22] Clean SuperPMI replay (274636 contexts processed)
[11:06:22] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[11:06:59] SuperPMI encountered missing data for 1 out of 287952 contexts
[11:06:59] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:08:33] SuperPMI encountered missing data for 1 out of 768659 contexts
[11:08:33] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:09:36] SuperPMI encountered missing data for 1 out of 368307 contexts
[11:09:36] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:09:41] Clean SuperPMI replay (29243 contexts processed)
[11:09:41] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:09:45] Compilation failures
[11:09:46] ============================== Assertions:
[11:09:46] === Assertion #1/1 (count: 2): TakesRex2Prefix(id) || TakesApxExtendedEvexPrefix(id) || TakesEvexPrefix(id) (C:\deepak_repos\runtime\src\coreclr\jit\emitxarch.cpp:4564)
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14390 : IL size 118
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14157 : IL size 228
[11:09:46] ============================== Assertions:
[11:09:46] === Assertion #1/1 (count: 2): TakesRex2Prefix(id) || TakesApxExtendedEvexPrefix(id) || TakesEvexPrefix(id) (C:\deepak_repos\runtime\src\coreclr\jit\emitxarch.cpp:4564)
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14390 : IL size 118
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14157 : IL size 228
[11:09:46] Replay summary:
[11:09:46]   Replay failures in 1 MCH files:
[11:09:46]     C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch

There are 2 asserts with this configuration which are unrelated to this PR. This issue is being worked on and will be a separate bug fix

JIT SDE test

The above is mainly verifying the encoding correctness of the generated binary code. Then the last will examine the semantic correctness of the generated code. WE do this by running SDE with APX on and all changes mentioned earlier.

We used the existing CoreCLR unit test set: JIT and run it in the Intel SDE emulator.

The test result from the runs below show no failures related to this PR

Parsing test results from (C:\deepak_repos\runtime\artifacts\log)
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.Directed.Directed_2.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.Generics.JIT.Generics.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.IL_Conformance.IL_Conformance.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.jit64.jit64_4.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.JIT_d.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.JIT_do.testRun.xml
Time [secs] | Total | Passed | Failed | Skipped | Assembly Execution Summary
============================================================================
     32.179 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d
     32.706 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do
     32.390 |     9 |      9 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r
     33.832 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro
    140.399 |    11 |     11 |      0 |       0 | JIT.Directed.Directed_2
    147.782 |    43 |     43 |      0 |       0 | JIT.Generics.JIT.Generics
    802.807 |   960 |    960 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_r
    822.271 |   960 |    960 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_ro
     67.850 |   127 |    127 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_r
     67.387 |   127 |    127 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_ro
   1591.783 |  1727 |   1727 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_r
   1701.010 |  1727 |   1727 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_ro
    918.281 |  1196 |   1196 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_r
    437.561 |   598 |    598 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_ro
     73.337 |   112 |    112 |      0 |       0 | JIT.IL_Conformance.IL_Conformance
     20.532 |     1 |      1 |      0 |       0 | JIT.jit64.jit64_4
     57.477 |     2 |      2 |      0 |       0 | JIT.JIT_d
     58.272 |     3 |      3 |      0 |       0 | JIT.JIT_do
----------------------------------------------------------------------------
   7037.856 |  7627 |   7627 |      0 |       0 | (total)


Log files at: C:\deepak_repos\runtime\artifacts\log

Current CI fails

Build analysis shows 3 fails(on arm and x86). Look unrelated since this change does not affect non TARGET_AMD64

SingleTypeRegSet LinearScan::getAvailableGPRsForType(SingleTypeRegSet candidates, var_types regType)
{
#ifdef TARGET_AMD64
    if (varTypeIsGC(regType) || varTypeIsLong(regType))
    {
        // For AMD64, we don't use eGPR for GC types.
        candidates &= (SingleTypeRegSet)RBM_LOWINT.getLow();
    }
#endif // TARGET_AMD64
    return candidates;
}

@DeepakRajendrakumaran
Copy link
Contributor Author

Superpmi asmdiff perfscore improvement with all APX features

Diffs are based on 2,612,032 contexts (1,013,569 MinOpts, 1,598,463 FullOpts).

MISSED contexts: base: 0 (0.00%), diff: 2 (0.00%)

Diff JIT options: JitBypassApxCheck=1;EnableApxConditionalChaining=1;EnableApxNDD=1;EnableApxPPX=1;EnableApxZU=1

Overall (+16,549,934 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs Base Instruction Count Diff Instruction Count
benchmarks.run.windows.x64.checked.mch 8,878,388 +327,047 -2.61% 2237726 -92,933(-4.38%)(-4.80%)
benchmarks.run_pgo.windows.x64.checked.mch 81,505,857 +1,685,294 -2.54% 19240026 -566,354(-3.43%)(-3.48%)
benchmarks.run_pgo_optrepeat.windows.x64.checked.mch 8,878,126 +326,868 -2.61% 2237716 -92,915(-4.38%)(-4.80%)
coreclr_tests.run.windows.x64.checked.mch 423,795,191 +3,361,281 -3.29% 88154980 -1,076,331(-2.49%)(-2.63%)
libraries.crossgen2.windows.x64.checked.mch 38,520,795 +25,386 -3.15% 10497555 -34,237(-1.87%)(-1.91%)
libraries.pmi.windows.x64.checked.mch 57,550,606 +2,461,272 -2.44% 14587152 -477,512(-3.48%)(-3.95%)
libraries_tests.run.windows.x64.Release.mch 351,086,881 +4,077,963 -2.28% 77030528 -1,162,107(-2.52%)(-2.60%)
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch 155,720,329 +3,834,497 -1.85% 35930173 -801,027(-2.34%)(-2.56%)
realworld.run.windows.x64.checked.mch 11,816,660 +389,780 -2.47% 2865947 -92,253(-3.34%)(-3.58%)
smoke_tests.nativeaot.windows.x64.checked.mch 5,478,681 +60,546 -2.78% 1537762 -21,464(-3.20%)(-3.38%)
MinOpts (+558,416 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs Base Instruction Count Diff Instruction Count
benchmarks.run.windows.x64.checked.mch 467 +2 -0.86% 133 -2(-4.00%)(-4.00%)
benchmarks.run_pgo.windows.x64.checked.mch 14,819,672 +25,055 -1.42% 3293139 -16,266(-1.76%)(-1.76%)
benchmarks.run_pgo_optrepeat.windows.x64.checked.mch 467 +2 -0.86% 133 -2(-4.00%)(-4.00%)
coreclr_tests.run.windows.x64.checked.mch 286,998,350 +221,891 -0.42% 57872739 -206,931(-1.44%)(-1.50%)
libraries.crossgen2.windows.x64.checked.mch 1,709 +2 -0.43% 489 -1(-2.00%)(-2.00%)
libraries.pmi.windows.x64.checked.mch 112,831 +2 -0.43% 20300 -9(-0.04%)(-0.04%)
libraries_tests.run.windows.x64.Release.mch 197,323,663 +274,603 -0.90% 41056896 -121,823(-1.15%)(-1.17%)
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch 10,934,836 +36,859 -0.25% 2531063 -26,011(-1.42%)(-1.58%)
FullOpts (+15,991,518 bytes)
Collection Base size (bytes) Diff size (bytes) PerfScore in Diffs Base Instruction Count Diff Instruction Count
benchmarks.run.windows.x64.checked.mch 8,877,921 +327,045 -2.61% 2237593 -92,931(-4.38%)(-4.80%)
benchmarks.run_pgo.windows.x64.checked.mch 66,686,185 +1,660,239 -2.65% 15946887 -550,088(-3.53%)(-3.59%)
benchmarks.run_pgo_optrepeat.windows.x64.checked.mch 8,877,659 +326,866 -2.61% 2237583 -92,913(-4.38%)(-4.80%)
coreclr_tests.run.windows.x64.checked.mch 136,796,841 +3,139,390 -4.31% 30282241 -869,400(-3.01%)(-3.19%)
libraries.crossgen2.windows.x64.checked.mch 38,519,086 +25,384 -3.15% 10497066 -34,236(-1.87%)(-1.91%)
libraries.pmi.windows.x64.checked.mch 57,437,775 +2,461,270 -2.44% 14566852 -477,503(-3.49%)(-3.96%)
libraries_tests.run.windows.x64.Release.mch 153,763,218 +3,803,360 -2.81% 35973632 -1,040,284(-2.93%)(-3.03%)
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch 144,785,493 +3,797,638 -1.97% 33399110 -775,016(-2.39%)(-2.62%)
realworld.run.windows.x64.checked.mch 11,591,781 +389,780 -2.47% 2830784 -92,253(-3.34%)(-3.58%)
smoke_tests.nativeaot.windows.x64.checked.mch 5,477,528 +60,546 -2.78% 1537457 -21,464(-3.20%)(-3.38%)

Copy link

Commenter does not have sufficient privileges for PR 117991 in repo dotnet/runtime

@DeepakRajendrakumaran
Copy link
Contributor Author

DeepakRajendrakumaran commented Jul 28, 2025

@dotnet/intel Can we trigger a run for following? - azp run runtime-coreclr jitstressregs, runtime-coreclr jitstress2-jitstressregs, runtime-coreclr libraries-jitstressregs. I do not have the requisite permission

I rebased the branch to latest

@amanasifkhalid
Copy link
Member

/azp run runtime-coreclr jitstressregs, runtime-coreclr jitstress2-jitstressregs, runtime-coreclr libraries-jitstressregs

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@DeepakRajendrakumaran
Copy link
Contributor Author

/azp run runtime-coreclr jitstressregs, runtime-coreclr jitstress2-jitstressregs, runtime-coreclr libraries-jitstressregs

Thank you!

@DeepakRajendrakumaran
Copy link
Contributor Author

@jakobbotsch

This has been our general testing strategy for APX

For this particular change, testing was done with this pending PR too - #117791

SuperPMI

This step will give us the chance to check if there is any assertion failure or internal error within JIT so we can verify the encoding correctness. With the updated coredistools, superpmi also highlights incorrect encoding now

The test result from the runs below show no failures related to this PR

SuperPMI was run with the following commit to force the JIT to assert if we use eGPR for GC tracked registers

PS C:\deepak_repos\runtime\src\coreclr\scripts> python .\superpmi.py replay -arch x64 -core_root "C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root" -jitoption JitBypassApxCheck=1
[10:54:43] ================ Logging to C:\deepak_repos\runtime\artifacts\spmi\superpmi.1.log
[10:54:43] Using JIT/EE Version from jiteeversionguid.h: 2d40ec46-2e41-4a8b-8349-3c1267b95821
[10:54:43] Found download cache directory "C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64" and --force_download not set; skipping download
[10:54:43] SuperPMI replay
[10:54:43] JIT Path: C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit.dll
[10:54:43] Using MCH files:
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[10:54:43]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[10:54:43] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[10:54:47] Clean SuperPMI replay (28968 contexts processed)
[10:54:47] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[10:55:12] Clean SuperPMI replay (152941 contexts processed)
[10:55:12] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[10:55:24] Clean SuperPMI replay (28972 contexts processed)
[10:55:24] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[10:57:28] Clean SuperPMI replay (638318 contexts processed)
[10:57:28] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[10:58:13] Clean SuperPMI replay (274636 contexts processed)
[10:58:13] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[10:58:56] SuperPMI encountered missing data for 1 out of 287952 contexts
[10:58:56] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:01:23] SuperPMI encountered missing data for 1 out of 768659 contexts
[11:01:23] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:02:17] Clean SuperPMI replay (368307 contexts processed)
[11:02:17] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:02:21] Clean SuperPMI replay (29243 contexts processed)
[11:02:21] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:02:26] Clean SuperPMI replay (34038 contexts processed)
[11:02:26] Replay summary:
[11:02:26]   All replays clean

This was also run with JitStressRegs=4000 which forces eGPR usage whenever possible

PS C:\deepak_repos\runtime\src\coreclr\scripts> python .\superpmi.py replay -arch x64 -core_root "C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root" -jitoption JitBypassApxCheck=1 -jitoption JitStressRegs=4000
[11:03:42] ================ Logging to C:\deepak_repos\runtime\artifacts\spmi\superpmi.2.log
[11:03:42] Using JIT/EE Version from jiteeversionguid.h: 2d40ec46-2e41-4a8b-8349-3c1267b95821
[11:03:42] Found download cache directory "C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64" and --force_download not set; skipping download
[11:03:42] SuperPMI replay
[11:03:42] JIT Path: C:\deepak_repos\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\clrjit.dll
[11:03:42] Using MCH files:
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:03:42]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:03:42] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run.windows.x64.checked.mch
[11:03:48] Clean SuperPMI replay (28968 contexts processed)
[11:03:48] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo.windows.x64.checked.mch
[11:04:13] Clean SuperPMI replay (152941 contexts processed)
[11:04:13] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\benchmarks.run_pgo_optrepeat.windows.x64.checked.mch
[11:04:17] Clean SuperPMI replay (28972 contexts processed)
[11:04:17] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\coreclr_tests.run.windows.x64.checked.mch
[11:05:52] Clean SuperPMI replay (638318 contexts processed)
[11:05:52] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.crossgen2.windows.x64.checked.mch
[11:06:22] Clean SuperPMI replay (274636 contexts processed)
[11:06:22] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries.pmi.windows.x64.checked.mch
[11:06:59] SuperPMI encountered missing data for 1 out of 287952 contexts
[11:06:59] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests.run.windows.x64.Release.mch
[11:08:33] SuperPMI encountered missing data for 1 out of 768659 contexts
[11:08:33] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
[11:09:36] SuperPMI encountered missing data for 1 out of 368307 contexts
[11:09:36] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\realworld.run.windows.x64.checked.mch
[11:09:41] Clean SuperPMI replay (29243 contexts processed)
[11:09:41] Running SuperPMI replay of C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch
[11:09:45] Compilation failures
[11:09:46] ============================== Assertions:
[11:09:46] === Assertion #1/1 (count: 2): TakesRex2Prefix(id) || TakesApxExtendedEvexPrefix(id) || TakesEvexPrefix(id) (C:\deepak_repos\runtime\src\coreclr\jit\emitxarch.cpp:4564)
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14390 : IL size 118
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14157 : IL size 228
[11:09:46] ============================== Assertions:
[11:09:46] === Assertion #1/1 (count: 2): TakesRex2Prefix(id) || TakesApxExtendedEvexPrefix(id) || TakesEvexPrefix(id) (C:\deepak_repos\runtime\src\coreclr\jit\emitxarch.cpp:4564)
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14390 : IL size 118
[11:09:46]   C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch # 14157 : IL size 228
[11:09:46] Replay summary:
[11:09:46]   Replay failures in 1 MCH files:
[11:09:46]     C:\deepak_repos\runtime\artifacts\spmi\mch\2d40ec46-2e41-4a8b-8349-3c1267b95821.windows.x64\smoke_tests.nativeaot.windows.x64.checked.mch

There are 2 asserts with this configuration which are unrelated to this PR. This issue is being worked on and will be a separate bug fix

JIT SDE test

The above is mainly verifying the encoding correctness of the generated binary code. Then the last will examine the semantic correctness of the generated code. WE do this by running SDE with APX on and all changes mentioned earlier.

We used the existing CoreCLR unit test set: JIT and run it in the Intel SDE emulator.

The test result from the runs below show no failures related to this PR

Parsing test results from (C:\deepak_repos\runtime\artifacts\log)
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.Directed.Directed_2.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.Generics.JIT.Generics.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_r.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_ro.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.IL_Conformance.IL_Conformance.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.jit64.jit64_4.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.JIT_d.testRun.xml
Analyzing C:\deepak_repos\runtime\artifacts\log\JIT.JIT_do.testRun.xml
Time [secs] | Total | Passed | Failed | Skipped | Assembly Execution Summary
============================================================================
     32.179 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d
     32.706 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do
     32.390 |     9 |      9 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r
     33.832 |     8 |      8 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro
    140.399 |    11 |     11 |      0 |       0 | JIT.Directed.Directed_2
    147.782 |    43 |     43 |      0 |       0 | JIT.Generics.JIT.Generics
    802.807 |   960 |    960 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_r
    822.271 |   960 |    960 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v1_ro
     67.850 |   127 |    127 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_r
     67.387 |   127 |    127 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx10v2_ro
   1591.783 |  1727 |   1727 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_r
   1701.010 |  1727 |   1727 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx512_ro
    918.281 |  1196 |   1196 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_r
    437.561 |   598 |    598 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_X86_Avx_ro
     73.337 |   112 |    112 |      0 |       0 | JIT.IL_Conformance.IL_Conformance
     20.532 |     1 |      1 |      0 |       0 | JIT.jit64.jit64_4
     57.477 |     2 |      2 |      0 |       0 | JIT.JIT_d
     58.272 |     3 |      3 |      0 |       0 | JIT.JIT_do
----------------------------------------------------------------------------
   7037.856 |  7627 |   7627 |      0 |       0 | (total)


Log files at: C:\deepak_repos\runtime\artifacts\log

Current CI fails

Build analysis shows 3 fails(on arm and x86). Look unrelated since this change does not affect non TARGET_AMD64

SingleTypeRegSet LinearScan::getAvailableGPRsForType(SingleTypeRegSet candidates, var_types regType)
{
#ifdef TARGET_AMD64
    if (varTypeIsGC(regType) || varTypeIsLong(regType))
    {
        // For AMD64, we don't use eGPR for GC types.
        candidates &= (SingleTypeRegSet)RBM_LOWINT.getLow();
    }
#endif // TARGET_AMD64
    return candidates;
}

Ruihan's emitter bug fixes have merged. I tested this PR again after rebasing locally to latest main

Emitter unit tests

In codgenxarch.cpp, similar to genAmd64EmitterUnitTestsSse2, we used the JitLateDisasm feature to insert instructions to encode as unit tests for emitter, and LateDisasm will invoke LLVM to disasm the code stream, this gave us the chance to cross validate the disassembly from JIT and LLVM. The output of this step is to verify the emit paths are generating "correct" code that would not trigger #UD or have wrong semantics.

The GC changes should not affect these in theory but ran these as part of testing

SuperPMI

This step will give us the chance to check if there is any assertion failure or internal error within JIT so we can verify the encoding correctness. Superpmi also highlights incorrect encoding now

SuperPMI was run with the following commit to force the JIT to assert if we use eGPR for GC tracked register. This was also run with JitStressRegs=4000 which forces eGPR usage whenever possible

The test result from the runs show no failures

@JulieLeeMSFT
Copy link
Member

@jakobbotsch, please take a final look.

@jakobbotsch jakobbotsch merged commit 7b8a1b4 into dotnet:main Aug 4, 2025
156 of 158 checks passed
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 community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants