Libdarknet2.0.so source code?

I was playing around with the TVM darknet example on aarch64 (Compile YOLO-V2 and YOLO-V3 in DarkNet Models — tvm 0.9.dev182+ge718f5a8a documentation) which downloads libdarknet2.o.so and drops it into ~/.tvm_test_data/darknet. The shared library binary comes from https://github.com/dmlc/web-data/blob/main/darknet/ and there is only an x86-64 version which obviously leads to problems on aarch64.

I pulled the source for darknet down from https://github.com/pjreddie/darknet as well as what appears to be something later at https://github.com/AlexeyAB/darknet.git but both fail for different reasons each looks to be memory corruption of some sort.

Example: (library built from https://github.com/pjreddie/darknet)

   97 upsample            2x    26 x  26 x 128   ->    52 x  52 x 128
   98 route  97 36
   99 conv    128  1 x 1 / 1    52 x  52 x 384   ->    52 x  52 x 128  0.266 BFLOPs
  100 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  101 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
  102 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  103 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128  0.177 BFLOPs
  104 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256  1.595 BFLOPs
  105 conv    255  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 255  0.353 BFLOPs
  106 yolo
Loading weights from /home/tgall/.tvm_test_data/darknet/yolov3.weights...Done!
free(): invalid next size (fast)
Aborted

It would be great to know what source, branch, commit was used for the binary libdarknet2.0.so found at https://github.com/dmlc/web-data/blob/main/darknet/ – I’d like to debug and once fixed supply an aarch64 version of darknet for use.

Thanks! Tom

@gromero

Some updates. If I build and run darknet on aarch64 and run its test programs, this function as expected. If I adjust the tvm example to use the libdarknet.so I’d just built from the source at : https://github.com/pjreddie/darknet, as well as to use the yolov3.cfg from darknet/cfg/yolov3.cfg as well as the weights from wget https://pjreddie.com/media/files/yolov3.weights again TVM bombs out with a

don't download lib
load cfg and weights
malloc(): unsorted double linked list corrupted
Aborted (core dumped)

and looking at the stack in gdb

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000fffff7c8c8e8 in __GI_abort () at abort.c:79
#2  0x0000fffff7cd86f8 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0xfffff7d98bd8 "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x0000fffff7cdecb4 in malloc_printerr (
    str=str@entry=0xfffff7d94b78 "malloc(): unsorted double linked list corrupted") at malloc.c:5341
#4  0x0000fffff7ce1dc8 in _int_malloc (av=av@entry=0xfffff7dd8a98 <main_arena>, bytes=bytes@entry=24)
    at malloc.c:3740
#5  0x0000fffff7ce3560 in __GI___libc_malloc (bytes=24) at malloc.c:3057
#6  0x0000ffffe0e13fb8 in make_list () from /home/tgall/git/darknet/libdarknet.so
#7  0x0000ffffe0e4f134 in read_cfg () from /home/tgall/git/darknet/libdarknet.so
#8  0x0000ffffe0e4f23c in parse_network_cfg () from /home/tgall/git/darknet/libdarknet.so
#9  0x0000ffffe0e48fa4 in load_network () from /home/tgall/git/darknet/libdarknet.so
#10 0x0000fffff7085dcc in ffi_call_SYSV () from /lib/aarch64-linux-gnu/libffi.so.6
#11 0x0000fffff70866f4 in ffi_call () from /lib/aarch64-linux-gnu/libffi.so.6
#12 0x0000ffffe11597d4 in cdata_call (cd=0x0, args=<optimized out>, kwds=<optimized out>)
    at c/_cffi_backend.c:3186
#13 0x000000000043d240 in _PyObject_FastCallKeywords ()
#14 0x0000000000429ce0 in _PyEval_EvalFrameDefault ()
#15 0x00000000004df2bc in _PyEval_EvalCodeWithName ()
#16 0x00000000004df600 in PyEval_EvalCode ()
#17 0x0000000000512430 in PyRun_FileExFlags ()
#18 0x000000000051260c in PyRun_SimpleFileExFlags ()
#19 0x0000000000431be8 in ?? ()
#20 0x0000000000431e18 in _Py_UnixMain ()
#21 0x0000fffff7c8cd24 in __libc_start_main (main=0x422890 <main>, argc=2, argv=0xfffffffff198, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>)
    at ../csu/libc-start.c:308
#22 0x000000000042c3b0 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Ugly.

I am exactly facing the same issue! did you figure out? or can anyone please help asap

Thanks in advance