diff options
author | Tony Wasserka <tony.wasserka@gmx.de> | 2021-06-11 12:37:50 +0200 |
---|---|---|
committer | Tony Wasserka <tony.wasserka@gmx.de> | 2021-10-01 10:40:18 +0200 |
commit | 3c1802accd7367d8c6c7ff8ebbe6c8c5f9111a3c (patch) | |
tree | 066195c2224207cd59b4d23be404ff90e5db5a72 /src/amd/compiler/aco_print_asm.cpp | |
parent | d5ac15c0e44c02694f263855cab4df029c307d6a (diff) | |
download | mesa-3c1802accd7367d8c6c7ff8ebbe6c8c5f9111a3c.tar.gz |
radv: Disable shader disassembly when no disassembler is available
ACO relies on LLVM to disassemble AMD shaders for ISAs newer than GFX7,
so disassembly needs to be skipped when LLVM is not enabled.
For vkGetPipelineExecutableInternalRepresentationsKHR and vkGetShaderInfoAMD,
the disassembly will not be reported anymore if it can't be generated.
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.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp index b37cccca2bc..9f15de5aacd 100644 --- a/src/amd/compiler/aco_print_asm.cpp +++ b/src/amd/compiler/aco_print_asm.cpp @@ -24,11 +24,13 @@ #include "aco_ir.h" +#ifdef LLVM_AVAILABLE #include "llvm/ac_llvm_util.h" #include "llvm-c/Disassembler.h" #include <llvm/ADT/StringRef.h> #include <llvm/MC/MCDisassembler/MCDisassembler.h> +#endif #include <array> #include <iomanip> @@ -142,6 +144,7 @@ fail: #endif } +#ifdef LLVM_AVAILABLE std::pair<bool, size_t> disasm_instr(chip_class chip, LLVMDisasmContextRef disasm, uint32_t* binary, unsigned exec_size, size_t pos, char* outline, unsigned outline_size) @@ -284,15 +287,38 @@ print_asm_llvm(Program* program, std::vector<uint32_t>& binary, unsigned exec_si return invalid; } +#endif /* LLVM_AVAILABLE */ + } /* end namespace */ +bool +check_print_asm_support(Program* program) +{ +#ifdef LLVM_AVAILABLE + if (program->chip_class >= GFX8) { + /* LLVM disassembler only supports GFX8+ */ + return true; + } +#endif + +#ifndef _WIN32 + /* Check if CLRX disassembler binary is available and can disassemble the program */ + return to_clrx_device_name(program->chip_class, program->family) && + system("clrxdisasm --version") == 0; +#else + return false; +#endif +} + /* Returns true on failure */ bool print_asm(Program* program, std::vector<uint32_t>& binary, unsigned exec_size, FILE* output) { +#ifdef LLVM_AVAILABLE if (program->chip_class >= GFX8) { return print_asm_llvm(program, binary, exec_size, output); } +#endif return print_asm_clrx(program, binary, output); } |