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

Improve tailcallstress testing #41059

Merged
merged 1 commit into from
Aug 24, 2020

Conversation

erozenfeld
Copy link
Member

  1. Dispatch all tail calls under TailCallStress via helpers. That
    increases our coverage since valid non-tail-prefixed calls are
    dispatched as fast calls in normal non-stress mode.

  2. Don't attempt to tail call from methods that have a localloc
    unless there is an explicit tail prefix. Note that we already disallowed
    fast tail calls from such methods so this change only affects
    tailcallstress mode.

  3. Fix a bug in TestInvokeDOPAndCancel. As the test was written
    this assert was firing under tailcallstress:

    Assert.False(counter == numActions, "TestInvokeDOPAndCancel: > FAILED! Cancellation+exception not effected.");

    When this call to cts.Cancel:

    is dispatched via helpers, it takes much longer than when it's
    dispatched via a fast tail call (we have to jit a couple of IL stubs).
    Because of that, it's possible that all other actions complete on the
    other thread before cancellation is completed.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 19, 2020
@erozenfeld
Copy link
Member Author

@erozenfeld
Copy link
Member Author

@AndyAyersMS @dotnet/jit-contrib PTAL
@tarekgh @danmosemsft PTAL at the test change

@tarekgh
Copy link
Member

tarekgh commented Aug 19, 2020

@erozenfeld test changes LGTM.

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.

Thanks, LGTM.

I was thinking we should make tail call stress be modal and perhaps still try and use fast tail calls in some cases (perhaps randomly under jitstress, etc). But that can wait.

1. Dispatch all tail calls under TailCallStress via helpers. That
increases our coverage since valid non-tail-prefixed calls are
dispatched as fast calls in normal non-stress mode.

2. Don't attempt to tail call from methods that have a localloc
unless there is an explicit tail prefix. Note that we already disallowed
fast tail calls from such methods so this change only affects
tailcallstress mode.

3. Fix a bug in TestInvokeDOPAndCancel. As the test was written
this assert was firing under tailcallstress:
https://github.com/dotnet/runtime/blob/480c49b2419ab4a0b34bfd86754abc2f17079c77/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs#L1074
When this call to `cts.Cancel`:
https://github.com/dotnet/runtime/blob/480c49b2419ab4a0b34bfd86754abc2f17079c77/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs#L1065
is dispatched via helpers, it takes much longer than when it's
dispatched via a fast tail call (we have to jit a couple of IL stubs).
Because of that, it's possible that all other actions complete on the
other thread before cancellation is completed.
@erozenfeld
Copy link
Member Author

erozenfeld commented Aug 21, 2020

I investigated the System.Threading.Threads.Tests.ThreadTests.ConstructorTest failure in runtime-coreclr libraries-jitstress (Windows x64) under tailcallstress: https://helix.dot.net/api/2019-06-17/jobs/d017bf2e-6058-4ed6-819f-ee589065f3a5/workitems/System.Threading.Thread.Tests/files/console.8238c349.log

The stack trace is: #40698 (comment)

The test was attempting to launch a thread with a 64kb stack and it was failing with StackOverflow. On my machine it was failing with StackOverflow even without tailcallstress. I made a change to double SmallStackSizeBytes from 64k to 128k.

@kouvel @mangod9 PTAL at the test change

@erozenfeld
Copy link
Member Author

Libraries Test Run release coreclr Windows_NT x86 Debug failures are an infrastructure issue. Ignoring since it passed on a previous run.

@erozenfeld erozenfeld merged commit ea1d20c into dotnet:master Aug 24, 2020
Copy link
Member

@kouvel kouvel left a comment

Choose a reason for hiding this comment

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

Thanks!

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

7 participants