aco: add a helper printing shader asm by disassembling via LLVM

ACO uses the LLVM disassembler. It was used to verify that manually-written
inline assembly code is correct.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27952>
This commit is contained in:
Marek Olšák
2023-11-10 19:23:45 -05:00
committed by Marge Bot
parent df6fe90926
commit 7c25243f86
2 changed files with 18 additions and 0 deletions
+15
View File
@@ -499,3 +499,18 @@ aco_nir_op_supports_packed_math_16bit(const nir_alu_instr* alu)
}
const aco_compiler_statistic_info* aco_statistic_infos = statistic_infos.data();
void
aco_print_asm(const struct radeon_info *info, unsigned wave_size,
uint32_t *binary, unsigned num_dw)
{
std::vector<uint32_t> binarray(binary, binary + num_dw);
aco::Program prog;
prog.gfx_level = info->gfx_level;
prog.family = info->family;
prog.wave_size = wave_size;
prog.blocks.push_back(aco::Block());
aco::print_asm(&prog, binarray, num_dw, stderr);
}
+3
View File
@@ -100,6 +100,9 @@ bool aco_is_gpu_supported(const struct radeon_info* info);
bool aco_nir_op_supports_packed_math_16bit(const nir_alu_instr* alu);
void aco_print_asm(const struct radeon_info *info, unsigned wave_size,
uint32_t *binary, unsigned num_dw);
#ifdef __cplusplus
}
#endif