[Mesa-stable] [PATCH 1/3] gallivm: Improve debug output
Roland Scheidegger
sroland at vmware.com
Tue Feb 14 04:12:46 UTC 2017
Am 10.02.2017 um 23:59 schrieb Ben Crocker:
> Improve debug output from gallivm_compile_module and
> lp_build_create_jit_compiler_for_module, printing the
> -mcpu and -mattr options passed to LLC.
>
> Signed-off-by: Ben Crocker <bcrocker at redhat.com>
> Cc: 12.0 13.0 17.0 <mesa-stable at lists.freedesktop.org>
> ---
> src/gallium/auxiliary/gallivm/lp_bld_init.c | 5 ++++-
> src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 9 +++++++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> index d1b2369..fed43e9 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> @@ -606,7 +606,10 @@ gallivm_compile_module(struct gallivm_state *gallivm)
> util_snprintf(filename, sizeof(filename), "ir_%s.bc", gallivm->module_name);
> LLVMWriteBitcodeToFile(gallivm->module, filename);
> debug_printf("%s written\n", filename);
> - debug_printf("Invoke as \"llc -o - %s\"\n", filename);
> + debug_printf("Invoke as \"llc %s%s -o - %s\"\n",
> + (HAVE_LLVM >= 0x0305) ? "[-mcpu=<-mcpu option] " : "",
> + "[-mattr=<-mattr option(s)>]",
> + filename);
> }
>
> if (USE_MCJIT) {
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 21d9e15..f7b31ee 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -627,6 +627,14 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>
> builder.setMAttrs(MAttrs);
>
> + int n = MAttrs.size();
> + if (n > 0) {
> + debug_printf("llc -mattr option(s): ");
> + for (int i = 0; i < n; i++)
> + debug_printf("%s%s", MAttrs[i].c_str(), (i < n - 1) ? "," : "");
> + debug_printf("\n");
> + }
> +
> #if HAVE_LLVM >= 0x0305
> StringRef MCPU = llvm::sys::getHostCPUName();
> /*
> @@ -642,6 +650,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
> * can't handle. Not entirely sure if we really need to do anything yet.
> */
> builder.setMCPU(MCPU);
> + debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str());
I don't think this should be just a debug_printf here (and above)
without any gallivm_debug option set? Probably only print it on
GALLIVM_DEBUG_DUMP_BC/ASM? Otherwise this looks like quite the spam to me.
Otherwise, for the series:
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
(That reminds me one day I should probably fix the GALLIVM_DEBUG_PERF
option combined with either profile builds or GALLIVM_DEBUG_ASM set
since the printed time for jitting functions in this case always will
turn out as zero because LLVMGetPointerToGlobal() will already have been
called earlier...)
Roland
> #endif
>
> ShaderMemoryManager *MM = NULL;
>
More information about the mesa-stable
mailing list