SDSoC 2016.3を解析してみた。

とりあえず、Linux Kernelにprintk入れてみた。

高位合成後、アプリからKernelのどこを通るか確認した。

libsds_lib.aと高位合成前のソースコード見ればだいたいわかるけど・・・

ここからの解析ログはKernelに埋め込んだログとアプリのログが同時に出力されているのでログが崩れているところがあるけど・・・

予想以上に無駄が多い?

まぁ、ビビったのはxlnk_freebufが256回、実行されていたことだね。

高位合成後の回路を見れば、ポートが256ポートまで作れそうな気配があるのが見えるんだけど、ドライバレベルで高位合成の回路結果(ポートの数)を合わせているなんて凄い危険なドライバだよなぁ。

FPGAの回路なんてハードコーディングじゃないのに・・・

っうか、ポートの最大は16じゃなかったのか?

無駄な初期化アクセス・・・

ちょっと、もったいない。

SDSoCがバージョンアップすれば解消されるのかな?

ひとまず、アプリより速けりゃ良いのか・・・

root@zturn:/mnt# ./OpenCV_Sample03-zturn.elf
cf_context_init()
[xlnk_open]
[xlnk_ioctl]
[xlnk_config_ioctl]
[xlnk_config_clear_block]
[xlnk_get_config]
[xlnk_ioctl]
[xlnk_recover_resource]
[xlnk_free_all_buf]
[xlnk_freebuf]
・・・[xlnk_freebuf]が256回実行される
[xlnk_freebuf]
[xdma_release_all_channels]
cf_get_current_context()
[xlnk_ioctl]
[xlnk_devregister_ioctl]
[xlnk_devregister]
[xlnk_devpacks_find]
[xlnk_eng_probe]
xlnk_eng_probe ...
uio name xilinx-xlnk-eng.0
xilinx-xlnk-eng xilinx-xlnk-eng.0: physical base : 0x80400000
xilinx-xlnk-eng xilinx-xlnk-eng.0: register range : 0x10000
xilinx-xlnk-eng xilinx-xlnk-eng.0: base remapped to: 0xe0aa0000
[xlnk_eng_register_device]
[__uio_register_device]
[uio_get_minor]
[uio_dev_add_attributes]
xilinx-xlnk-eng xilinx-xlnk-eng.0: xilinx-xlnk-eng uio registered
[xlnk_devpacks_add]
[uio_open]
[uio_mmap]
[uio_find_mem_index]
[uio_find_mem_index]
[uio_mmap_physical]
[uio_write]
axi_dma_simple_open()
[xlnk_ioctl]
[xlnk_devregister_ioctl]
[xlnk_devregister]
[xlnk_devpacks_find]
[xlnk_eng_probe]
xlnk_eng_probe ...
uio name xilinx-xlnk-eng.1
xilinx-xlnk-eng xilinx-xlnk-eng.1: physical base : 0x80410000
xilinx-xlnk-eng xilinx-xlnk-eng.1: register range : 0x10000
xilinx-xlnk-eng xilinx-xlnk-eng.1: base remapped to: 0xe0ac0000
[xlnk_eng_register_device]
[__uio_register_device]
[uio_get_minor]
[uio_dev_add_attributes]
xilinx-xlnk-eng xilinx-xlnk-eng.1: xilinx-xlnk-eng uio registered
[xlnk_devpacks_add]
[uio_open]
[uio_mmap]
[uio_find_mem_index]
[uio_find_mem_index]
[uio_mmap_physical]
[uio_write]
axi_dma_simple_open()
axi_lite_open()
axi_lite_open()
axi_lite_[xlnk_ioctl]
open()
[xlnk_devregister_ioctl]
[xlnk_devregister]
[xlnk_devpacks_find]
[xlnk_eng_probe]
xlnk_eng_probe ...
uio name xilinx-xlnk-eng.2
xilinx-xlnk-eng xilinx-xlnk-eng.2: physical base : 0x83c00000
xilinx-xlnk-eng xilinx-xlnk-eng.2: register range : 0x10000
xilinx-xlnk-eng xilinx-xlnk-eng.2: base remapped to: 0xe0ae0000
[xlnk_eng_register_device]
[__uio_register_device]
[uio_get_minor]
[uio_dev_add_attributes]
xilinx-xlnk-eng xilinx-xlnk-eng.2: xilinx-xlnk-eng uio registered
[xlnk_devpacks_add]
[uio_open]
[uio_mmap]
[uio_find_mem_index]
[uio_find_mem_index]
[uio_mmap_physical]
[uio_write]
accel_open()
exec: OpenCV_Sample01
read: lena.png
exec: laplacian
exec: conv_data in
[xlnk_ioctl]
[xlnk_allocbuf_ioctl]
[xlnk_allocbuf]
[xlnk_mmap]
[xlnk_config_dma_type]
[xlnk_vma_open]
sds_alloc()
[xlnk_ioctl]
[xlnk_allocbuf_ioctl]
[xlnk_allocbuf]
[xlnk_mmap]
[xlnk_config_dma_type]
[xlnk_vma_open]
sds_alloc()

最初のほうのxilinx-xlnk-engはsds_allocでメモリ確保してるところだね。

アプリの中で2つ、sds_allocしてるのと、物理メモリもサイズも狙ったところに収まっているのでOKだね。

まぁ、他にはUIO通ってるよね。

次はアプリ実行中のログ

mmap効果だよね。

ドライバは関知せず。

cf_send_i()
cf_wait()
cf_send_i()
cf_send_i()
cf_receive_i()
cf_receive_i()
cf_wait()
cf_wait()
cf_wait()
cf_wait()

アプリ終了処理は?

無難に終了。

終わりはやることないもんね。

cf_send_i()
cf_wait()
cf_send_i()
cf[uio_unregister_device]
_send_i()
cf_receive_i()
cf_receive_i()
cf_wait()
[uio_free_minor]

cf_wait()
cf_wait()
sds_free()
sds_free()
exec: conv_data o[uio_dev_del_attributes]
ut
write: lena_laplacian.png
finish: OpenCV_Sample01
accel_cl[map_release]
ose()
axi_dma_simple_close()
xilinx-xlnk-eng xilinx-xlnk-eng.1: xilinx-xlnk-eng uio unregistered
[xlnk_eng_unregister_device]
[xlnk_eng_release]
[xlnk_devpacks_delete]
axi_dma_simple_close()
axi_lite_close()
axi_lite_close()
axi_li[xlnk_ioctl]
te_close()
[xlnk_shutdown]
[xlnk_release]
root@zturn:/mnt#
write: 2017/01/31/ 00:12:21