-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[RISC-V][LoongArch64] JIT: pass structs according to floating-point calling convention properly #104237
Conversation
…carries also exact field sizes and offsets
… FpStruct info calculation
…omputeReturnFlags() This fixes JIT/HardwareIntrinsics/General/Vector* tests.
Co-authored-by: Qiao Pengcheng <qiaopengcheng@loongson.cn>
Co-authored-by: Qiao Pengcheng <qiaopengcheng@loongson.cn>
Co-authored-by: Qiao Pengcheng <qiaopengcheng@loongson.cn>
Co-authored-by: Qiao Pengcheng <qiaopengcheng@loongson.cn>
…they were write-only. Replace with offset from new ABI info
…tack slot over-allocation
RISC-V starfive-prio1-checked: 9326 / 9345 (99.80%)
Failed
Killed
Skipped
|
RISC-V qemu-prio1-checked: 9341 / 9345 (99.96%)
Failed
Killed
Skipped
|
RISC-V starfive-prio1-checked: 9326 / 9345 (99.80%)
Failed
Killed
Skipped
|
… because they were identical. Move it to Common\Internal/Runtime because it's no longer exposed in JIT interface.
RISC-V starfive-prio1-checked: 9326 / 9345 (99.80%)
Failed
Killed
Skipped
|
RISC-V qemu-prio1-checked: 9352 / 9353 (99.99%)
Failed
Killed
Skipped
|
PR ready for review |
RISC-V starfive-prio1-checked: 9353 / 9353 (100.00%)
Failed
Killed
Skipped
|
e7b4199 is being scheduled to build and testingCOMMIT: |
1 similar comment
e7b4199 is being scheduled to build and testingCOMMIT: |
@dotnet/jit-contrib can anyone review please? |
#if defined(TARGET_RISCV64) || defined(TARGET_LOONGARCH64) | ||
// Structs according to hardware floating-point calling convention are passed as two logical fields, each in | ||
// separate register, disregarding struct layout such as packing, custom alignment, padding with empty structs, etc. | ||
// We need size (can be derived from m_regType) & offset of each field for memory load/stores | ||
unsigned m_fieldOffset[MAX_RET_REG_COUNT]; | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should look to unify this in .NET 10 and just store the offsets for all targets. It will also remove some ifdef soup that exists for Swift handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I think it's good to keep everything ifdeffed out since we are going into a period where we don't want to take risky changes.
Small structs containing one or two fields, at least one of them floating-point, can be passed (or returned) according to hardware floating-point calling convention: each field occupying one register. The existing implementation worked only for the narrow case when the fields were naturally placed. However, the ABIs on both platforms when enregistering fields disregard placement hints such as manual alignment, packing attributes, or padding with empty structs (when they are sized 1 byte like in C++ or .NET). This means additional information such as field offsets and sizes needs to be passed wherever registers<->memory copying of such structs happens.
This change uses the new passing information information introduced in #103945 to implement passing such structs in JIT properly.
Stems from #101796, part of #84834, cc @dotnet/samsung