This fixes GALLIVM_DEBUG=asm for compute shaders, changing
the hooks after dumping causes a segfault because the
memory has already been finalised. Just add the hooks always,
and before dumping anything.
Fixes:
f511d2a55337 ("gallivm: rework coroutine malloc/free callouts.")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19714>
(cherry picked from commit
fb7de303ba7cbdb4237d2ae93011bc2845114d35)
"description": "gallivm: add coro malloc hooks earlier and always.",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "f511d2a553377a58b5eea6c6d1170fcc4972237a"
},
draw_tcs_llvm_dump_variant_key(&variant->key);
}
- lp_build_coro_declare_malloc_hooks(variant->gallivm);
draw_tcs_llvm_generate(llvm, variant);
gallivm_compile_module(variant->gallivm);
- lp_build_coro_add_malloc_hooks(variant->gallivm);
variant->jit_func = (draw_tcs_jit_func)
gallivm_jit_function(variant->gallivm, variant->function);
#include "lp_bld_debug.h"
#include "lp_bld_misc.h"
#include "lp_bld_init.h"
+#include "lp_bld_coro.h"
#include "lp_bld_printf.h"
#include <llvm/Config/llvm-config.h>
if (!create_pass_manager(gallivm))
goto fail;
+ lp_build_coro_declare_malloc_hooks(gallivm);
return TRUE;
fail:
lp_init_clock_hook(gallivm);
LLVMAddGlobalMapping(gallivm->engine, gallivm->get_time_hook, os_time_get_nano);
+ lp_build_coro_add_malloc_hooks(gallivm);
+
if (gallivm_debug & GALLIVM_DEBUG_ASM) {
LLVMValueRef llvm_func = LLVMGetFirstFunction(gallivm->module);
}
}
- lp_build_coro_declare_malloc_hooks(gallivm);
-
if (variant->gallivm->cache->data_size)
return;
gallivm_compile_module(variant->gallivm);
- lp_build_coro_add_malloc_hooks(variant->gallivm);
variant->nr_instrs += lp_build_count_ir_module(variant->gallivm->module);
variant->jit_function = (lp_jit_cs_func)