Skip to content

Arm64: !"Inconsistent profile data" Remove empty try-catch-fault 3 #115122

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

Closed
kunalspathak opened this issue Apr 28, 2025 · 4 comments · Fixed by #115150
Closed

Arm64: !"Inconsistent profile data" Remove empty try-catch-fault 3 #115122

kunalspathak opened this issue Apr 28, 2025 · 4 comments · Fixed by #115150
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs
Milestone

Comments

@kunalspathak
Copy link
Member

kunalspathak commented Apr 28, 2025

Found by Antigen: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1027770&view=ms.vss-build-web.run-extensions-tab

superpmi.exe clrjit_universal_arm64_X64.dll profile_data.mc

profile_data.zip

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 28, 2025
@kunalspathak kunalspathak added blocking-clean-ci-optional Blocking optional rolling runs and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Apr 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 28, 2025
@kunalspathak kunalspathak added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 28, 2025
Copy link
Contributor

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

@kunalspathak
Copy link
Member Author

@dotnet/jit-contrib

@amanasifkhalid amanasifkhalid self-assigned this Apr 28, 2025
@amanasifkhalid amanasifkhalid removed the untriaged New issue has not been triaged by the area owner label Apr 28, 2025
@amanasifkhalid amanasifkhalid added this to the 10.0.0 milestone Apr 28, 2025
@amanasifkhalid
Copy link
Member

Our profile consistency checks aren't aggressive enough to find the consistency issue until late EH removal gets rid of a catch clause. The actual inconsistency is introduced during the post-morph profile synthesis run, where not all of the method's entry weight makes it to BB16, its sole exit block:

iteration 28: max residual is at BB11 : 9.260656
iteration 28: max rel residual is at BB12 : 0.001892865
converged at iteration 28 rel residual 0.001892865 eigenvalue 0.8509765
fgCalledCount is 180
Checking Profile Weights (flags:0x24)
Profile is self-consistent (11 profiled blocks, 0 unprofiled)

*************** Finishing PHASE Repair profile post-morph
Trees after Repair profile post-morph

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BBnum BBid ref try hnd preds           weight    IBC [IL range]   [jump]                            [EH region]        [flags]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BB01 [0000]  1                             1     180 [000..0DC)-> BB15(0.52),BB09(0.48)   ( cond )                   i IBC
BB09 [0001]  3       BB01,BB14,BB15        6.39 1150 [0DC..0E6)-> BB16(0.1),BB10(0.9)     ( cond )                   i IBC bwd bwd-target
BB10 [0003]  1  0    BB09                  5.75 1035 [0E6..0F6)-> BB14(0.1),BB19(0.9)     ( cond ) T0    try {       i IBC keep bwd
BB19 [0033]  1  0    BB10                  5.17  931 [0F6..???)-> BB11(1)                 (always) T0                IBC internal
BB11 [0004]  2  0    BB12,BB19            27.23 4902 [0F6..101)-> BB20(0.1),BB12(0.9)     ( cond ) T0                i IBC bwd bwd-target
BB12 [0005]  1  0    BB11                 24.51 4411 [101..109)-> BB11(0.9),BB20(0.1)     ( cond ) T0    }           i IBC bwd bwd-src
BB13 [0007]  1     0                       0.00    0 [10B..114)-> BB14(1)                 ( cret )    H0 catch { }   i IBC keep bwd
BB20 [0034]  2       BB11,BB12             5.17  931 [114..???)-> BB14(1)                 (always)                   IBC internal
BB14 [0008]  3       BB10,BB13,BB20        5.75 1035 [114..121)-> BB09(0.48),BB15(0.52)   ( cond )                   i IBC bwd bwd-src
BB15 [0009]  2       BB01,BB14             3.51  632 [121..129)-> BB09(0.9),BB16(0.1)     ( cond )                   i IBC bwd bwd-src
BB16 [0010]  2       BB09,BB15             0.99  178 [129..1D0)                           (return)                   i IBC hascall gcsafe newobj
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

The Gauss-Seidel solver stops a few iterations short of fixing the inconsistency because the stopping residual (0.002) is too high. Tightening the stopping residual to 0.001 coaxes the solver to run for more iterations such that the imbalance is fixed:

iteration 32: max residual is at BB11 : 4.907329
iteration 32: max rel residual is at BB09 : 0.0009970077
converged at iteration 32 rel residual 0.0009970077 eigenvalue 0.8520301
fgCalledCount is 180
Checking Profile Weights (flags:0x24)
Profile is self-consistent (11 profiled blocks, 0 unprofiled)

*************** Finishing PHASE Repair profile post-morph
Trees after Repair profile post-morph

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BBnum BBid ref try hnd preds           weight    IBC [IL range]   [jump]                            [EH region]        [flags]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BB01 [0000]  1                             1     180 [000..0DC)-> BB15(0.52),BB09(0.48)   ( cond )                   i IBC
BB09 [0001]  3       BB01,BB14,BB15        6.42 1156 [0DC..0E6)-> BB16(0.1),BB10(0.9)     ( cond )                   i IBC bwd bwd-target
BB10 [0003]  1  0    BB09                  5.78 1040 [0E6..0F6)-> BB14(0.1),BB19(0.9)     ( cond ) T0    try {       i IBC keep bwd
BB19 [0033]  1  0    BB10                  5.20  936 [0F6..???)-> BB11(1)                 (always) T0                IBC internal
BB11 [0004]  2  0    BB12,BB19            27.37 4927 [0F6..101)-> BB20(0.1),BB12(0.9)     ( cond ) T0                i IBC bwd bwd-target
BB12 [0005]  1  0    BB11                 24.63 4434 [101..109)-> BB11(0.9),BB20(0.1)     ( cond ) T0    }           i IBC bwd bwd-src
BB13 [0007]  1     0                       0.00    0 [10B..114)-> BB14(1)                 ( cret )    H0 catch { }   i IBC keep bwd
BB20 [0034]  2       BB11,BB12             5.20  936 [114..???)-> BB14(1)                 (always)                   IBC internal
BB14 [0008]  3       BB10,BB13,BB20        5.78 1040 [114..121)-> BB09(0.48),BB15(0.52)   ( cond )                   i IBC bwd bwd-src
BB15 [0009]  2       BB01,BB14             3.52  634 [121..129)-> BB09(0.9),BB16(0.1)     ( cond )                   i IBC bwd bwd-src
BB16 [0010]  2       BB09,BB15             0.99  179 [129..1D0)                           (return)                   i IBC hascall gcsafe newobj
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

@AndyAyersMS does increasing the number of solver iterations seem like the right approach to you?

@AndyAyersMS
Copy link
Member

Seems ok to me, these cases should be relatively rare.

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 blocking-clean-ci-optional Blocking optional rolling runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants