[PATCH] D154695: [Coroutines] Add an O(n) algorithm for computing the cross suspend point information.

witstorm via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 22:13:52 PDT 2023


witstorm95 added a comment.

In D154695#4487690 <https://reviews.llvm.org/D154695#4487690>, @witstorm95 wrote:

> In D154695#4484439 <https://reviews.llvm.org/D154695#4484439>, @ChuanqiXu wrote:
>
>> Also for correctness, it is recommended to run this with folly library with coroutines enabled to make sure we don't get things wrong.
>
> I have tested folly library. The results are the same before and after this patch. But there still exists some fail. Maybe it's because I use WSL2. Here are the failed cases:
> The following tests FAILED:
>
>   245 - heap_vector_types_test.HeapVectorTypes.GrowthPolicy (Failed)
>   1362 - HHWheelTimerTest.HHWheelTimerTest.FireOnce (Failed)
>   1366 - HHWheelTimerTest.HHWheelTimerTest.CancelTimeout (Failed)
>   1368 - HHWheelTimerTest.HHWheelTimerTest.SlowFast (Failed)
>   1369 - HHWheelTimerTest.HHWheelTimerTest.ReschedTest (Failed)
>   1370 - HHWheelTimerTest.HHWheelTimerTest.DeleteWheelInTimeout (Failed)
>   1371 - HHWheelTimerTest.HHWheelTimerTest.DefaultTimeout (Failed)
>   1375 - HHWheelTimerTest.HHWheelTimerTest.IntrusivePtr (Failed)
>   1487 - lang_exception_test.ExceptionTest.terminate_with_direct (Failed)
>   1488 - lang_exception_test.ExceptionTest.terminate_with_variadic (Failed)
>
> And failed reason is 'unable to determine jiffies/second: failed to parse kernel release string "5.15.90.1-microsoft-standard-WSL2"'.

To make sure I enable coroutine, I write a case to check it. Here is code,

#include <folly/experimental/coro/Task.h>
#include <folly/experimental/coro/BlockingWait.h>
#include <folly/futures/Future.h>
#include <folly/executors/GlobalExecutor.h>
#include <folly/init/Init.h>
#include <iostream>

folly::coro::Task<int> slow() {

  std::cout << "before sleep" << std::endl;
  co_await folly::futures::sleep(std::chrono::seconds{1});
  std::cout << "after sleep" << std::endl;
  co_return 1;

}

int main(int argc, char** argv) {

  std::cout << FOLLY_HAS_COROUTINES << std::endl;
  folly::init(&argc, &argv);
  folly::coro::blockingWait(
      slow().scheduleOn(folly::getGlobalCPUExecutor().get()));
  return 0;

}

And the result is,
1
before sleep
after sleep


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154695/new/

https://reviews.llvm.org/D154695



More information about the llvm-commits mailing list