From 6e33b39b46c742a02daa69e13fb924c20098e286 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Wed, 28 Feb 2024 17:41:46 -0800 Subject: [PATCH] intel/compiler: Remove nir_print_instr hack in disasm_info The compilers (brw and elk) static libraries depend only on idep_nir_headers instead of idep_nir. This was done to increase the parallelism in the build. One side effect is that consumers of the compilers must depend on idep_nir themselves to ensure nir symbols are resolved. Various intel tools don't use NIR directly, so don't depend on it, and only use a few functions of the compiler, that *mostly* don't depend on linking NIR functions except for the case of nir_print_instr. The current code adds a weak empty function to take its place in case it is not linked. This is sort of a hack because if we change the compiler in ways that use NIR differently, or we use different functions of the compiler in the tools, we will end up having to add other dummy definitions. A better solution here (suggested by Dylan) is to add the idep_nir to the list of dependencies of the compilers idep's. The static libraries of the compilers still don't depend directly on NIR, but any user of idep_compiler_* will get that dependency. Acked-by: Lionel Landwerlin Reviewed-by: Dylan Baker Part-of: --- src/intel/compiler/brw_disasm_info.c | 3 --- src/intel/compiler/elk/elk_disasm_info.c | 3 --- src/intel/compiler/elk/meson.build | 3 +++ src/intel/compiler/meson.build | 3 +++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/intel/compiler/brw_disasm_info.c b/src/intel/compiler/brw_disasm_info.c index 9cb781429a8..a2c3c1e9f0c 100644 --- a/src/intel/compiler/brw_disasm_info.c +++ b/src/intel/compiler/brw_disasm_info.c @@ -28,9 +28,6 @@ #include "dev/intel_debug.h" #include "compiler/nir/nir.h" -__attribute__((weak)) void nir_print_instr(UNUSED const nir_instr *instr, - UNUSED FILE *fp) {} - void dump_assembly(void *assembly, int start_offset, int end_offset, struct disasm_info *disasm, const unsigned *block_latency) diff --git a/src/intel/compiler/elk/elk_disasm_info.c b/src/intel/compiler/elk/elk_disasm_info.c index 85d91063153..4ea0d20f21d 100644 --- a/src/intel/compiler/elk/elk_disasm_info.c +++ b/src/intel/compiler/elk/elk_disasm_info.c @@ -28,9 +28,6 @@ #include "dev/intel_debug.h" #include "compiler/nir/nir.h" -__attribute__((weak)) void nir_print_instr(UNUSED const nir_instr *instr, - UNUSED FILE *fp) {} - void elk_dump_assembly(void *assembly, int start_offset, int end_offset, struct elk_disasm_info *disasm, const unsigned *block_latency) diff --git a/src/intel/compiler/elk/meson.build b/src/intel/compiler/elk/meson.build index 2a4d6fcaeda..d7472c8a4e1 100644 --- a/src/intel/compiler/elk/meson.build +++ b/src/intel/compiler/elk/meson.build @@ -154,6 +154,9 @@ libintel_compiler_elk = static_library( idep_intel_compiler_elk = declare_dependency( link_with : [libintel_compiler_elk], + dependencies : [ + idep_nir, + ], ) if with_tests diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build index dd8e55ff436..8e238d7b5df 100644 --- a/src/intel/compiler/meson.build +++ b/src/intel/compiler/meson.build @@ -153,6 +153,9 @@ libintel_compiler_brw = static_library( idep_intel_compiler_brw = declare_dependency( link_with : [libintel_compiler_brw], + dependencies : [ + idep_nir, + ], ) # For now this tool is only going to be used by Anv