Skip to content

radv,aco: Wire up nir source locations

Konstantin Seurer requested to merge KonstantinSeurer/mesa:aco-addr-to-line into main

Adds support to nir_debug_info_instr to ACO. nir_debug_info_instr's purpose is to hold information about the shader that could be useful for the shader. Currently, this is limited to source locations which map the IR to the glsl/spirv it was generated from. The annotated nir can something like this:

    // 0xe68
    32    %39 = fneg %22
    // 0xe68
    32    %40 = fneg %29
    // 0xe8c
    32    %41 = fadd %39, %40
    // 0xe68
    32    %42 = fmul %36 (2.000000), %35
    // 0xe8c
    32    %43 = fadd %41, %42
    // 0xf1c
    32    %44 = fdiv %43, %37 (1.000000)
    // 0xf40
    32    %45 = fadd %44, %38 (0.500000)

Where every comment is a nir_debug_info_instr that contains the offset into the spirv binary the following instructions were generated from.

The support that is added by this MR is

  1. Selecting nir_debug_info_instr as pseudo intructions
  2. Annotating the printed aco IR with debug info
  3. Passing the debug information as well as offsets into the shader binary back to RADV.

The goal in the future will be to use those offsets to map program counters back to the NIR/spirv/glsl instruction/line that crashed.

Edited by Konstantin Seurer

Merge request reports

Loading