LaurentMazare / tch-rs

Rust bindings for the C++ api of PyTorch.
Apache License 2.0
4.04k stars 318 forks source link

Segfault with wgpu #627

Open Aalanli opened 1 year ago

Aalanli commented 1 year ago

Hello, when using tch and wgpu together, the program segfaults after main.

use tch;

fn main() {
    let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
        backends: wgpu::Backends::all(),
        dx12_shader_compiler: Default::default(),
    });
    println!("!");
}

outputs:

!
Segmentation fault (core dumped)

I am using: tch = "0.10.2" wgpu = "0.15.1"

I am unsure where to post this issue, but after running valgrind, there seems to be a double free in libtorch.so?

==149631== Invalid free() / delete / delete[] / realloc()
==149631==    at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==149631==    by 0x5F518D8D: llvm::cl::opt<llvm::PGOViewCountsType, false, llvm::cl::parser<llvm::PGOViewCountsType> >::~opt() (in /home/A/Documents/C++/libtorch/lib/libtorch_cpu.so)
==149631==    by 0x47247FDD: __cxa_finalize (cxa_finalize.c:83)
==149631==    by 0x5AF84C32: ??? (in /home/A/Documents/C++/libtorch/lib/libtorch_cpu.so)
==149631==    by 0x4011F6A: _dl_fini (dl-fini.c:138)
==149631==    by 0x472478A6: __run_exit_handlers (exit.c:108)
==149631==    by 0x47247A5F: exit (exit.c:139)
==149631==    by 0x47225089: (below main) (libc-start.c:342)
==149631==  Address 0x800000003 is not stack'd, malloc'd or (recently) free'd

Any help would be appreciated, thanks for your time.

Aalanli commented 1 year ago

This only seems to be an issue on

wgpu::Backends::VULKAN

I am on ubuntu 2004.

lambdadeltakay commented 9 months ago

Also experiencing this issue on debian sid