summaryrefslogtreecommitdiff
path: root/src/amd/compiler/aco_print_asm.cpp
diff options
context:
space:
mode:
authorTony Wasserka <tony.wasserka@gmx.de>2021-06-29 12:28:07 +0200
committerTony Wasserka <tony.wasserka@gmx.de>2021-10-01 10:40:18 +0200
commita3e339853af6c45e47f9adc0c1f8a3816edfd7d8 (patch)
treee071b4b4b3a4790d9ebe355d067879d039665dd2 /src/amd/compiler/aco_print_asm.cpp
parentef48887a9e6d6bf4034ebb62164448403bf57130 (diff)
downloadmesa-a3e339853af6c45e47f9adc0c1f8a3816edfd7d8.tar.gz
aco: Extend set of supported GPUs that can be disassembled with CLRX
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>
Diffstat (limited to 'src/amd/compiler/aco_print_asm.cpp')
-rw-r--r--src/amd/compiler/aco_print_asm.cpp86
1 files changed, 60 insertions, 26 deletions
diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp
index 0d6cf856330..b37cccca2bc 100644
--- a/src/amd/compiler/aco_print_asm.cpp
+++ b/src/amd/compiler/aco_print_asm.cpp
@@ -37,9 +37,62 @@
namespace aco {
namespace {
-/* LLVM disassembler only supports GFX8+, try to disassemble with CLRXdisasm
- * for GFX6-GFX7 if found on the system, this is better than nothing.
+/**
+ * Determines the GPU type to use for CLRXdisasm
*/
+const char*
+to_clrx_device_name(chip_class cc, radeon_family family)
+{
+ switch (cc) {
+ case GFX6:
+ switch (family) {
+ case CHIP_TAHITI: return "tahiti";
+ case CHIP_PITCAIRN: return "pitcairn";
+ case CHIP_VERDE: return "capeverde";
+ case CHIP_OLAND: return "oland";
+ case CHIP_HAINAN: return "hainan";
+ default: return nullptr;
+ }
+ case GFX7:
+ switch (family) {
+ case CHIP_BONAIRE: return "bonaire";
+ case CHIP_KAVERI: return "gfx700";
+ case CHIP_HAWAII: return "hawaii";
+ default: return nullptr;
+ }
+ case GFX8:
+ switch (family) {
+ case CHIP_TONGA: return "tonga";
+ case CHIP_ICELAND: return "iceland";
+ case CHIP_CARRIZO: return "carrizo";
+ case CHIP_FIJI: return "fiji";
+ case CHIP_STONEY: return "stoney";
+ case CHIP_POLARIS10: return "polaris10";
+ case CHIP_POLARIS11: return "polaris11";
+ case CHIP_POLARIS12: return "polaris12";
+ case CHIP_VEGAM: return "polaris11";
+ default: return nullptr;
+ }
+ case GFX9:
+ switch (family) {
+ case CHIP_VEGA10: return "vega10";
+ case CHIP_VEGA12: return "vega12";
+ case CHIP_VEGA20: return "vega20";
+ case CHIP_RAVEN: return "raven";
+ default: return nullptr;
+ }
+ case GFX10:
+ switch (family) {
+ case CHIP_NAVI10: return "gfx1010";
+ case CHIP_NAVI12: return "gfx1011";
+ default: return nullptr;
+ }
+ case GFX10_3:
+ return nullptr;
+ default: unreachable("Invalid chip class!"); return nullptr;
+ }
+}
+
bool
print_asm_clrx(Program* program, std::vector<uint32_t>& binary, FILE* output)
{
@@ -48,10 +101,11 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, FILE* output)
#else
char path[] = "/tmp/fileXXXXXX";
char line[2048], command[128];
- const char* gpu_type;
FILE* p;
int fd;
+ const char* gpu_type = to_clrx_device_name(program->chip_class, program->family);
+
/* Dump the binary into a temporary file. */
fd = mkstemp(path);
if (fd < 0)
@@ -62,24 +116,6 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, FILE* output)
goto fail;
}
- /* 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");
@@ -254,13 +290,11 @@ print_asm_llvm(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
bool
print_asm(Program* program, std::vector<uint32_t>& binary, unsigned exec_size, FILE* output)
{
- if (program->chip_class <= GFX7) {
- /* Do not abort if clrxdisasm isn't found. */
- print_asm_clrx(program, binary, output);
- return false;
- } else {
+ if (program->chip_class >= GFX8) {
return print_asm_llvm(program, binary, exec_size, output);
}
+
+ return print_asm_clrx(program, binary, output);
}
} // namespace aco