From 4e559077e4d9e9d4bc6aeeb51dded1101e678036 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Sun, 22 Sep 2024 10:25:49 -0700 Subject: [PATCH] intel/executor: Dump both pre-processed source and assembly Having the actual generated assembly is helpful when trying to figure out if the code emission and disassembly are implemented correctly. Reviewed-by: Sagar Ghuge Part-of: --- src/intel/executor/executor_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/intel/executor/executor_main.c b/src/intel/executor/executor_main.c index eb426a68f4e..8f6da7242d8 100644 --- a/src/intel/executor/executor_main.c +++ b/src/intel/executor/executor_main.c @@ -118,7 +118,8 @@ print_help() "\n" " - bat Dumps the batch buffer.\n" " - color Uses colors for the batch buffer dump.\n" - " - cs Dumps the assembly after macro processing.\n" + " - cs Dumps the source after macro processing\n" + " the final assembly.\n" "\n" "EXAMPLE\n" "\n" @@ -652,15 +653,19 @@ l_execute(lua_State *L) const char *src = executor_apply_macros(&ec, params.original_src); FILE *f = fmemopen((void *)src, strlen(src), "r"); - brw_assemble_result asm = brw_assemble(ec.mem_ctx, ec.devinfo, f, "", 0); - fclose(f); - if (INTEL_DEBUG(DEBUG_CS) || !asm.bin) { + brw_assemble_flags flags = 0; + + if (INTEL_DEBUG(DEBUG_CS)) { printf("=== Processed assembly source ===\n" "%s" "=================================\n\n", src); + flags = BRW_ASSEMBLE_DUMP; } + brw_assemble_result asm = brw_assemble(ec.mem_ctx, ec.devinfo, f, "", flags); + fclose(f); + if (!asm.bin) failf("assembler failure");