[PATCH] D156835: CoroFrame: Rework SuspendCrossingInfo analysis

witstorm via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 22:43:07 PDT 2023


witstorm95 added a comment.

In D156835#4552575 <https://reviews.llvm.org/D156835#4552575>, @witstorm95 wrote:

> In D156835#4552147 <https://reviews.llvm.org/D156835#4552147>, @MatzeB wrote:
>
>> Publishing an alternative to D154695 <https://reviews.llvm.org/D154695> here. I got somewhat nerd-snipet yesterday in trying to prove that RPOs work perfectly fine and lead to clean code...
>
> It work well at testcase in https://github.com/llvm/llvm-project/issues/62348. But if we add some loops to generate more complex CFG, It takes a long time on suspendCrossingInfo analysis. The modification about gen2.cpp as follow,
>
>   #include <cassert>
>   #include <cstdio>
>   #include <cstdlib>
>   
>   int main(int argc, char **argv) {
>     assert(argc == 2);
>     int n = atoi(argv[1]);
>     printf("#include <cstdio>\n");
>     printf("#include <vector>\n");
>     printf("#include \"task.h\"\n");
>     printf("extern bool count(int);\n");
>     printf("task t() {\n");
>     printf("std::vector<int> v(%d);\n", n);
>     printf("int val = 0;\n");
>     printf("for (int i = 0; i < %d; ++i) {;\n", n);
>     for (int i = 1; i <= n; i++) printf("if (count(v[i])) val++;\n");
>     printf("}\n");
>     printf("printf(\"%%d\\n\", val);\n");
>     printf("co_return;\n");
>     printf("}\n");
>     return 0;
>   }
>
> It takes 9 mins when n = 20000.

https://reviews.llvm.org/D156850 <https://reviews.llvm.org/D156850>
I create another NFC patch to fixed this issue. And the result is,

  n: 20000
  6.29user 0.43system 0:06.72elapsed 99%CPU (0avgtext+0avgdata 1065792maxresident)k
  0inputs+16816outputs (0major+256284minor)pagefaults 0swaps
  
  n: 40000
  13.17user 1.14system 0:14.31elapsed 99%CPU (0avgtext+0avgdata 3787144maxresident)k
  0inputs+33536outputs (0major+932693minor)pagefaults 0swaps
  
  n: 60000
  20.32user 2.16system 0:22.50elapsed 99%CPU (0avgtext+0avgdata 8262256maxresident)k
  0inputs+50256outputs (0major+2045494minor)pagefaults 0swaps
  
  n: 80000
  29.12user 3.85system 0:32.98elapsed 99%CPU (0avgtext+0avgdata 14499404maxresident)k
  8inputs+66976outputs (0major+3596571minor)pagefaults 0swaps
  
  n: 100000
  37.64user 6.01system 0:43.65elapsed 99%CPU (0avgtext+0avgdata 22475628maxresident)k
  0inputs+83696outputs (0major+5582433minor)pagefaults 0swaps


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156835



More information about the llvm-commits mailing list