<div dir="ltr">It is great. Thank you from the bottom of my heart!<div><br></div><div>Regards</div><div><br></div><div>Nelson</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 8, 2023 at 7:19 AM Dave Airlie <<a href="mailto:airlied@gmail.com">airlied@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 6 Sept 2023 at 18:20, summer xia <<a href="mailto:xiaguangt@gmail.com" target="_blank">xiaguangt@gmail.com</a>> wrote:<br>
><br>
> 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:<br>
><br>
> #0 lp_setup_draw_elements (vbr=0x555555bcfe30, indices=0x555555bcdf10, nr=1023) at ../src/gallium/drivers/llvmpipe/lp_setup_vbuf.c:238<br>
> #1 0x00007ffff61d0707 in draw_pt_emit (emit=0x555555bcfce0, vert_info=0x7fffd966e718, prim_info=0x7fffd966e8d8) at ../src/gallium/auxiliary/draw/draw_pt_emit.c:197<br>
> #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<br>
> #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<br>
> #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<br>
> #5 0x00007ffff6130283 in vsplit_flush_cache (vsplit=0x555555bcced0, flags=2) at ../src/gallium/auxiliary/draw/draw_pt_vsplit.c:78<br>
> #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<br>
> #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<br>
> #8 0x00007ffff612f4cd in vsplit_run_uint (frontend=0x555555bcced0, start=0, count=5529600) at ../src/gallium/auxiliary/draw/draw_split_tmp.h:106<br>
> #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<br>
> #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<br>
> #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<br>
> #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<br>
> #13 0x00007ffff5c71083 in handle_draw_indexed (cmd=0x555555dca790, state=0x555555b7faf0) at ../src/gallium/frontends/lavapipe/lvp_execute.c:2725<br>
> #14 0x00007ffff5c6f1e0 in lvp_execute_cmd_buffer (cmd_buffer=0x555555b78520, state=0x555555b7faf0, print_cmds=false) at ../src/gallium/frontends/lavapipe/lvp_execute.c:4324<br>
> #15 0x00007ffff5c6ef10 in lvp_execute_cmds (device=0x555555b7e5f0, queue=0x555555b7f8e0, cmd_buffer=0x555555b78520) at ../src/gallium/frontends/lavapipe/lvp_execute.c:4621<br>
> #16 0x00007ffff5c682ba in lvp_queue_submit (vk_queue=0x555555b7f8e0, submit=0x555555dccb80) at ../src/gallium/frontends/lavapipe/lvp_device.c:1548<br>
> #17 0x00007ffff5d651fd in vk_queue_submit_final (queue=0x555555b7f8e0, submit=0x555555dccb80) at ../src/vulkan/runtime/vk_queue.c:377<br>
> #18 0x00007ffff5d67eef in vk_queue_submit_thread_func (_data=0x555555b7f8e0) at ../src/vulkan/runtime/vk_queue.c:490<br>
> #19 0x00007ffff5d45522 in impl_thrd_routine (p=0x555555aa1ee0) at ../src/c11/impl/threads_posix.c:67<br>
> #20 0x00007ffff7894b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442<br>
> #21 0x00007ffff7926a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81<br>
><br>
><br>
> But when I want to make clear what this method's function :<br>
><br>
> /* Run vertex fetch shader */<br>
> clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context,<br>
> llvm_vert_info.verts,<br>
> draw->pt.user.vbuffer,<br>
> fetch_info->count,<br>
> start,<br>
> fpme->vertex_size,<br>
> draw->pt.vertex_buffer,<br>
> draw->instance_id,<br>
> vertex_id_offset,<br>
> draw->start_instance,<br>
> elts,<br>
> draw->pt.user.drawid,<br>
> draw->pt.user.viewid);<br>
> 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.<br>
<br>
Currently there is just no nice way to debug the jit code with a<br>
debugger, I've done some investigation into adding debug support to<br>
the LLVM generator, but it's definitely non-trivial,<br>
<br>
Usually I just end up adding lp_build_print_value statements to the<br>
generator code so you can at least get JIT debug print statements, the<br>
generators are in draw_llvm.c for the vs/gs/tess shaders.<br>
<br>
Dave.<br>
</blockquote></div>