-
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
Test failure: System.Buffers.Tests.ArrayBufferWriterTests_Char.Advance #42517
Comments
Tagging subscribers to this area: @tannergooding, @pgovind, @jeffhandley |
This failed in multiple scenarios, not just arm. It also failed for x86, x64, and on Windows. |
Looks like this repro's with just |
CC @dotnet/jit-contrib, this looks to be caused by inlining the |
I am still trying to get a repro for this on my dev machine:
=== TEST EXECUTION SUMMARY === <test name="System.Buffers.Tests.ArrayBufferWriterTests_Char.Advance" type="System.Buffers.Tests.ArrayBufferWriterTests_Char" method="Advance" time="0.0182829" result="Pass" /> |
First test failure was for |
@tannergooding Can you help me get a local repro for this issue? |
I just do:
|
added in the |
Thanks @tannergooding I have a repro! |
Testing this: |
Passes without the commit 92b125f |
@sandreenko _ This change cause the regression. |
Thanks @briansull for the analysis, the change was merged after 5.0 so we can change the milestone to 6.0. |
Sure |
Thanks @briansull for root-causing this issue. |
My current understanding is that the optimization uncovered a preexisting issue with VN and morph,
there are no reasons for but the bug is in VN logic ( diff --git "a/D:\\Sergey\\logs\\temp\\good" "b/D:\\Sergey\\logs\\temp\\bad"
index 50e7950fd58..e25dbf094db 100644
--- "a/D:\\Sergey\\logs\\temp\\good"
+++ "b/D:\\Sergey\\logs\\temp\\bad"
@@ -1,48 +1,35 @@
-***** BB95, STMT00656(before)
-N003 ( 7, 5) [003014] -A------R--- * ASG struct (copy)
-N002 ( 3, 2) [003012] D------N---- +--* LCL_VAR struct<System.Memory`1[Byte], 16> V235 tmp222
-N001 ( 3, 2) [002934] ------------ \--* LCL_VAR struct<System.Memory`1[Byte], 16> V234 tmp221 u:3 (last use)
-
-N001 [002934] LCL_VAR V234 tmp221 u:3 (last use) => $617 {PhiDef($ea, $3, $5c0)}
-LHS V235 not in ssa at [003012], so no VN assigned
-N003 [003014] ASG => $VN.Void
-
-***** BB95, STMT00656(after)
-N003 ( 7, 5) [003014] -A------R--- * ASG struct (copy) $VN.Void
-N002 ( 3, 2) [003012] D------N---- +--* LCL_VAR struct<System.Memory`1[Byte], 16> V235 tmp222
-N001 ( 3, 2) [002934] ------------ \--* LCL_VAR struct<System.Memory`1[Byte], 16> V234 tmp221 u:3 (last use) $617
-
----------
-
***** BB95, STMT00058(before)
N003 ( 7, 5) [003011] -A--G---R--- * ASG struct (copy)
N002 ( 3, 2) [003010] D------N---- +--* LCL_VAR struct<System.ReadOnlyMemory`1[Byte], 16> V09 loc8 d:3
-N001 ( 3, 2) [003017] -------N---- \--* LCL_VAR struct<System.Memory`1[Byte], 16> V235 tmp222 (last use)
+N001 ( 3, 2) [003008] ------------ \--* LCL_VAR struct<System.Memory`1[Byte], 16> V234 tmp221 u:3 (last use)
-N001 [003017] LCL_VAR V235 tmp222 (last use) => $4bc {4bc}
-Tree [003011] assigned VN to local var V09/3: new uniq $4bf {4bf}
+N001 [003008] LCL_VAR V234 tmp221 u:3 (last use) => $617 {PhiDef($ea, $3, $5c0)}
+Tree [003011] assigned VN to local var V09/3: $617 {PhiDef($ea, $3, $5c0)}
N003 [003011] ASG => $VN.Void
***** BB95, STMT00058(after)
N003 ( 7, 5) [003011] -A--G---R--- * ASG struct (copy) $VN.Void
N002 ( 3, 2) [003010] D------N---- +--* LCL_VAR struct<System.ReadOnlyMemory`1[Byte], 16> V09 loc8 d:3
-N001 ( 3, 2) [003017] -------N---- \--* LCL_VAR struct<System.Memory`1[Byte], 16> V235 tmp222 (last use) $4bc
+N001 ( 3, 2) [003008] ------------ \--* LCL_VAR struct<System.Memory`1[Byte], 16> V234 tmp221 u:3 (last use) $617
N003 ( 3, 4) [003030] -A------R--- * ASG ref
N002 ( 1, 1) [003029] D------N---- +--* LCL_VAR ref V239 tmp226 d:2
N001 ( 3, 4) [003028] ------------ \--* LCL_FLD ref V09 loc8 u:3[+0] Fseq[_object]
VNApplySelectors:
- VNForHandle(_object) is $193, fieldType is ref
- VNForMapSelect($4bf, $193):ref returns $8f8 {$4bf[$193]}
+ VNForHandle(_object) is $193, fieldType is ref
+ AX2: $193 != $18c ==> select([$36a]store($368, $18c, $9ce), $193) ==> select($368, $193).
+ AX2: $193 != $18b ==> select([$368]store($24b, $18b, $40), $193) ==> select($24b, $193).
+ AX2: $193 != $18a ==> select([$24b]store($1, $18a, $8f3), $193) ==> select($1, $193).
+ VNForMapSelect($617, $193):ref returns $VN.Null
VNApplySelectors:
VNForHandle(_object) is $193, fieldType is ref
- VNForMapSelect($4bf, $193):ref returns $8f8 {$4bf[$193]}
-N001 [003028] LCL_FLD V09 loc8 u:3[+0] Fseq[_object] => $8f8 {$4bf[$193]}
-N002 [003029] LCL_VAR V239 tmp226 d:2 => $8f8 {$4bf[$193]}
-N003 [003030] ASG => $8f8 {$4bf[$193]}
+ VNForMapSelect($617, $193):ref returns $VN.Null
+N001 [003028] LCL_FLD V09 loc8 u:3[+0] Fseq[_object] => $VN.Null
+N002 [003029] LCL_VAR V239 tmp226 d:2 => $VN.Null
+N003 [003030] ASG => $VN.Null
***** BB95, STMT00660(after)
-N003 ( 3, 4) [003030] -A------R--- * ASG ref $8f8
-N002 ( 1, 1) [003029] D------N---- +--* LCL_VAR ref V239 tmp226 d:2 $8f8
-N001 ( 3, 4) [003028] ------------ \--* LCL_FLD ref V09 loc8 u:3[+0] Fseq[_object] $8f8
+N003 ( 3, 4) [003030] -A------R--- * ASG ref $VN.Null
+N002 ( 1, 1) [003029] D------N---- +--* LCL_VAR ref V239 tmp226 d:2 $VN.Null
+N001 ( 3, 4) [003028] ------------ \--* LCL_FLD ref V09 loc8 u:3[+0] Fseq[_object] $VN.Null maybe we were lucky with The main problem that I see here is |
* Disable ArrayBufferWriterTests.Advance with JitStress. Issue #42517 * Try to disable broader.
I would expect that it is conservative to have DONT_CSE set on any node. |
ValueNumbering of field writes and subsequent reads are pretty tricky to debug. If you need any help or want to assign this to me that is fine as well. |
That means that we saw the definition assignment that assigned a nullptr and that we didn't kill/replace the value when it was changed by a second assignment. |
Yes, but now we have a logic that depends on it to identify if a lcl var is store a src or dst (#40871). In this case I think it does not matter because it only affects structs and they can't be small types but if we find a case where it is set on a primitive struct we will be able to create a test that hits assert |
Thanks for the offer I will probably need your help soon. I have found this code in importer: runtime/src/coreclr/src/jit/importer.cpp Lines 16878 to 16894 in 0426f16
and we had this flag set for So there are several possibilities here:
Of course, the first looks like the most attractive way to solve it but I think I need to write a repro first, using the one from @erozenfeld. Updated the link to the PR. |
@briansull I wrote a small repro for this issue: sandreenko@ec2ae56 JitDump for The issue is
and the comment says:
so in this case we should mark it means we now have another option: What resoltuion would you prefer for it? Would it be profitable to invest time to teach VN to work with such cases or do you think they are too rare? I think it is a better long-term solution but its cost is unclear for me. |
I don't think it is easy to fix ValueNumbering to handle overlapping fields. |
I presume this is still failing in the CI (except the CI has been broken), but there has been no update recently. What's the story? Should the failing tests be disabled until this is fixed? |
failed in job: runtime-coreclr libraries-jitstress 20200920.1
failed tests:
System.Buffers.Tests.ArrayBufferWriterTests_Char.Advance
System.Buffers.Tests.ArrayBufferWriterTests_Byte.Advance
net5.0-Linux-Release-arm-CoreCLR_checked-tailcallstress-(Ubuntu.1804.Arm32.Open)[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440
Error message
category:correctness
theme:value-numbering
skill-level:expert
cost:medium
The text was updated successfully, but these errors were encountered: