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

JIT: Propagate profile flags to loop preheaders in Compiler::optCloneLoops #102897

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

amanasifkhalid
Copy link
Member

Fixes missing profile data issue mentioned in #102763 (comment).

@AndyAyersMS PTAL, thank you!

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 30, 2024
Copy link
Contributor

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

@amanasifkhalid
Copy link
Member Author

The layout mentioned here is unchanged, but the IBC data is now present:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BBnum BBid ref try hnd preds           weight       IBC [IL range]   [jump]                            [EH region]        [flags]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
BB01 [0000]  1                             1      22372 [000..003)-> BB03(1),BB02(0)         ( cond )                     i IBC
BB03 [0002]  1       BB01                  1      22372 [00A..00D)-> BB45(0),BB04(1)         ( cond )                     i IBC
BB04 [0003]  1       BB03                  1      22372 [00D..00D)-> BB06(0),BB05(1)         ( cond )                     i IBC
BB05 [0032]  1       BB04                  1      22372 [???..???)-> BB07(1)                 (always)                     i IBC internal hascall gcsafe
BB07 [0031]  2       BB05,BB06             1      22372 [00D..014)-> BB08(1)                 (always)                     i IBC internal
BB08 [0004]  1  0    BB07                  1      22372 [014..016)-> BB22(0.01),BB10(0.99)   ( cond ) T0      try {       i IBC keep
BB10 [0085]  1  0    BB08                  1      22372 [???..???)-> BB22(0.01),BB11(0.99)   ( cond ) T0                  IBC internal
BB11 [0072]  1  0    BB10                  1      22372 [???..???)-> BB17(1)                 (always) T0                  IBC internal
BB17 [0007]  2  0    BB11,BB14           100.25 2242790 [02F..030)-> BB20(0.00976),BB19(0.99)  ( cond ) T0                  i IBC bwd bwd-src
BB19 [0059]  1  0    BB17                 99.27 2220900 [016..030)-> BB14(1),BB34(0)         ( cond ) T0                  i IBC bwd
BB14 [0046]  1  0    BB19                 99.26 2220641 [016..02B)-> BB17(1),BB37(0)         ( cond ) T0                  i IBC idxlen bwd
BB20 [0060]  1  0    BB17                  0.98   21890 [02F..030)-> BB41(1)                 (always) T0                  i IBC bwd
BB28 [0079]  2  0    BB22,BB27             1.01   22654 [02F..02F)-> BB32(0),BB29(1)         ( cond ) T0                  i IBC bwd bwd-src
BB29 [0080]  1  0    BB28                  1.01   22654 [02F..030)-> BB31(0.00976),BB30(0.99)  ( cond ) T0                  i IBC bwd
BB30 [0081]  1  0    BB29                  1.00   22433 [016..030)-> BB25(1),BB34(0)         ( cond ) T0                  i IBC bwd
BB25 [0076]  1  0    BB30                  1.00   22431 [016..017)-> BB27(1)                 (always) T0                  i IBC idxlen bwd
BB31 [0082]  1  0    BB29                  0.01     221 [02F..030)-> BB41(1)                 (always) T0                  i IBC bwd
BB27 [0078]  2  0    BB25,BB26             1.00   22431 [016..02B)-> BB28(1),BB37(0)         ( cond ) T0                  i IBC bwd
BB22 [0073]  2  0    BB08,BB10             0          0 [???..???)-> BB28(1)                 (always) T0                  IBC rare internal
BB34 [0090]  2  0    BB19,BB30             0          0 [016..017)                           (throw ) T0                  i IBC rare gcsafe bwd
BB32 [0083]  1  0    BB28                  0          0 [02F..037)-> BB26(0.99),BB41(0.00988)  ( cond ) T0                  i IBC rare internal hascall bwd
BB26 [0077]  1  0    BB32                  0          0 [???..???)-> BB27(1)                 (always) T0                  i IBC rare internal hascall gcsafe bwd
BB37 [0091]  2  0    BB14,BB27             0          0 [02B..02F)-> BB43(1)                 (always) T0                  i IBC rare bwd
BB62 [0092]  0  0                          0            [???..???)                           (throw ) T0      }           i rare keep internal
BB41 [0063]  3       BB20,BB31,BB32        1.00   22372 [039..03C)-> BB53(1),BB42(0)         ( cond )                     i IBC keep cfb
BB46 [0013]  2  1    BB45,BB47             0          0 [04A..06B)-> BB47(0.9),BB50(0.1)     ( cond ) T1      try {       i IBC rare keep bwd
BB47 [0014]  1  1    BB46                  0          0 [04C..05F)-> BB46(0.9),BB49(0.1)     ( cond ) T1                  i IBC rare loophead hascall gcsafe bwd bwd-target
BB49 [0015]  1  1    BB47                  0          0 [05F..063)-> BB51(1)                 (always) T1      }           i IBC rare bwd
BB53 [0021]  3       BB41,BB42,BB50        1.00   22372 [077..079)                           (return)                     i IBC
BB06 [0033]  1       BB04                  0          0 [???..???)-> BB07(1)                 (always)                     i IBC rare internal hascall gcsafe
BB43 [0027]  1       BB37                  0          0 [???..???)-> BB55(1)                 (callf )                     i IBC rare internal
BB44 [0028]  1       BB58                  0          0 [???..???)-> BB54(1)                 (callfr)                     i IBC rare internal xentry
BB42 [0066]  1       BB41                  0          0 [???..???)-> BB53(1)                 (always)                     i IBC rare internal hascall gcsafe
BB45 [0012]  1       BB03                  0          0 [043..04A)-> BB46(1)                 (always)                     i IBC rare hascall gcsafe
BB51 [0023]  1       BB49                  0          0 [???..???)-> BB59(1)                 (callf )                     i IBC rare internal
BB52 [0024]  1       BB61                  0          0 [???..???)-> BB54(1)                 (callfr)                     i IBC rare internal xentry
BB54 [0022]  2       BB44,BB52             0          0 [079..07B)                           (return)                     i IBC rare
BB50 [0069]  1       BB46                  0          0 [06D..077)-> BB53(1)                 (always)                     i IBC rare keep gcsafe cfb
BB02 [0001]  1       BB01                  0          0 [003..00A)                           (throw )                     i IBC rare hascall gcsafe
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ funclets follow
BB55 [0009]  2     0 BB43                  0.00       0 [039..03C)-> BB58(0.000995),BB56(0.999)    ( cond )    H0 F finally {   i IBC keep xentry flet
BB56 [0010]  1     0 BB55                  0.00       0 [03C..???)-> BB58(1),BB57(0)         ( cond )    H0               i IBC xentry
BB57 [0042]  1     0 BB56                  0          0 [???..???)-> BB58(1)                 (always)    H0               i IBC rare internal hascall xentry gcsafe
BB58 [0040]  3     0 BB55,BB56,BB57        0.00       0 [042..043)-> BB44(0.5)               (finret)    H0   }           i IBC xentry
BB59 [0018]  2     1 BB51                  0.00       0 [06D..070)-> BB61(0.48),BB60(0.52)   ( cond )    H1 F finally {   i IBC keep xentry flet
BB60 [0019]  1     1 BB59                  0.00       0 [070..076)-> BB61(1)                 (always)    H1               i IBC hascall xentry gcsafe
BB61 [0020]  2     1 BB59,BB60             0.00       0 [076..077)-> BB52(0.5)               (finret)    H1   }           i IBC xentry
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

@amanasifkhalid
Copy link
Member Author

Small diffs

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ambientWeight computation seems wrong-headed when PGO is involved. We should not need to do any depth scaling.

Can you open an issue so we remember to rework this?

It will also be flagged by profile consistency checking, once we get it running on later phases.

@amanasifkhalid
Copy link
Member Author

Can you open an issue so we remember to rework this?

Sure thing: #103001.

@amanasifkhalid
Copy link
Member Author

SPMI failure is unrelated.

@amanasifkhalid amanasifkhalid merged commit 495e581 into dotnet:main Jun 3, 2024
105 of 107 checks passed
@LoopedBard3
Copy link
Member

LoopedBard3 commented Jun 11, 2024

Potentially related regression:
Windows x64: dotnet/perf-autofiling-issues#36064
Linux x64: dotnet/perf-autofiling-issues#36051

FYI: @amanasifkhalid

@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants