NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
16k stars 1.93k forks source link

Vulkan Error on WSL2 #609

Closed alextrevithick closed 2 years ago

alextrevithick commented 2 years ago

I am getting a Vulkan error when running

./build/testbed --scene data/nerf/fox

I get the following output:

11:57:20 INFO Loading NeRF dataset from 11:57:20 INFO data/nerf/fox/transforms.json 11:57:20 SUCCESS Loaded 50 images of size 1080x1920 after 0s 11:57:20 INFO cam_aabb=[min=[1.0229,-1.33309,-0.378748], max=[2.46175,1.00721,1.41295]] 11:57:21 INFO Loading network config from: configs/nerf/base.json 11:57:21 INFO GridEncoding: Nmin=16 b=1.51572 F=2 T=2^19 L=16 11:57:21 INFO Density model: 3--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=3)]-->1 11:57:21 INFO Color model: 3--[Composite]-->16+16--[FullyFusedMLP(neurons=64,layers=4)]-->3 11:57:21 INFO total_encoding_params=13074912 total_network_params=10240 11:57:21 ERROR Vulkan: loaderValidateLayers: Layer 0 does not exist in the list of available layers 11:57:21 WARNING Could not initialize Vulkan and NGX. DLSS not supported. (/mnt/c/Users/Alex Trevithick/Desktop/instant-ngp/src/dlss.cu:216 vkCreateInstance(&instance_create_info, nullptr, &vk_instance) failed) Segmentation fault

If I disable validation layer (line 155 in src/dlss.cu) it works fine. However, I then get a segmentation fault when meshing the fox NeRF.

leosh64 commented 2 years ago

Having the same issue.

jhurlbut commented 2 years ago

install the vulkan sdk

Tom94 commented 2 years ago

The segmentation fault within the vulkan/cuda API is unfortunate. This means instant-ngp can't gracefully handle it on its end. I added CMake options that allow you to manually disable Vulkan. Simply use cmake -DNGP_BUILD_WITH_VULKAN=OFF <remaining arguments>. You won't be able to run DLSS, but that presumably doesn't matter much.

leosh64 commented 2 years ago

I pulled the latest version on master branch (66a965d2816809d0ba645dcf10b2006025543c62) and rebuilt with the CMake arguments:

cmake -DNGP_BUILD_WITH_VULKAN=OFF . -B build
cmake --build build --config RelWithDebInfo -j 8

But still failing:

$ ./build/testbed --scene data/nerf/fox                                                    
10:54:22 INFO     Loading NeRF dataset from
10:54:22 INFO       data/nerf/fox/transforms.json
10:54:22 SUCCESS  Loaded 50 images after 0s
10:54:22 INFO       cam_aabb=[min=[1.0229,-1.33309,-0.378748], max=[2.46175,1.00721,1.41295]]
10:54:22 INFO     Loading network config from: configs/nerf/base.json
10:54:22 INFO     GridEncoding:  Nmin=16 b=1.51572 F=2 T=2^19 L=16
10:54:22 INFO     Density model: 3--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=3)]-->1
10:54:22 INFO     Color model:   3--[Composite]-->16+16--[FullyFusedMLP(neurons=64,layers=4)]-->3
10:54:22 INFO       total_encoding_params=13074912 total_network_params=10240
10:54:25 ERROR    GLFW error #65543: GLX: Failed to create context: GLXBadFBConfig
10:54:25 ERROR    Uncaught exception: GLFW window could not be created.
leosh64 commented 2 years ago

Setting LIBGL_ALWAYS_INDIRECT=0 helps to get past the GLFW error, but then the segmentation fault occurs again:

$ export LIBGL_ALWAYS_INDIRECT=0
$ ./build/testbed --scene data/nerf/fox
11:08:21 INFO     Loading NeRF dataset from
11:08:21 INFO       data/nerf/fox/transforms.json
11:08:21 SUCCESS  Loaded 50 images after 0s
11:08:21 INFO       cam_aabb=[min=[1.0229,-1.33309,-0.378748], max=[2.46175,1.00721,1.41295]]
11:08:21 INFO     Loading network config from: configs/nerf/base.json
11:08:21 INFO     GridEncoding:  Nmin=16 b=1.51572 F=2 T=2^19 L=16
11:08:21 INFO     Density model: 3--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=3)]-->1
11:08:21 INFO     Color model:   3--[Composite]-->16+16--[FullyFusedMLP(neurons=64,layers=4)]-->3
11:08:21 INFO       total_encoding_params=13074912 total_network_params=10240
Segmentation fault
leosh64 commented 2 years ago

Here's a backtrace from a debug build:

Thread 1 "testbed" received signal SIGSEGV, Segmentation fault.
0x00007ffff7fe6ea5 in ?? () from /lib64/ld-linux-x86-64.so.2
(gdb) bt
#0  0x00007ffff7fe6ea5 in ?? () from /lib64/ld-linux-x86-64.so.2
#1  0x00007fffef46f8b8 in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffa9e0, operate=<optimized out>,
    args=<optimized out>) at dl-error-skeleton.c:208
#2  0x00007fffef46f983 in __GI__dl_catch_error (objname=0x555557d823b0, errstring=0x555557d823b8, mallocedp=0x555557d823a8,
    operate=<optimized out>, args=<optimized out>) at dl-error-skeleton.c:227
#3  0x00007fffef84bb59 in _dlerror_run (operate=operate@entry=0x7fffef84b420 <dlclose_doit>, args=0x0) at dlerror.c:170
#4  0x00007fffef84b468 in __dlclose (handle=<optimized out>) at dlclose.c:46
#5  0x00007fffdc6caaa9 in ?? () from /usr/lib/wsl/drivers/nvdmui.inf_amd64_dc43e504bcb3da4d/libcuda.so.1.1
#6  0x00007fffdc66f221 in ?? () from /usr/lib/wsl/drivers/nvdmui.inf_amd64_dc43e504bcb3da4d/libcuda.so.1.1
#7  0x00007fffdc754508 in ?? () from /usr/lib/wsl/drivers/nvdmui.inf_amd64_dc43e504bcb3da4d/libcuda.so.1.1
#8  0x0000555555b40cb8 in __cudart1330 ()
#9  0x0000555555b93d91 in cudaGraphicsGLRegisterImage ()
#10 0x000055555597e4e6 in ngp::GLTexture::CUDAMapping::CUDAMapping (this=0x55555c7f9ab0, texture_id=3, size=...)
    at /home/user/playground/instant-ngp/src/render_buffer.cu:177
#11 0x000055555598245d in std::make_unique<ngp::GLTexture::CUDAMapping, unsigned int, Eigen::Matrix<int, 2, 1, 0, 2, 1>&> ()
    at /usr/include/c++/9/bits/unique_ptr.h:857
#12 0x000055555597db5e in ngp::GLTexture::surface (this=0x55555c299520) at /home/user/playground/instant-ngp/src/render_buffer.cu:92
#13 0x0000555555981ff9 in ngp::CudaRenderBuffer::surface (this=0x55555c299580)
    at /home/user/playground/instant-ngp/include/neural-graphics-primitives/render_buffer.h:168
#14 0x000055555597f6f7 in ngp::CudaRenderBuffer::tonemap (this=0x55555c299580, exposure=0, background_color=...,
    output_color_space=ngp::EColorSpace::SRGB, stream=0x555559bbe9f0) at /home/user/playground/instant-ngp/src/render_buffer.cu:571
#15 0x00005555555eca76 in ngp::Testbed::render_frame (this=0x7fffffffc8a0, camera_matrix0=..., camera_matrix1=...,
    nerf_rolling_shutter=..., render_buffer=..., to_srgb=true) at /home/user/playground/instant-ngp/src/testbed.cu:2475
#16 0x00005555555e33c3 in ngp::Testbed::train_and_render (this=0x7fffffffc8a0, skip_rendering=false)
    at /home/user/playground/instant-ngp/src/testbed.cu:1468
#17 0x00005555555e4b3c in ngp::Testbed::frame (this=0x7fffffffc8a0) at /home/user/playground/instant-ngp/src/testbed.cu:1733
#18 0x0000555555582200 in main (argc=3, argv=0x7fffffffe018) at /home/user/playground/instant-ngp/src/main.cu:229
BurningSquid commented 2 years ago

Same issue on my end:


21:42:14 INFO     Loading NeRF dataset from
21:42:14 INFO       data/nerf/fox/transforms.json
21:42:14 SUCCESS  Loaded 50 images after 0s
21:42:14 INFO       cam_aabb=[min=[1.0229,-1.33309,-0.378748], max=[2.46175,1.00721,1.41295]]
21:42:14 INFO     Loading network config from: configs/nerf/base.json
21:42:14 INFO     GridEncoding:  Nmin=16 b=1.51572 F=2 T=2^19 L=16
21:42:14 INFO     Density model: 3--[HashGrid]-->32--[FullyFusedMLP(neurons=64,layers=3)]-->1
21:42:14 INFO     Color model:   3--[Composite]-->16+16--[FullyFusedMLP(neurons=64,layers=4)]-->3
21:42:14 INFO       total_encoding_params=13074912 total_network_params=10240
Segmentation fault```