Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WSL support, update troubleshooting guide #8610

Merged
merged 13 commits into from
Jan 8, 2025
Merged

Fix WSL support, update troubleshooting guide #8610

merged 13 commits into from
Jan 8, 2025

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jan 7, 2025

Related

What

What's broken

Since Rerun 0.19 we picking in 2D & 3D view was broken & accompanied by log spam.

The reason we failed 0.19+ is unknown but likely either that something caused us picking the "webgl-like" compatibility tier or a change in wgpu no longer allows us to texture copy depth buffers.

Rerun 0.21 then broke startup entirely. This happens due to two distinct problems

  • we added a check that foresees the picking issue, aborts application start and tells the user to update their driver (which.. as far as I tried doesn't help)
  • wgpu did a validation related thing that that accidentally makes us fail startup because it makes the assumption that compute shader support == glsl support for buffers with runtime size (very very reasonable, but also wrong it turns out 😭 WSL2 GL device fails creation gfx-rs/wgpu#6841)

This Fix

I decided to move forward more aggressively in a manner that leaves all these intertwined issues behind and sets us up better for simpler & more advanced rendering in the future:

  • the troubleshooting guide now explains how to update the mesa drivers
  • we configure wgpu now such that it allows picking those non-compliant Vulkan drivers

-> As a result we can draw with Vulkan rather than a (typically) outdated GL driver which is in line with us moving slowly towards WebGPU support as the minspec.
(See code comments for remaining weirdness ;-))

Turns out another benefit with this is that multi-gpu setups behave like on the host now: Previously, MESA_D3D12_DEFAULT_ADAPTER_NAME had to be set to pick which adapter is used. Now all adapters are passed through WSL correctly, meaning that our regular adapter selection logic (which is to be further improved) works fine, i.e. it prefers discrete over integrated GPU unless WGPU_POWER_PREF=low is set.

Tested on WSL with

  • Ubuntu 22.04
  • Ubuntu 24.04

previous tests indicate that Ubuntu 20 should behave similar to 22.

Future work

Currently, there's a little bit of not super straight forward logging left from wgpu, warning about the wild GPU setup, but I actually feel better leaving this in for now - after all the WSL rendering stack is still rather adventurous and we should keep encouraging using the host system directly.

[2025-01-07T20:49:52Z INFO  re_sdk_comms::server] Hosting a SDK server over TCP at 0.0.0.0:9876. Connect with the Rerun logging SDK.
[2025-01-07T20:49:52Z WARN  wgpu_hal::vulkan::instance] InstanceFlags::VALIDATION requested, but unable to find layer: VK_LAYER_KHRONOS_validation
[2025-01-07T20:49:53Z WARN  wgpu_hal::gles::egl] Re-initializing Gles context due to Wayland window
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
[2025-01-07T20:49:54Z WARN  wgpu_hal::vulkan::adapter] Adapter is not Vulkan compliant: Microsoft Direct3D12 (NVIDIA GeForce RTX 4070)
[2025-01-07T20:49:54Z WARN  wgpu_hal::vulkan::adapter] Adapter is not Vulkan compliant: Microsoft Direct3D12 (AMD Radeon(TM) Graphics)
[2025-01-07T20:49:54Z WARN  wgpu_hal::gles::adapter] Max vertex attribute stride unknown. Assuming it is 2048
[2025-01-07T20:49:54Z WARN  wgpu_hal::vulkan::adapter] Adapter is not Vulkan compliant: Microsoft Direct3D12 (NVIDIA GeForce RTX 4070)
[2025-01-07T20:49:54Z WARN  wgpu_hal::vulkan::adapter] Adapter is not Vulkan compliant: Microsoft Direct3D12 (AMD Radeon(TM) Graphics)
[2025-01-07T20:49:54Z WARN  wgpu_hal::gles::adapter] Max vertex attribute stride unknown. Assuming it is 2048
[2025-01-07T20:49:54Z INFO  egui_wgpu] There were 4 available wgpu adapters: {backend: Vulkan, device_type: DiscreteGpu, name: "Microsoft Direct3D12 (NVIDIA GeForce RTX 4070)", driver: "Dozen", driver_info: "Mesa 24.3.3 - kisak-mesa PPA", vendor: NVIDIA (0x10DE), device: 0x2786}, {backend: Vulkan, device_type: IntegratedGpu, name: "Microsoft Direct3D12 (AMD Radeon(TM) Graphics)", driver: "Dozen", driver_info: "Mesa 24.3.3 - kisak-mesa PPA", vendor: AMD (0x1002), device: 0x164E}, {backend: Vulkan, device_type: Cpu, name: "llvmpipe (LLVM 15.0.7, 256 bits)", driver: "llvmpipe", driver_info: "Mesa 24.3.3 - kisak-mesa PPA (LLVM 15.0.7)", vendor: Mesa (0x10005)}, {backend: Gl, device_type: Other, name: "D3D12 (AMD Radeon(TM) Graphics)", driver_info: "4.2 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.3"}
[2025-01-07T20:49:54Z WARN  wgpu_core::instance] Missing downlevel flags: DownlevelFlags(FULL_DRAW_INDEX_UINT32 | SURFACE_VIEW_FORMATS)
   The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
[2025-01-07T20:49:54Z WARN  wgpu_core::instance] DownlevelCapabilities {
       flags: DownlevelFlags(
           COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLEND | VERTEX_STORAGE | ANISOTROPIC_FILTERING | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | NONBLOCKING_QUERY_RESOLVE | VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW,
       ),
       limits: DownlevelLimits,
       shader_model: Sm5,
   }

(what does bug me is the duplicated messages, may hint at some issues in either wgpu or our init dance... but that's a story for another time)

@Wumpf Wumpf added 💣 crash crash, deadlock/freeze, do-no-start include in changelog VM / WSL / Docker Issue happening only in a virtualized or dockerized environment labels Jan 7, 2025
Copy link

github-actions bot commented Jan 7, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
0d274bb https://rerun.io/viewer/pr/8610 +nightly +main

Note: This comment is updated whenever you push a commit.

Copy link

github-actions bot commented Jan 7, 2025

Latest documentation preview deployed successfully.

Result Commit Link
0d274bb https://landing-gh51uqs66-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

@Wumpf Wumpf marked this pull request as ready for review January 8, 2025 10:32
@Wumpf Wumpf added do-not-merge Do not merge this PR and removed do-not-merge Do not merge this PR labels Jan 8, 2025
@Wumpf Wumpf added the 🪳 bug Something isn't working label Jan 8, 2025
@emilk emilk self-requested a review January 8, 2025 15:11
crates/viewer/re_component_ui/src/marker_shape.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/config.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/config.rs Outdated Show resolved Hide resolved
crates/viewer/re_renderer/src/config.rs Outdated Show resolved Hide resolved
// We avoid doing anything wonky with surfaces anyways, so we won't hit this.
.intersection(wgpu::DownlevelFlags::SURFACE_VIEW_FORMATS.complement())
// Lack means we only get 2^24-1 indices for drawing.
// Typically we don't reach this limit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum. excellent question. I'll find out!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to be undefined behavior, couldn't find anything on it.
Clairifed comment though a bit: This is not the number of indices but the value for the indices, i.e. the vertex count is limited to 16.8mio if this flag is not present on the adapter

@Wumpf Wumpf merged commit 71215db into main Jan 8, 2025
31 checks passed
@Wumpf Wumpf deleted the andreas/fix-wsl branch January 8, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 💣 crash crash, deadlock/freeze, do-no-start include in changelog VM / WSL / Docker Issue happening only in a virtualized or dockerized environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rerun 0.21.0 WGPU Error on WSL
2 participants