lost the way on how to trace JIT codes
summer xia
xiaguangt at gmail.com
Fri Sep 8 02:30:32 UTC 2023
It is great. Thank you from the bottom of my heart!
Regards
Nelson
On Fri, Sep 8, 2023 at 7:19 AM Dave Airlie <airlied at gmail.com> wrote:
> On Wed, 6 Sept 2023 at 18:20, summer xia <xiaguangt at gmail.com> wrote:
> >
> > I use this version: llvmpipe (LLVM 14.0.0, 256 bits Type: CPU API:
> 1.3.246) as a backed vulkan engine. When I trace the whole pipeline that
> draws a picture. I can trace all the C level codes as following hints:
> >
> > #0 lp_setup_draw_elements (vbr=0x555555bcfe30, indices=0x555555bcdf10,
> nr=1023) at ../src/gallium/drivers/llvmpipe/lp_setup_vbuf.c:238
> > #1 0x00007ffff61d0707 in draw_pt_emit (emit=0x555555bcfce0,
> vert_info=0x7fffd966e718, prim_info=0x7fffd966e8d8) at
> ../src/gallium/auxiliary/draw/draw_pt_emit.c:197
> > #2 0x00007ffff61cc208 in emit (emit=0x555555bcfce0,
> vert_info=0x7fffd966e718, prim_info=0x7fffd966e8d8) at
> ../src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:541
> > #3 0x00007ffff61cbe4c in llvm_pipeline_generic (middle=0x555555bcfbd0,
> fetch_info=0x0, in_prim_info=0x7fffd966e8d8) at
> ../src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:759
> > #4 0x00007ffff61ca5fc in llvm_middle_end_run (middle=0x555555bcfbd0,
> fetch_elts=0x555555bccf10, fetch_count=683, draw_elts=0x555555bcdf10,
> draw_count=1023, prim_flags=2) at
> ../src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:812
> > #5 0x00007ffff6130283 in vsplit_flush_cache (vsplit=0x555555bcced0,
> flags=2) at ../src/gallium/auxiliary/draw/draw_pt_vsplit.c:78
> > #6 0x00007ffff6131236 in vsplit_segment_cache_uint
> (vsplit=0x555555bcced0, flags=2, istart=0, icount=1023, spoken=0 '\000',
> ispoken=0, close=0 '\000', iclose=0) at
> ../src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h:163
> > #7 0x00007ffff6130f8c in vsplit_segment_simple_uint
> (vsplit=0x555555bcced0, flags=2, istart=0, icount=1023) at
> ../src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h:173
> > #8 0x00007ffff612f4cd in vsplit_run_uint (frontend=0x555555bcced0,
> start=0, count=5529600) at
> ../src/gallium/auxiliary/draw/draw_split_tmp.h:106
> > #9 0x00007ffff6122e96 in draw_pt_arrays (draw=0x555555b96920,
> prim=PIPE_PRIM_TRIANGLES, index_bias_varies=true, draw_info=0x7fffd966ec70,
> num_draws=1) at ../src/gallium/auxiliary/draw/draw_pt.c:161
> > #10 0x00007ffff6122995 in draw_instances (draw=0x555555b96920,
> drawid_offset=0, info=0x555555b7fb60, draws=0x7fffd966ec70, num_draws=1) at
> ../src/gallium/auxiliary/draw/draw_pt.c:485
> > #11 0x00007ffff6122689 in draw_vbo (draw=0x555555b96920,
> info=0x555555b7fb60, drawid_offset=0, indirect=0x0, draws=0x7fffd966ec70,
> num_draws=1, patch_vertices=0 '\000') at
> ../src/gallium/auxiliary/draw/draw_pt.c:619
> > #12 0x00007ffff60757ee in llvmpipe_draw_vbo (pipe=0x555555b8db40,
> info=0x555555b7fb60, drawid_offset=0, indirect=0x0, draws=0x7fffd966ec70,
> num_draws=1) at ../src/gallium/drivers/llvmpipe/lp_draw_arrays.c:150
> > #13 0x00007ffff5c71083 in handle_draw_indexed (cmd=0x555555dca790,
> state=0x555555b7faf0) at
> ../src/gallium/frontends/lavapipe/lvp_execute.c:2725
> > #14 0x00007ffff5c6f1e0 in lvp_execute_cmd_buffer
> (cmd_buffer=0x555555b78520, state=0x555555b7faf0, print_cmds=false) at
> ../src/gallium/frontends/lavapipe/lvp_execute.c:4324
> > #15 0x00007ffff5c6ef10 in lvp_execute_cmds (device=0x555555b7e5f0,
> queue=0x555555b7f8e0, cmd_buffer=0x555555b78520) at
> ../src/gallium/frontends/lavapipe/lvp_execute.c:4621
> > #16 0x00007ffff5c682ba in lvp_queue_submit (vk_queue=0x555555b7f8e0,
> submit=0x555555dccb80) at
> ../src/gallium/frontends/lavapipe/lvp_device.c:1548
> > #17 0x00007ffff5d651fd in vk_queue_submit_final (queue=0x555555b7f8e0,
> submit=0x555555dccb80) at ../src/vulkan/runtime/vk_queue.c:377
> > #18 0x00007ffff5d67eef in vk_queue_submit_thread_func
> (_data=0x555555b7f8e0) at ../src/vulkan/runtime/vk_queue.c:490
> > #19 0x00007ffff5d45522 in impl_thrd_routine (p=0x555555aa1ee0) at
> ../src/c11/impl/threads_posix.c:67
> > #20 0x00007ffff7894b43 in start_thread (arg=<optimized out>) at
> ./nptl/pthread_create.c:442
> > #21 0x00007ffff7926a00 in clone3 () at
> ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
> >
> >
> > But when I want to make clear what this method's function :
> >
> > /* Run vertex fetch shader */
> > clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context,
> > llvm_vert_info.verts,
> > draw->pt.user.vbuffer,
> > fetch_info->count,
> > start,
> > fpme->vertex_size,
> > draw->pt.vertex_buffer,
> > draw->instance_id,
> > vertex_id_offset,
> > draw->start_instance,
> > elts,
> > draw->pt.user.drawid,
> > draw->pt.user.viewid);
> > I can't step into this function with gdb and can't find any hints on how
> to fill this llvm_vert_info.verts in it. Appreciate any comments.
>
> Currently there is just no nice way to debug the jit code with a
> debugger, I've done some investigation into adding debug support to
> the LLVM generator, but it's definitely non-trivial,
>
> Usually I just end up adding lp_build_print_value statements to the
> generator code so you can at least get JIT debug print statements, the
> generators are in draw_llvm.c for the vs/gs/tess shaders.
>
> Dave.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20230908/75c25b30/attachment.htm>
More information about the mesa-dev
mailing list