Mesa (master): aco: fix printing assembly with CLRXdisasm on GFX6

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 12:02:50 UTC 2020


Module: Mesa
Branch: master
Commit: 54e54ec3e8112e56ef229be483bb1772df6fc0de
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=54e54ec3e8112e56ef229be483bb1772df6fc0de

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Jan 20 18:41:00 2020 +0100

aco: fix printing assembly with CLRXdisasm on GFX6

We thought that CLRXdisasm allowed gfx600 as well as gfx700 but
it actually doesn't. Use the family for GFX6 chips instead.

Fixes: 0099f85232b ("aco: print assembly with CLRXdisasm for GFX6-GFX7 if found on the system")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3531>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3531>

---

 src/amd/compiler/aco_print_asm.cpp | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp
index 74115e10cd3..fead382c7cf 100644
--- a/src/amd/compiler/aco_print_asm.cpp
+++ b/src/amd/compiler/aco_print_asm.cpp
@@ -16,6 +16,7 @@ void print_asm_gfx6_gfx7(Program *program, std::vector<uint32_t>& binary,
 {
    char path[] = "/tmp/fileXXXXXX";
    char line[2048], command[128];
+   const char *gpu_type;
    FILE *p;
    int fd;
 
@@ -30,8 +31,39 @@ void print_asm_gfx6_gfx7(Program *program, std::vector<uint32_t>& binary,
          goto fail;
    }
 
-   sprintf(command, "clrxdisasm --gpuType=%s -r %s",
-           program->chip_class == GFX6 ? "gfx600" : "gfx700", path);
+   /* Determine the GPU type for CLRXdisasm. Use the family for GFX6 chips
+    * because it doesn't allow to use gfx600 directly.
+    */
+   switch (program->chip_class) {
+   case GFX6:
+      switch (program->family) {
+      case CHIP_TAHITI:
+         gpu_type = "tahiti";
+         break;
+      case CHIP_PITCAIRN:
+         gpu_type = "pitcairn";
+         break;
+      case CHIP_VERDE:
+         gpu_type = "capeverde";
+         break;
+      case CHIP_OLAND:
+         gpu_type = "oland";
+         break;
+      case CHIP_HAINAN:
+         gpu_type = "hainan";
+         break;
+      default:
+         unreachable("Invalid GFX6 family!");
+      }
+      break;
+   case GFX7:
+      gpu_type = "gfx700";
+      break;
+   default:
+      unreachable("Invalid chip class!");
+   }
+
+   sprintf(command, "clrxdisasm --gpuType=%s -r %s", gpu_type, path);
 
    p = popen(command, "r");
    if (p) {



More information about the mesa-commit mailing list