[Mesa-dev] [RFC PATCH v2 3/6] nv50/ir: Add prog_info_out print

Mark Menzynski mmenzyns at redhat.com
Thu Mar 19 20:57:45 UTC 2020


Adds a function for printing nv50_ir_prog_info_out structure
in JSON-like format, which could be used in debugging.

Signed-off-by: Mark Menzynski <mmenzyns at redhat.com>
---
 .../nouveau/codegen/.nv50_ir_from_nir.cpp.swp | Bin 0 -> 16384 bytes
 .../drivers/nouveau/codegen/nv50_ir_driver.h  |   3 +
 .../drivers/nouveau/codegen/nv50_ir_print.cpp | 154 ++++++++++++++++++
 3 files changed, 157 insertions(+)
 create mode 100644 src/gallium/drivers/nouveau/codegen/.nv50_ir_from_nir.cpp.swp

diff --git a/src/gallium/drivers/nouveau/codegen/.nv50_ir_from_nir.cpp.swp b/src/gallium/drivers/nouveau/codegen/.nv50_ir_from_nir.cpp.swp
new file mode 100644
index 0000000000000000000000000000000000000000..c405065a5df6c33ee4f0439c30c474d446b87730
GIT binary patch
literal 16384
zcmeHOYmgjO6>bBHf+(U`l!A4$5!hXaojg#f-DJt^>}<A+*_o}G*^NP@>FK^R)263;
z=*Mn0F;N7|@&{n4WtEm?DVBv&md`4+)c+9$@lpCm at dx4q4T2IBQPl6;dwU+8O|n1y
zW%X9R>`b3~&pnU(IOp`;=FU}piQPE0Tf@&~ns(*=bGKb~)t9u_-J)sTF87XZcp;I_
z_2c at M>2~}uni8LEziT?)CLK;B4D&VK^Ft@{1BZwCE)UIo7+CqX>AFtb&D(*q#)B~L
z`SBVz<GkhDyv at D5xAxYZh7%aA!0#HK6HHmX-X_Cjk1`8n7TDARmuh=<@7hVE9b?<s
zYcF5fv{m*nvp{Bn%mSGOG7DrD$SjaqAhSSbf&WhnM7=j@?}cjHlzJ`o`z5L0|4~05
zP|w>b`o9(Z9`*cGivFUa->aT)r~#63{-x-L75yS5P(uHwqTi|LL5lu at qTi?J&!*`A
zQ1n32-+zJpknn$A(Qi}q(<%Dj6 at 5+7YZs38|C^$}OVPidqCcnT#})mWmyY&7t>{V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hC144^Ifu>It0*E>g#n3I}42k4Ys^J0=K7+BW<%*io<ODUAD#~K>42nS*=*%Bg
zusNf`B#TM?F*Q}2nx5{Ohxr2jinOBF#?RK7O$w1U(tNmxqDEmTrU(bd9=XsSIC9j1
zcq;(UXb at Udr=;+zMkQX%Bt8%pUvuzhvE!}S6Pd?^Fg;lbZx1+XnnptDHxbsIAYmkD
zYK%f1s$R(KP<bPRBKe8%k!qc2MB`Ao?fO}}*<NtXcF3+}l~w#{tzI+cOLHp+jJZNx
zFHVdIy_v+NTCG|eA1nH?YkSw>l?gJ-Hfr`%WZQnLH#Qh=yCl^``E4Q*H!;Xoc=rOl
z8)5KQiZR~Jgq+;i=Smg`*E#Qz>QV$Ovjb+(G~1LLyYvEsl0QmyrSs{fjnEd1jO9YT
zZmdeX5id2HWkm{wd8Ax$sbsua`+#?mgrgXQ+WVRrIP{tYFLj6&zV<z6M7*o2>zi>A
zD-<<fyc-LR$Tv{!S4;Wqt!buGTX=uZZU{);K8_3;^(X0atY^gpl!T9%3`9{2l?27x
zBB_AYl8SDny`_wDp0<=MV~QrP7S7X}B!LG+2?VRawUOIyStQeK^JZW=)|Pu%$&1o0
zh=uyV8mclRUgUT&- at 0kl6zTQ1=kttqrpagllh2a(RbpkME+hAW#I?iISWYM!lBS4!
I=L)m at 7rk>&Q2+n{

literal 0
HcmV?d00001

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index eea32133ccf..10ae5cbe420 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -275,6 +275,9 @@ namespace nv50_ir
 }
 #endif
 
+extern void
+nv50_ir_prog_info_out_print(struct nv50_ir_prog_info_out *);
+
 /* Serialize a nv50_ir_prog_info_out structure and save it into blob */
 extern bool
 nv50_ir_prog_info_out_serialize(struct blob *, struct nv50_ir_prog_info_out *);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index 5dcbf3c3e0c..2c13bef5e1a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -22,6 +22,7 @@
 
 #include "codegen/nv50_ir.h"
 #include "codegen/nv50_ir_target.h"
+#include "codegen/nv50_ir_driver.h"
 
 #include <inttypes.h>
 
@@ -852,3 +853,156 @@ Function::printLiveIntervals() const
 }
 
 } // namespace nv50_ir
+
+extern void
+nv50_ir_prog_info_out_print(struct nv50_ir_prog_info_out *info_out)
+{
+   int i;
+
+   INFO("{\n");
+   INFO("   \"target\":\"%d\",\n", info_out->target);
+   INFO("   \"type\":\"%d\",\n", info_out->type);
+
+   // Bin
+   INFO("   \"bin\":{\n");
+   INFO("      \"maxGPR\":\"%d\",\n", info_out->bin.maxGPR);
+   INFO("      \"tlsSpace\":\"%d\",\n", info_out->bin.tlsSpace);
+   INFO("      \"smemSize\":\"%d\",\n", info_out->bin.smemSize);
+   INFO("      \"codeSize\":\"%d\",\n", info_out->bin.codeSize);
+   INFO("      \"instructions\":\"%d\",\n", info_out->bin.instructions);
+
+   // RelocInfo
+   INFO("      \"RelocInfo\":");
+   if (!info_out->bin.relocData) {
+      INFO("\"NULL\",\n");
+   } else {
+      nv50_ir::RelocInfo *reloc = (nv50_ir::RelocInfo *)info_out->bin.relocData;
+      INFO("{\n");
+      INFO("         \"codePos\":\"%d\",\n", reloc->codePos);
+      INFO("         \"libPos\":\"%d\",\n", reloc->libPos);
+      INFO("         \"dataPos\":\"%d\",\n", reloc->dataPos);
+      INFO("         \"count\":\"%d\",\n", reloc->count);
+      INFO("         \"RelocEntry\":[\n");
+      for (unsigned int i = 0; i < reloc->count; i++) {
+         INFO("            {\"data\":\"%d\",\t\"mask\":\"%d\",\t\"offset\":\"%d\",\t\"bitPos\":\"%d\",\t\"type\":\"%d\"}",
+                   reloc->entry[i].data, reloc->entry[i].mask, reloc->entry[i].offset, reloc->entry[i].bitPos, reloc->entry[i].type
+                   );
+      }
+      INFO("\n");
+      INFO("         ]\n");
+      INFO("      },\n");
+   }
+
+   // FixupInfo
+   INFO("      \"FixupInfo\":");
+   if (!info_out->bin.fixupData) {
+      INFO("\"NULL\"\n");
+   } else {
+      nv50_ir::FixupInfo *fixup = (nv50_ir::FixupInfo *)info_out->bin.fixupData;
+      INFO("{\n");
+      INFO("         \"count\":\"%d\"\n", fixup->count);
+      INFO("         \"FixupEntry\":[\n");
+      for (unsigned int i = 0; i < fixup->count; i++) {
+         INFO("            {\"apply\":\"%p\",\t\"ipa\":\"%d\",\t\"reg\":\"%d\",\t\"loc\":\"%d\"}\n",
+                   fixup->entry[i].apply, fixup->entry[i].ipa, fixup->entry[i].reg, fixup->entry[i].loc);
+      }
+      INFO("\n");
+      INFO("         ]\n");
+      INFO("      }\n");
+
+      INFO("   },\n");
+   }
+
+   if (info_out->numSysVals) {
+      INFO("   \"sv\":[\n");
+      for (i = 0; i < info_out->numSysVals; i++) {
+         if (&(info_out->sv[i])) {
+            INFO("      {\"id\":\"%d\", \"sn\":\"%d\", \"si\":\"%d\"}\n",
+                   info_out->sv[i].id, info_out->sv[i].sn, info_out->sv[i].si);
+         }
+      }
+      INFO("\n   ],\n");
+   }
+   if (info_out->numInputs) {
+      INFO("   \"in\":[\n");
+      for (i = 0; i < info_out->numInputs; i++) {
+         if (&(info_out->in[i])) {
+            INFO("      {\"id\":\"%d\",\t\"sn\":\"%d\",\t\"si\":\"%d\"}\n",
+                info_out->in[i].id, info_out->in[i].sn, info_out->in[i].si);
+         }
+      }
+      INFO("\n   ],\n");
+   }
+   if (info_out->numOutputs) {
+      INFO("   \"out\":[\n");
+      for (i = 0; i < info_out->numOutputs; i++) {
+         if (&(info_out->out[i])) {
+            INFO("      {\"id\":\"%d\",\t\"sn\":\"%d\",\t\"si\":\"%d\"}\n",
+                   info_out->out[i].id, info_out->out[i].sn, info_out->out[i].si);
+         }
+      }
+      INFO("\n   ],\n");
+   }
+
+   INFO("   \"numInputs\":\"%d\",\n", info_out->numInputs);
+   INFO("   \"numOutputs\":\"%d\",\n", info_out->numOutputs);
+   INFO("   \"numPatchConstants\":\"%d\",\n", info_out->numPatchConstants);
+   INFO("   \"numSysVals\":\"%d\",\n", info_out->numSysVals);
+
+   INFO("   \"prop\":{\n");
+   switch (info_out->type) {
+      case PIPE_SHADER_VERTEX:
+         INFO("      \"vp\": {\"usesDrawParameters\":\"%s\"}\n",
+               info_out->prop.vp.usesDrawParameters ? "true" : "false");
+         break;
+      case PIPE_SHADER_TESS_CTRL:
+      case PIPE_SHADER_TESS_EVAL:
+         INFO("      \"tp\":{\n");
+         INFO("         \"outputPatchSize\":\"%d\"\n", info_out->prop.tp.outputPatchSize);
+         INFO("         \"partitioning\":\"%d\"\n", info_out->prop.tp.partitioning);
+         INFO("         \"winding\":\"%d\"\n", info_out->prop.tp.winding);
+         INFO("         \"domain\":\"%d\"\n", info_out->prop.tp.domain);
+         INFO("         \"outputPrim\":\"%d\"\n", info_out->prop.tp.outputPrim);
+         break;
+      case PIPE_SHADER_GEOMETRY:
+         INFO("      \"gp\":{\n");
+         INFO("         \"outputPrim\":\"%d\"\n", info_out->prop.gp.outputPrim);
+         INFO("         \"instancesCount\":\"%d\"\n", info_out->prop.gp.instanceCount);
+         INFO("         \"maxVertices\":\"%d\"\n", info_out->prop.gp.maxVertices);
+         break;
+      case PIPE_SHADER_FRAGMENT:
+         INFO("      \"fp\":{\n");
+         INFO("         \"numColourResults\":\"%d\"\n", info_out->prop.fp.numColourResults);
+         INFO("         \"writesDepth\":\"%s\"\n", info_out->prop.fp.writesDepth ? "true" : "false");
+         INFO("         \"earlyFragTests\":\"%s\"\n", info_out->prop.fp.earlyFragTests ? "true" : "false");
+         INFO("         \"postDepthCoverage\":\"%s\"\n", info_out->prop.fp.postDepthCoverage ? "true" : "false");
+         INFO("         \"usesDiscard\":\"%s\"\n", info_out->prop.fp.usesDiscard ? "true" : "false");
+         INFO("         \"usesSampleMaskIn\":\"%s\"\n", info_out->prop.fp.usesSampleMaskIn ? "true" : "false");
+         INFO("         \"readsFramebuffer\":\"%s\"\n", info_out->prop.fp.readsFramebuffer ? "true" : "false");
+         INFO("         \"readsSampleLocations\":\"%s\"\n", info_out->prop.fp.readsSampleLocations ? "true" : "false");
+         INFO("         \"separateFragData\":\"%s\"\n", info_out->prop.fp.separateFragData ? "true" : "false");
+         break;
+      default:
+         assert("!unhandled pipe shader type\n");
+   }
+   INFO("      }\n");
+   INFO("   }\n");
+
+   INFO("   \"io\":{\n");
+   INFO("      \"clipDistances\":\"%d\"\n", info_out->io.clipDistances);
+   INFO("      \"cullDistances\":\"%d\"\n", info_out->io.cullDistances);
+   INFO("      \"genUserClip\":\"%d\"\n", info_out->io.genUserClip);
+   INFO("      \"instanceId\":\"%d\"\n", info_out->io.instanceId);
+   INFO("      \"vertexId\":\"%d\"\n", info_out->io.vertexId);
+   INFO("      \"edgeFlagIn\":\"%d\"\n", info_out->io.edgeFlagIn);
+   INFO("      \"edgeFlagOut\":\"%d\"\n", info_out->io.edgeFlagOut);
+   INFO("      \"fragDepth\":\"%d\"\n", info_out->io.fragDepth);
+   INFO("      \"sampleMask\":\"%d\"\n", info_out->io.sampleMask);
+   INFO("      \"globalAccess\":\"%d\"\n", info_out->io.globalAccess);
+   INFO("      \"fp64\":\"%s\"\n", info_out->io.fp64 ? "true" : "false");
+   INFO("   \"}\n");
+   INFO("   \"numBarriers\":\"%d\"\n", info_out->numBarriers);
+   INFO("   \"driverPriv\":\"%p\"\n", info_out->driverPriv);
+
+   INFO("}\n");
+}
-- 
2.24.1



More information about the mesa-dev mailing list