radv: add RADV_DEBUG=checkir

This allows to run the LLVM verifier pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset
2018-06-14 14:28:58 +02:00
parent 706d51de7f
commit bfca15e16a
5 changed files with 11 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ enum {
RADV_DEBUG_INFO = 0x40000,
RADV_DEBUG_ERRORS = 0x80000,
RADV_DEBUG_STARTUP = 0x100000,
RADV_DEBUG_CHECKIR = 0x200000,
};
enum {

View File

@@ -410,6 +410,7 @@ static const struct debug_control radv_debug_options[] = {
{"info", RADV_DEBUG_INFO},
{"errors", RADV_DEBUG_ERRORS},
{"startup", RADV_DEBUG_STARTUP},
{"checkir", RADV_DEBUG_CHECKIR},
{NULL, 0}
};

View File

@@ -2967,13 +2967,17 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,
}
}
static void ac_llvm_finalize_module(struct radv_shader_context *ctx)
static void ac_llvm_finalize_module(struct radv_shader_context *ctx,
const struct radv_nir_compiler_options *options)
{
LLVMPassManagerRef passmgr;
/* Create the pass manager */
passmgr = LLVMCreateFunctionPassManagerForModule(
ctx->ac.module);
if (options->check_ir)
LLVMAddVerifierPass(passmgr);
/* This pass should eliminate all the load and store instructions */
LLVMAddPromoteMemoryToRegisterPass(passmgr);
@@ -3299,7 +3303,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
if (options->dump_preoptir)
ac_dump_module(ctx.ac.module);
ac_llvm_finalize_module(&ctx);
ac_llvm_finalize_module(&ctx, options);
if (shader_count == 1)
ac_nir_eliminate_const_vs_outputs(&ctx);
@@ -3617,7 +3621,7 @@ radv_compile_gs_copy_shader(LLVMTargetMachineRef tm,
LLVMBuildRetVoid(ctx.ac.builder);
ac_llvm_finalize_module(&ctx);
ac_llvm_finalize_module(&ctx, options);
ac_compile_llvm_module(tm, ctx.ac.module, binary, config, shader_info,
MESA_SHADER_VERTEX, options);

View File

@@ -571,6 +571,7 @@ shader_variant_create(struct radv_device *device,
options->dump_preoptir = options->dump_shader &&
device->instance->debug_flags & RADV_DEBUG_PREOPTIR;
options->record_llvm_ir = device->keep_shader_info;
options->check_ir = device->instance->debug_flags & RADV_DEBUG_CHECKIR;
options->tess_offchip_block_dw_size = device->tess_offchip_block_dw_size;
options->address32_hi = device->physical_device->rad_info.address32_hi;

View File

@@ -119,6 +119,7 @@ struct radv_nir_compiler_options {
bool dump_shader;
bool dump_preoptir;
bool record_llvm_ir;
bool check_ir;
enum radeon_family family;
enum chip_class chip_class;
uint32_t tess_offchip_block_dw_size;