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

ARM32 JIT: Assertion failed '!"NYI: odd sized struct in fgMorphMultiregStructArg"' during 'Morph - Global' #61168

Closed
jakobbotsch opened this issue Nov 3, 2021 · 5 comments · Fixed by #70075
Assignees
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@jakobbotsch
Copy link
Member

Description

The following program hits a NYI in the ARM32 JIT.

Reproduction Steps

// Generated by Fuzzlyn v1.5 on 2021-11-03 13:28:03
// Run on Arm Linux
// Seed: 6887874265338996715
// Reduced from 122.0 KiB to 0.4 KiB in 00:02:32
// Hits JIT assert in Debug:
// Assertion failed '!"NYI: odd sized struct in fgMorphMultiregStructArg"' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Morph - Global' (IL size 20)
// 
//     File: /__w/1/s/src/coreclr/jit/morph.cpp Line: 4382
// 
public struct S0
{
    public byte F0;
    public sbyte F1;
    public bool F2;
    public byte F3;
    public byte F4;
    public byte F5;
    public sbyte F6;
}

public class Program
{
    public static S0 s_4;
    public static void Main()
    {
        ref S0 vr0 = ref s_4;
        M35(vr0);
    }

    public static void M35(S0 arg0)
    {
    }
}

Expected behavior

No assert hit

Actual behavior

Assert hit

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

cc @dotnet/jit-contrib

@jakobbotsch jakobbotsch added arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Nov 3, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Nov 3, 2021
@ghost
Copy link

ghost commented Nov 3, 2021

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

Issue Details

Description

The following program hits a NYI in the ARM32 JIT.

Reproduction Steps

// Generated by Fuzzlyn v1.5 on 2021-11-03 13:28:03
// Run on Arm Linux
// Seed: 6887874265338996715
// Reduced from 122.0 KiB to 0.4 KiB in 00:02:32
// Hits JIT assert in Debug:
// Assertion failed '!"NYI: odd sized struct in fgMorphMultiregStructArg"' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Morph - Global' (IL size 20)
// 
//     File: /__w/1/s/src/coreclr/jit/morph.cpp Line: 4382
// 
public struct S0
{
    public byte F0;
    public sbyte F1;
    public bool F2;
    public byte F3;
    public byte F4;
    public byte F5;
    public sbyte F6;
}

public class Program
{
    public static S0 s_4;
    public static void Main()
    {
        ref S0 vr0 = ref s_4;
        M35(vr0);
    }

    public static void M35(S0 arg0)
    {
    }
}

Expected behavior

No assert hit

Actual behavior

Assert hit

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

cc @dotnet/jit-contrib

Author: jakobbotsch
Assignees: -
Labels:

arch-arm32, area-CodeGen-coreclr

Milestone: -

@VincentBu
Copy link
Contributor

Failed again in: runtime-coreclr outerloop 20220523.2

Failed test:

R2R-CG2 windows arm Checked no_tiered_compilation @ Windows.10.Arm64v8.Open

- JIT\\Stress\\ABI\\tailcalls_do\\tailcalls_do.cmd
- JIT\\Stress\\ABI\\tailcalls_d\\tailcalls_d.cmd

coreclr windows arm Checked no_tiered_compilation @ Windows.10.Arm64v8.Open

- JIT\\Stress\\ABI\\tailcalls_do\\tailcalls_do.cmd
- JIT\\Stress\\ABI\\tailcalls_d\\tailcalls_d.cmd

Error message:

Assert failure(PID 3068 [0x00000bfc], Thread: 7108 [0x1bc4]): Assertion failed '!"NYI: odd sized struct in fgMorphMultiregStructArg"' in 'DynamicClass:InvokeStub_ABIStress_TailCallee9685(System.Object,System.Object,int):System.Object' during 'Morph - Global' (IL size 68; hash 0x3dc7e6f8; FullOpts)

File: D:\a\_work\1\s\src\coreclr\jit\morph.cpp Line: 3853
Image: D:\h\w\942D0818\p\corerun.exe
Return code:      1
Raw output file:      D:\h\w\942D0818\w\B70709A5\uploads\Reports\JIT.Stress\ABI\tailcalls_do\tailcalls_do.output.txt
Raw output:
BEGIN EXECUTION
tailcalls_do.dll
1 file(s) copied.
13:42:30.59
Response file: D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll.rsp
D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\IL-CG2\tailcalls_do.dll
-o:D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll
--targetarch:arm
--verify-type-and-field-layout
--method-layout:random
-r:D:\h\w\942D0818\p\System..dll
-r:D:\h\w\942D0818\p\Microsoft..dll
-r:D:\h\w\942D0818\p\mscorlib.dll
-r:D:\h\w\942D0818\p\netstandard.dll
-O
" "dotnet" "D:\h\w\942D0818\p\crossgen2\crossgen2.dll" @"D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll.rsp"   -r:D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\IL-CG2*.dll"
Emitting R2R PE file: D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll
13:42:33.16
"D:\h\w\942D0818\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  tailcalls_do.dll --tailcalls --num-calls 1000 --no-ctrlc-summary
Stressing tailcalls
OSVersion: Microsoft Windows NT 10.0.19044.0
OSArchitecture: Arm64
ProcessArchitecture: Arm
Selecting win86 ABI
50 callers done (49 successful tailcalls tested)
100 callers done (99 successful tailcalls tested)
150 callers done (149 successful tailcalls tested)
200 callers done (199 successful tailcalls tested)
250 callers done (250 successful tailcalls tested)
300 callers done (300 successful tailcalls tested)
350 callers done (350 successful tailcalls tested)
Expected: 100
Actual: -1073740286
END EXECUTION - FAILED
FAILED
Test Harness Exitcode is : 1
To run the test:

