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

Unix: Unnecessary struct copy while passsing struct of size <=16 #10879

Open
erozenfeld opened this issue Aug 10, 2018 · 3 comments
Open

Unix: Unnecessary struct copy while passsing struct of size <=16 #10879

erozenfeld opened this issue Aug 10, 2018 · 3 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI enhancement Product code improvement that does NOT require public API changes/additions optimization os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Milestone

Comments

@erozenfeld
Copy link
Member

erozenfeld commented Aug 10, 2018

This is a copy of #6316. For some reason it wasn't possible to update the description of that issue.

Struct arguments whose size is <= 16 bytes generate unnecessary copies. @sivarv categorized the cases below:

The following are the struct passing cases on Amd64 Unix that are of interest:

struct of size 1,2,4 or 8 in memory/register is getting passed in an arg reg or on stack
struct of size 3,5,6,7 in memory/register is getting passed in an arg reg or on stack
struct of size 9-16 bytes in memory is getting passed in two arg registers
struct of size 9-16 bytes (e.g. SIMD structs Vector3 and Vector4) in a register is getting passed in two arg registers
struct of size 9-16 bytes in memory/register is getting passed on stack.
In fgMorphArgs, eeGetSystemVAmd64PassStructInRegisterDescriptor classifies the cases above as register argument except simd from vector and sets structDesc.passedInRegisters to true, this always calls fgMakeOutgoingStructArgCopy() and generates copies.

category:cq
theme:calling-convention
skill-level:intermediate
cost:medium
impact:small

@erozenfeld
Copy link
Member Author

Comment from @CarolEidt on Jun 12 2018:

dotnet/coreclr#18358 eliminated the unnecessary copy when passed on stack.
There are still cases where structs are copied unnecessarily when passed in registers.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@BruceForstall BruceForstall added the JitUntriaged CLR JIT issues needing additional triage label Oct 28, 2020
@SingleAccretion SingleAccretion self-assigned this Aug 28, 2022
@jakobbotsch
Copy link
Member

@SingleAccretion is this still relevant?

@jakobbotsch jakobbotsch removed the JitUntriaged CLR JIT issues needing additional triage label Dec 12, 2022
@SingleAccretion
Copy link
Contributor

A little bit, yes. I believe there is still some copying of Vector3s we can avoid.

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 enhancement Product code improvement that does NOT require public API changes/additions optimization os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

5 participants