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

Disabling disasm checks under certain testing environments #76202

Merged
merged 10 commits into from
Sep 27, 2022

Conversation

TIHan
Copy link
Contributor

@TIHan TIHan commented Sep 26, 2022

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost assigned TIHan Sep 26, 2022
@TIHan
Copy link
Contributor Author

TIHan commented Sep 26, 2022

@dotnet/jit-contrib @EgorBo This is ready.

@danmoseley danmoseley added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 26, 2022
@ghost
Copy link

ghost commented Sep 26, 2022

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

Issue Details

Should resolve:

Description

We need to disable disasm checks if we are running under GCStress, TieredPGO, R2R, or on linux-musl(alpine).

Author: TIHan
Assignees: TIHan
Labels:

area-CodeGen-coreclr

Milestone: -

@markples
Copy link
Member

Are these being disabled because we don't want to test in those scenarios or because it will take more work to test them correctly? In other words, should we open work items to enable them?

@@ -222,7 +222,10 @@ IF NOT DEFINED DoLink (
DependsOnTargets="GetDisasmCheckData">
<PropertyGroup>
<HasBashDisasmCheck>false</HasBashDisasmCheck>
<HasBashDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and ('$(TargetOS)' == 'Linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')">true</HasBashDisasmCheck>
<HasBashDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and ('$(TargetOS)' == 'Linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64') and '$(RunCrossGen2)' != 'true'">true</HasBashDisasmCheck>
Copy link
Member

Choose a reason for hiding this comment

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

I think you could fold the RunCrossGen2 check into GetDisasmCheckData and then not duplicate it on the bash/batch sides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I can also do the setting of GCStressIncompatible/HeapVerifyIncompatible well too.

Copy link
Member

@markples markples Sep 27, 2022

Choose a reason for hiding this comment

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

<EDIT: removed my comment about the Incompatible vars because it was wrong>

<HasBashDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and ('$(TargetOS)' == 'Linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64') and '$(RunCrossGen2)' != 'true'">true</HasBashDisasmCheck>

<GCStressIncompatible Condition="'$(HasBashDisasmCheck)' == 'true'">true</GCStressIncompatible>
<HeapVerifyIncompatible Condition="'$(HasBashDisasmCheck)' == 'true'">true</HeapVerifyIncompatible>
Copy link
Member

Choose a reason for hiding this comment

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

I am curious to know the restrictions here. I thought these "just" impacted the runtime - do they change the codegen and therefore the disasm output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure - we should probably ask.
@AndyAyersMS - Does GCStress/HeapVerify impact codegen at all?

Copy link
Member

Choose a reason for hiding this comment

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

To be clear - ok to disable and merge - just wondering about the future steps

<BashDisasmCheckPostCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
if [[ -n $COMPlus_JitDisasm ]]; then
@(DisasmCheckFiles -> ' dotnet $CORE_ROOT/SuperFileCheck/SuperFileCheck.dll --csharp "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) --dump-input-context 25 --input-file "$(BashDisasmOutputFile)"
if [[ ( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" ) ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

This list is repeated four times, which will be difficult to maintain. For each of bash/batch, the two could be combined to one by defining a variable and using it in the two ifs.

Bash vs batch is difficult because the syntax is different. So perhaps instead of the above suggestion, the condition strings could be separately defined in msbuild variables and included twice in each script. Then those msbuild variables could be defined back-to-back so that it is clear that if you change one you need to change the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll see if I can clean it up - I'm just so afraid of getting the syntaxes wrong for each of them.

Copy link
Member

Choose a reason for hiding this comment

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

If you have a clean test run, merge without this to unblock outerloop, but please factor this afterwards.

I don't think it's too bad because you already have the script syntax. Something like

<PropertyGroup>
  <DisasmBashCondition>(<![CDATA[( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" )]]></DisasmBashCondition>
  <DisasmBatchCondition>"%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_TailcallStress%"=="" IF NOT "%COMPlus_TieredPGO%" == "1"</DisasmBatchCondition>
</PropertyGroup>

Then the if lines:

if [[ $(DisasmBashCondition) ]]; then
IF $(DisasmBatchCondition) (

@TIHan
Copy link
Contributor Author

TIHan commented Sep 26, 2022

Are these being disabled because we don't want to test in those scenarios or because it will take more work to test them correctly? In other words, should we open work items to enable them?

For right now, we should only enable disasm checks for test modes that have predictable codegen.

@markples
Copy link
Member

markples commented Sep 27, 2022

For right now, we should only enable disasm checks for test modes that have predictable codegen.

I think these are all predictable, except perhaps tiering (not sure if available information can impact the codegen) and the timing and whether the next tier happens can vary by execution in some ways.

But they are different from "normal optimized", which perhaps is what you mean for "right now"?

EDIT - also fine to disable for now even if it should work - I just want to know what is expected, what the next steps are, etc.

@TIHan
Copy link
Contributor Author

TIHan commented Sep 27, 2022

I just want to know what is expected, what the next steps are, etc.

  1. Unblock outerloop runs
  2. Document limitations on SuperFileCheck and disasm checking(including why we don't run for gcstress/jitstress/etc.)

For this PR, I'm waiting to see a failure on all x64 runs for the single test so I know this worked correctly. If so, I'll fix the test and hopefully we can get this merged in ASAP.

@markples
Copy link
Member

...
2. Document limitations on SuperFileCheck and disasm checking(including why we don't run for gcstress/jitstress/etc.)
...

Yes, this is what I'm asking about (and what the future work is to enable scenarios that ought to already work vs add new scenarios)

Copy link
Member

@markples markples left a comment

Choose a reason for hiding this comment

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

approving but I believe you need to fix the two Incompatible vars by either not putting them in the other Target or modifying it to Return them as I wrote in the comment before it will work fully

@TIHan
Copy link
Contributor Author

TIHan commented Sep 27, 2022

I believe you need to fix the two Incompatible vars

I'll make a separate PR for those.

@TIHan
Copy link
Contributor Author

TIHan commented Sep 27, 2022

CI is clean, failure is unrelated.

@TIHan TIHan merged commit c6f5267 into dotnet:main Sep 27, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 27, 2022
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