nir_print: util_cpu_detect() is not called prior to _mesa_half_to_float()
Running spirv2nir on a SPIR-V containing halfs trigers an assert in util_get_caps()
due to util_cpu_detect()
not having been called beforehand; util_get_caps()
is called by _mesa_half_to_float()
which is used several times in src/compiler/nir/*.
Is it the responsibility of the user of the NIR compiler (spir2nir, clover, etc.) to call util_cpu_detect()
beforehand, or should it be called by the NIR compiler, or something else?
Backtrace:
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f53a2762ef5 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007f53a2762ef5 in raise () from /usr/lib/libc.so.6
#1 0x00007f53a274c862 in abort () from /usr/lib/libc.so.6
#2 0x00007f53a274c747 in __assert_fail_base.cold () from /usr/lib/libc.so.6
#3 0x00007f53a275b646 in __assert_fail () from /usr/lib/libc.so.6
#4 0x00005580b272a4c8 in util_get_cpu_caps () at ../../../src/mesa_clover_series/src/util/u_cpu_detect.h:116
#5 0x00005580b272a431 in _mesa_half_to_float (val=200) at ../../../src/mesa_clover_series/src/util/half_float.h:78
#6 0x00005580b272cff1 in print_load_const_instr (instr=0x5580b481e1b0, state=0x7ffed661f548) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1271
#7 0x00005580b27291f0 in print_instr (instr=0x5580b481e1b0, state=0x7ffed661f548, tabs=1) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1387
#8 0x00005580b272ab1e in print_block (block=0x5580b481a7b0, state=0x7ffed661f548, tabs=1) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1455
#9 0x00005580b272a874 in print_cf_node (node=0x5580b481a7b0, state=0x7ffed661f548, tabs=1) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1509
#10 0x00005580b272a6ff in print_function_impl (impl=0x5580b481a6c0, state=0x7ffed661f548) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1547
#11 0x00005580b2728fe1 in print_function (function=0x5580b481a5f0, state=0x7ffed661f548) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1564
#12 0x00005580b27282f9 in nir_print_shader_annotated (shader=0x5580b4817980, fp=0x7f53a28e8440 <_IO_2_1_stderr_>, annotations=0x0) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1659
#13 0x00005580b2729051 in nir_print_shader (shader=0x5580b4817980, fp=0x7f53a28e8440 <_IO_2_1_stderr_>) at ../../../src/mesa_clover_series/src/compiler/nir/nir_print.c:1668
#14 0x00005580b2727c72 in main (argc=6, argv=0x7ffed661f7e8) at ../../../src/mesa_clover_series/src/compiler/spirv/spirv2nir.c:181