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

Enable assert in perfScoreUnhandledInstruction #810

Merged
merged 6 commits into from
Mar 3, 2020

Conversation

briansull
Copy link
Contributor

perfScoreUnhandledInstruction will now assert in a DEBUG or CHECKED build when it encounters an unhanded instruction

@briansull
Copy link
Contributor Author

Related to PR #751

@briansull
Copy link
Contributor Author

@tannergooding @BruceForstall @dotnet/jit-contrib PTAL

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

Can you make sure to run outerloop and outerloop stress jobs? I wouldn't want this to cause new asserts to show up, especially as we aren't actively monitoring all the various pipelines yet.

@briansull
Copy link
Contributor Author

I am leaving this PR open as I will be leaving for a vacation shortly.

@sandreenko sandreenko added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 18, 2019
@briansull
Copy link
Contributor Author

@BruceForstall I have refreshed this

@briansull
Copy link
Contributor Author

/AZP list

@briansull
Copy link
Contributor Author

/AZP runtime-coreclr outerloop

@azure-pipelines
Copy link

Command 'runtime-coreclr' is not supported by Azure Pipelines.

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@briansull
Copy link
Contributor Author

/AZP run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@briansull
Copy link
Contributor Author

There are some unhanded instructions for ARM64:

https://helix.dot.net/api/2019-06-17/jobs/25335df6-3701-444a-878f-9e5140003fcd/workitems/JIT.HardwareIntrinsics/console

Assert failure(PID 220 [0x000000dc], Thread: 220 [0x00dc]): Assertion failed '!"PerfScore: unhandled instruction"' in 'JIT.HardwareIntrinsics.Arm.SimpleBinaryOpTest__AbsoluteCompareGreaterThan_Vector128_Double:RunBasicScenario_UnsafeRead():this' (IL size 114)

@tannergooding
Copy link
Member

CC. @EgorBo, @TamarChristinaArm, @CarolEidt

@echesakov
Copy link
Contributor

echesakov commented Jan 17, 2020

@tannergooding I believe you wanted to ping me instead of Egor Bogatov. I added these instructions and I can update their perf score

@tannergooding
Copy link
Member

Yes, sorry. Auto-complete chose the wrong person 😄

Copy link
Contributor

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

My preference would be not to enable this assert. I'm not in favor of asserts that appear only when dumping or disassembling.

// and instead of returning we will assert
//
// Otherwise we will return default latencies of 1 cycle.
// Remove the assert and we return default latencies of 1 cycle.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this should be deleted, and the above comment should be clarified to say that it asserts in a DEBUG build, and returns a default latency of 1 cycle otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@briansull
Copy link
Contributor Author

People working on Arm64 instructions could just add this change-set to their enlistment to catch the missing instructions. I put this PR up because Tanner wanted to have this enabled.

@briansull
Copy link
Contributor Author

The outer loop testing printed these two missing instructions on Arm64:

PerfScore: unhandled instruction: facgt, format IF_DV_3B
PerfScore: unhandled instruction: crc32b, format IF_DR_3A

@stephentoub
Copy link
Member

@briansull, what's the status of this PR? Should it be closed? Merged? Thanks.

@briansull
Copy link
Contributor Author

@tannergooding do you still want this assert enabled by default?

@tannergooding
Copy link
Member

It would be good to get it enabled as otherwise it just represents an increasing debt we are building for ARM64 (as we continue to add more instructions for the HWIntrinsic work, etc).

At this point, it should just require adding the instructions which aren't already covered, correct? Perhaps that is something that @echesakovMSFT, @CarolEidt, or myself can pick up and finish.

@CarolEidt
Copy link
Contributor

I'm still of the opinion that we don't want asserts that fire only when dumping or disassembling. I would be OK with a COMPlus option that enables the assert.

@tannergooding
Copy link
Member

I'm still of the opinion that we don't want asserts that fire only when dumping or disassembling. I would be OK with a COMPlus option that enables the assert.

IIRC, this fell out of #751 (comment) and only wasn't enabled due to parallel work from the HWIntrinsics.
This PR would just be enabling the same validation we already have for x64.

@CarolEidt
Copy link
Contributor

My concern is with enabling an assert that only fires when I generate a dump or disassembly. This is not something we regularly do across all of our tests, and so it doesn't really add coverage. It is more likely to trip up someone who is working on something unrelated. These asserts should either be optionally enabled in dumps and disassembly (and included in some kind of stress testing) or the perfscore should always be computed for each instruction in checked builds, even when not disassembling.

@briansull
Copy link
Contributor Author

briansull commented Feb 18, 2020

The PerfScore is always computed for Checked and Debug builds, not only when you generate a dump or disassembly.

size_t emitter::emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp)
{
_..._

#if defined(DEBUG) || defined(LATE_DISASM)
    float insExeCost = insEvaluateExecutionCost(id);

@CarolEidt
Copy link
Contributor

The PerfScore is always computed for Checked and Debug builds.

I see - I'd missed that - in that case, I'm OK with this. Sorry for the confusion.

…uild when it encounters an unhanded instruction
@briansull
Copy link
Contributor Author

Rebased to a recent master:

@echesakovMSFT PTAL

set COMPlus_AltJitName=protononjit.dll
set COMPLUS_AltJitNgen=*
set COMPlus_TieredCompilation=0

crossgen.exe System.Private.CoreLib.dll
PerfScore: unhandled instruction: uminv, format IF_DV_2T
Assert failure(PID 53748 [0x0000d1f4], Thread: 55356 [0xd83c]): Assertion failed '!"PerfScore: unhandled instruction"' in 'System.Numerics.Plane:Equals(System.Numerics.Plane):bool:this' during 'Generate code' (IL size 132)

@echesakov
Copy link
Contributor

@briansull I will add perf info later today - or if you want you can do this

@briansull
Copy link
Contributor Author

@echesakovMSFT
I will look into adding them

@briansull
Copy link
Contributor Author

Added PerfScore values for IF_DV_2T: // addv, saddlv, smaxv, sminv, uaddlv, umaxv, uminv

@echesakov
Copy link
Contributor

Added PerfScore values for IF_DV_2T: // addv, saddlv, smaxv, sminv, uaddlv, umaxv, uminv

Thank you, @briansull !

@briansull
Copy link
Contributor Author

Add PerfScore support for fcmeq, fcmge, fcmgt, fcmle, fcmlt, fcvtl2, fcvtn, fcvtn2, fabd

@briansull briansull merged commit c1e17e1 into dotnet:master Mar 3, 2020
@tannergooding
Copy link
Member

Thanks @briansull!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
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.

None yet

7 participants