Skip to content

JIT: Remove PUTARG_SPLIT #116074

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 5 commits into from
Jun 4, 2025
Merged

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented May 28, 2025

Instead replace arguments that are passed split across registers and stack by two arguments in lowering. With recent ABI and class layout work this is now straightforward.

fgTryMorphStructArg can be simplified after this, which I will do in a future change.

Instead replace arguments that are passed split across registers and
stack by two arguments in lowering. With recent ABI and class layout
work this is now straightforward.
@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 May 28, 2025
Copy link
Contributor

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

@jakobbotsch
Copy link
Member Author

/azp run runtime

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch reopened this May 29, 2025
@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr superpmi-replay, runtime-coreclr superpmi-diffs

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @kunalspathak

Diffs. Some MinOpts size regressions, mostly in tests, and also a few FullOpts ones. The FullOpts ones are generally the result of how we would previously create

PUTARG_SPLIT(BLK(some_address))

and the codegen for that would be able to contain address modes to load the stack part. We now create

PUTARG_STK(BLK(ADD(some_address, <size of register parts>)))

for the part that is pushed on the stack, and PUTARG_STK cannot contain the ADD(some_address, <size of register parts>). So we end up with additional codegen for the ADD.
Since it is still an overall size improvement for FullOpts I think it's ok to not bother trying to optimize this.

Other than that just some TP improvements from no longer having to check for PUTARG_SPLIT in various multireg paths.

@jakobbotsch jakobbotsch marked this pull request as ready for review May 30, 2025 09:37
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 simplifies the JIT lowering by entirely removing support for the PUTARG_SPLIT operation. In its key changes, the PR renames LowerPutArgStkOrSplit to LowerPutArgStk, removes all references and code paths related to GT_PUTARG_SPLIT, and updates related headers and codegen routines accordingly.

  • Rename and simplify lowering functions by consolidating split and stack cases.
  • Remove obsolete GT_PUTARG_SPLIT branches and related code paths from multiple files.
  • Update associated header declarations and documentation to reflect the change.

Reviewed Changes

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

Show a summary per file
File Description
src/coreclr/jit/lowerriscv64.cpp Renamed LowerPutArgStkOrSplit to LowerPutArgStk; updated comment accordingly.
src/coreclr/jit/lowerloongarch64.cpp Consistent renaming of lowering function and comment update.
src/coreclr/jit/lowerarmarch.cpp Updated comments and function names to remove PUTARG_SPLIT references.
src/coreclr/jit/lower.h Removed LowerPutArgStkOrSplit declaration and updated lowering API.
src/coreclr/jit/lower.cpp Removed GT_PUTARG_SPLIT-specific code and updated call sites.
src/coreclr/jit/gentree.h Removed obsolete API methods and affected call sites regarding PUTARG_SPLIT.
Other codegen and related files Cleaned up switch cases and function definitions to remove PUTARG_SPLIT handling.
Comments suppressed due to low confidence (3)

src/coreclr/jit/codegenriscv64.cpp:4287

  • The removal of the GT_PUTARG_SPLIT case from the switch statement is appropriate. Please verify that no architecture-specific invariants rely on this case.
case GT_PUTARG_SPLIT:

src/coreclr/jit/lowerriscv64.cpp:477

  • The comment now clearly reflects the removal of the PUTARG_SPLIT case; please ensure that any associated documentation is updated similarly.
// LowerPutArgStk: Lower a GT_PUTARG_STK.

src/coreclr/jit/lower.h:396

  • The header now only declares LowerPutArgStk; double-check that any outdated references or documentation regarding PUTARG_SPLIT have been removed.
void     LowerPutArgStk(GenTreePutArgStk* putArgNode);

@jakobbotsch
Copy link
Member Author

Ping @kunalspathak

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM. Did you already do a round of Fuzzlyn/Antigen?

@jakobbotsch
Copy link
Member Author

LGTM. Did you already do a round of Fuzzlyn/Antigen?

No, but ABIStress tests should already have targeted fuzzing coverage of this.

@jakobbotsch
Copy link
Member Author

/ba-g Timeout

@jakobbotsch jakobbotsch merged commit fcbc76a into dotnet:main Jun 4, 2025
112 of 114 checks passed
@jakobbotsch jakobbotsch deleted the split-register-args branch June 4, 2025 09:13
@MichalStrehovsky
Copy link
Member

@jakobbotsch I think this broke native AOT outerloops. I'm now seeing:

2025-06-04T11:38:26.7563674Z     ILC: /__w/1/s/src/coreclr/jit/compiler.cpp:10593
2025-06-04T11:38:26.7577952Z     ILC: Assertion failed '(result >= 0) && ((unsigned)result < ArrLen(str))' in 'Internal.CompilerGenerated.<Module>:DynamicInvoke(uint,byref,byref,uint):byref' during 'Lowering nodeinfo' (IL size 28; hash 0xda6f5354; FullOpts)
2025-06-04T11:38:26.7580904Z     
2025-06-04T11:38:27.2170713Z /__w/1/s/artifacts/bin/coreclr/linux.arm.Checked/build/Microsoft.NETCore.Native.targets(332,5): error MSB3073: The command ""/__w/1/s/artifacts/bin/coreclr/linux.arm.Checked/x64/ilc/ilc" @"/__w/1/s/artifacts/tests/coreclr/obj/linux.arm.Checked/Managed/CoreMangLib/system/span/RefStructWithSpan/native/RefStructWithSpan.ilc.rsp"" exited with code 134. [/__w/1/s/src/tests/CoreMangLib/system/span/RefStructWithSpan.csproj] [/__w/1/s/src/tests/build.proj]

The test in question uses recursive generics and from what I can gather, this PR added a call to printfAlloc that uses type names. Looks like printfAlloc has a 512 character limit on strings.

@jakobbotsch
Copy link
Member Author

@jakobbotsch I think this broke native AOT outerloops. I'm now seeing:

2025-06-04T11:38:26.7563674Z     ILC: /__w/1/s/src/coreclr/jit/compiler.cpp:10593
2025-06-04T11:38:26.7577952Z     ILC: Assertion failed '(result >= 0) && ((unsigned)result < ArrLen(str))' in 'Internal.CompilerGenerated.<Module>:DynamicInvoke(uint,byref,byref,uint):byref' during 'Lowering nodeinfo' (IL size 28; hash 0xda6f5354; FullOpts)
2025-06-04T11:38:26.7580904Z     
2025-06-04T11:38:27.2170713Z /__w/1/s/artifacts/bin/coreclr/linux.arm.Checked/build/Microsoft.NETCore.Native.targets(332,5): error MSB3073: The command ""/__w/1/s/artifacts/bin/coreclr/linux.arm.Checked/x64/ilc/ilc" @"/__w/1/s/artifacts/tests/coreclr/obj/linux.arm.Checked/Managed/CoreMangLib/system/span/RefStructWithSpan/native/RefStructWithSpan.ilc.rsp"" exited with code 134. [/__w/1/s/src/tests/CoreMangLib/system/span/RefStructWithSpan.csproj] [/__w/1/s/src/tests/build.proj]

The test in question uses recursive generics and from what I can gather, this PR added a call to printfAlloc that uses type names. Looks like printfAlloc has a 512 character limit on strings.

Sorry about that. Will submit a fix shortly...

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.

3 participants