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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27865>
This commit is contained in:
Caio Oliveira 2024-02-28 17:41:46 -08:00 committed by Marge Bot
parent 1ba5e9432d
commit 6e33b39b46
4 changed files with 6 additions and 6 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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