Mesa (main): pan/bi: Use bi_worklist in analyze_helper_requirements

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 3 18:20:09 UTC 2022


Module: Mesa
Branch: main
Commit: 44f2715777436cc7ef1ae2c7288dc47e1d094b6b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44f2715777436cc7ef1ae2c7288dc47e1d094b6b

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Apr 19 13:35:19 2022 -0400

pan/bi: Use bi_worklist in analyze_helper_requirements

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16279>

---

 src/panfrost/bifrost/bi_helper_invocations.c | 32 ++++++++++------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/panfrost/bifrost/bi_helper_invocations.c b/src/panfrost/bifrost/bi_helper_invocations.c
index 327f2d59bab..fb2f1ccda2f 100644
--- a/src/panfrost/bifrost/bi_helper_invocations.c
+++ b/src/panfrost/bifrost/bi_helper_invocations.c
@@ -231,33 +231,23 @@ bi_analyze_helper_requirements(bi_context *ctx)
         }
 
         /* Propagate that up */
+        u_worklist worklist;
+        bi_worklist_init(ctx, &worklist);
 
-        struct set *work_list = _mesa_set_create(NULL,
-                        _mesa_hash_pointer,
-                        _mesa_key_pointer_equal);
-
-        struct set *visited = _mesa_set_create(NULL,
-                        _mesa_hash_pointer,
-                        _mesa_key_pointer_equal);
-
-        struct set_entry *cur = _mesa_set_add(work_list, pan_exit_block(&ctx->blocks));
-
-        do {
-                bi_block *blk = (struct bi_block *) cur->key;
-                _mesa_set_remove(work_list, cur);
+        bi_foreach_block(ctx, block) {
+                bi_worklist_push_tail(&worklist, block);
+        }
 
-                bool progress = bi_helper_block_update(deps, blk);
+        while (!u_worklist_is_empty(&worklist)) {
+                bi_block *blk = bi_worklist_pop_tail(&worklist);
 
-                if (progress || !_mesa_set_search(visited, blk)) {
+                if (bi_helper_block_update(deps, blk)) {
                         bi_foreach_predecessor(blk, pred)
-                                _mesa_set_add(work_list, pred);
+                                bi_worklist_push_head(&worklist, pred);
                 }
+        }
 
-                _mesa_set_add(visited, blk);
-        } while((cur = _mesa_set_next_entry(work_list, NULL)) != NULL);
-
-        _mesa_set_destroy(visited, NULL);
-        _mesa_set_destroy(work_list, NULL);
+        u_worklist_fini(&worklist);
 
         /* Set the execute bits */
 



More information about the mesa-commit mailing list