r600/sfn: Don't scan the whole block for ready instructions
authorGert Wollny <gert.wollny@collabora.com>
Tue, 23 Aug 2022 13:35:06 +0000 (15:35 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 26 Aug 2022 08:27:42 +0000 (08:27 +0000)
Limit the number of tested instructions and the number of
ready instructions that might be taken into account.

This reduces the time needed to run the scheduler significantly.

Fixes: 79ca456b4837b3bc21cf9ef3c03c505c4b4909f6
   r600/sfn: rewrite NIR backend

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18212>

src/gallium/drivers/r600/sfn/sfn_scheduler.cpp

index ea742f9..abeac56 100644 (file)
@@ -913,7 +913,8 @@ bool BlockSheduler::collect_ready_type(std::list<T *>& ready, std::list<T *>& av
    auto i = available.begin();
    auto e = available.end();
 
-   while (i != e) {
+   int lookahead = 16;
+   while (i != e && ready.size() < 16 && lookahead-- > 0) {
       if ((*i)->ready()) {
          ready.push_back(*i);
          auto old_i = i;