Mesa (main): nouveau/nv50: Print the number of loops in shader-db output.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 20 22:13:39 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Feb 28 22:25:52 2022 -0800

nouveau/nv50: Print the number of loops in shader-db output.

This is important so you don't go comparing the number of instructions
emitted when you unrolled loops differently.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16063>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h      | 1 +
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp  | 2 ++
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 2 ++
 src/gallium/drivers/nouveau/nv50/nv50_program.c           | 4 ++--
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index 2a81eceb2e5..0e350ce099b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -160,6 +160,7 @@ struct nv50_ir_prog_info_out
    uint8_t numOutputs;
    uint8_t numPatchConstants; /* also included in numInputs/numOutputs */
    uint8_t numSysVals;
+   uint32_t loops;
 
    union {
       struct {
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 192f2f59c1b..ac6f3a7726e 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -1534,6 +1534,8 @@ Converter::visit(nir_loop *loop)
 
    curLoopDepth -= 1;
 
+   info_out->loops++;
+
    return true;
 }
 
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index d843d676da0..a597e82255a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -3674,6 +3674,8 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
       bb->cfg.attach(&lbgnBB->cfg, Graph::Edge::TREE);
       setPosition(lbgnBB, true);
       mkFlow(OP_PRECONT, lbgnBB, CC_ALWAYS, NULL);
+
+      info_out->loops++;
    }
       break;
    case TGSI_OPCODE_ENDLOOP:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 60081c665fe..dd67a19d30c 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -453,9 +453,9 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
                                                    &prog->pipe.stream_output);
 
    util_debug_message(debug, SHADER_INFO,
-                      "type: %d, local: %d, shared: %d, gpr: %d, inst: %d, bytes: %d",
+                      "type: %d, local: %d, shared: %d, gpr: %d, inst: %d, loops: %d, bytes: %d",
                       prog->type, info_out.bin.tlsSpace, info_out.bin.smemSize,
-                      prog->max_gpr, info_out.bin.instructions,
+                      prog->max_gpr, info_out.bin.instructions, info_out.loops,
                       info_out.bin.codeSize);
 
 out:



More information about the mesa-commit mailing list