set CORE_ROOT=D:\h\w\942D0818\p
D:\h\w\942D0818\w\B70709A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.cmd
Expected: True
Actual:   False


Stack trace
   at JIT_Stress._ABI_tailcalls_do_tailcalls_do_._ABI_tailcalls_do_tailcalls_do_cmd()

@jakobbotsch
Copy link
Member Author

I can take a look at this one @kunalspathak

@BruceForstall
Copy link
Member

Note: #70043

@VincentBu
Copy link
Contributor

Failed again in: runtime-coreclr outerloop 20220531.2

Failed test:

R2R-CG2 windows arm Checked no_tiered_compilation @ Windows.10.Arm64v8.Open

- JIT\\Stress\\ABI\\tailcalls_do\\tailcalls_do.cmd
- JIT\\Stress\\ABI\\tailcalls_d\\tailcalls_d.cmd

coreclr windows arm Checked no_tiered_compilation @ Windows.10.Arm64v8.Open

- JIT\\Stress\\ABI\\tailcalls_do\\tailcalls_do.cmd
- JIT\\Stress\\ABI\\tailcalls_d\\tailcalls_d.cmd

Error message:

Assert failure(PID 15228 [0x00003b7c], Thread: 7032 [0x1b78]): Assertion failed '!"NYI: odd sized struct in fgMorphMultiregStructArg"' in 'DynamicClass:InvokeStub_ABIStress_TailCallee9685(System.Object,System.Object,int):System.Object' during 'Morph - Global' (IL size 68; hash 0x3dc7e6f8; FullOpts)

File: D:\a\_work\1\s\src\coreclr\jit\morph.cpp Line: 3847
Image: D:\h\w\9EA608E0\p\corerun.exe
Return code:      1
Raw output file:      D:\h\w\9EA608E0\w\B79809A5\uploads\Reports\JIT.Stress\ABI\tailcalls_do\tailcalls_do.output.txt
Raw output:
BEGIN EXECUTION
tailcalls_do.dll
1 file(s) copied.
13:36:36.27
Response file: D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll.rsp
D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\IL-CG2\tailcalls_do.dll
-o:D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll
--targetarch:arm
--verify-type-and-field-layout
--method-layout:random
-r:D:\h\w\9EA608E0\p\System..dll
-r:D:\h\w\9EA608E0\p\Microsoft..dll
-r:D:\h\w\9EA608E0\p\mscorlib.dll
-r:D:\h\w\9EA608E0\p\netstandard.dll
-O
" "dotnet" "D:\h\w\9EA608E0\p\crossgen2\crossgen2.dll" @"D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll.rsp"   -r:D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\IL-CG2*.dll"
Emitting R2R PE file: D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.dll
13:36:39.89
"D:\h\w\9EA608E0\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  tailcalls_do.dll --tailcalls --num-calls 1000 --no-ctrlc-summary
Stressing tailcalls
OSVersion: Microsoft Windows NT 10.0.19044.0
OSArchitecture: Arm64
ProcessArchitecture: Arm
Selecting win86 ABI
50 callers done (46 successful tailcalls tested)
100 callers done (100 successful tailcalls tested)
150 callers done (150 successful tailcalls tested)
200 callers done (199 successful tailcalls tested)
250 callers done (250 successful tailcalls tested)
300 callers done (299 successful tailcalls tested)
350 callers done (350 successful tailcalls tested)
Expected: 100
Actual: -1073740286
END EXECUTION - FAILED
FAILED
Test Harness Exitcode is : 1
To run the test:

set CORE_ROOT=D:\h\w\9EA608E0\p
D:\h\w\9EA608E0\w\B79809A5\e\JIT\Stress\ABI\tailcalls_do\tailcalls_do.cmd
Expected: True
Actual:   False


Stack trace
   at JIT_Stress._ABI_tailcalls_do_tailcalls_do_._ABI_tailcalls_do_tailcalls_do_cmd()

jakobbotsch added a commit to jakobbotsch/runtime that referenced this issue Jun 1, 2022
ARM32 ABI allows passing structs in register even when their sizes are
not divisible by 4. This means we sometimes need to pass 3 bytes in the
last register. The JIT would not handle this when the source was an
arbitrary memory location (this would require multiple loads and
shifts). The fix is to just force a copy into the local stack frame for
this case.

Fix dotnet#61168
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 1, 2022
jakobbotsch added a commit that referenced this issue Jun 7, 2022
* JIT ARM32: Fix odd sized structs from arbitrary sources

ARM32 ABI allows passing structs in register even when their sizes are
not divisible by 4. This means we sometimes need to pass 3 bytes in the
last register. The JIT would not handle this when the source was an
arbitrary memory location (this would require multiple loads and
shifts). The fix is to just force a copy into the local stack frame for
this case.

Fix #61168

* Reenable ABI tests

Fix #68837
Fix #70042
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants