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

regression: compute example doesn't work on wayland #6097

Closed
sigmaSd opened this issue Aug 10, 2024 · 12 comments
Closed

regression: compute example doesn't work on wayland #6097

sigmaSd opened this issue Aug 10, 2024 · 12 comments
Labels
platform: wayland Issues with integration with linux/wayland type: bug Something isn't working

Comments

@sigmaSd
Copy link

sigmaSd commented Aug 10, 2024

context: denoland/deno#24857

This used to work with old versions of wgpu (the one thats used by deno 1.43.0 ) but I didn't search for the version yet

Problem:

Running the compute example fails with

No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
thread 'main' panicked at /home/mrcool/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
 In Device::create_compute_pipeline
   Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

the deafult value in fedora for XDG_RUNTIME_DIR is /run/user/1000

if I run with that variable unset or changed to another location it works

XDG_RUNTIME_DIR="/tmp" cargo r
No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
Steps: [0, 1, 7, 2]
@sigmaSd
Copy link
Author

sigmaSd commented Aug 10, 2024

platform
fedora 40 Linux fedora 6.9.11-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 25 18:17:34 UTC 2024 x86_64 GNU/Linux
Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz

@sigmaSd
Copy link
Author

sigmaSd commented Aug 10, 2024

also forcing the hello-compute example to run on xorg make it work correctly

WAYLAND_DISPLAY="" cargo r

@sigmaSd
Copy link
Author

sigmaSd commented Aug 10, 2024

It seems like changing XDG_RUNTIME_DIR is equivalent to running on xorg from the point of view of applications , so the problem lies in the relation with wayland

Its weird that the rendering examples (like hello-triangle, and the others) where not affected by this, but the compute exampe (which didn't occur to me it would need to know about the compositor) is affeced

@sigmaSd sigmaSd changed the title regression: compute example doesn't work if XDG_RUNTIME_DIR=/run/user/1000 regression: compute example doesn't work on wayland Aug 10, 2024
@Wumpf Wumpf added type: bug Something isn't working platform: wayland Issues with integration with linux/wayland labels Aug 12, 2024
@sigmaSd
Copy link
Author

sigmaSd commented Aug 13, 2024

0.18.0 works

0.19.0 gives an error

No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
thread 'main' panicked at src/main.rs:57:10:
called `Result::unwrap()` on an `Err` value: RequestDeviceError { inner: Core(LimitsExceeded(FailedLimit { name: "max_compute_workgroups_per_dimension", requested: 65535, allowed: 0 })) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0.20.0 gives a different error

No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
thread 'main' panicked at /home/mrcool/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
 In Device::create_compute_pipeline
   Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@sigmaSd
Copy link
Author

sigmaSd commented Aug 13, 2024

Maybe it helps, with a minimal wayland server it works correctly
server.c

#include <stdio.h>
#include <stdlib.h>
#include <wayland-server.h>

// Forward declarations
static void bind_compositor(struct wl_client *client, void *data, uint32_t version, uint32_t id);
static void bind_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id);

int main(int argc, char *argv[])
{
    struct wl_display *display = wl_display_create();
    if (!display) {
        printf("Failed to create Wayland display\n");
        return 1;
    }

    const char *socket = wl_display_add_socket_auto(display);
    if (!socket) {
        printf("Failed to add Wayland socket\n");
        wl_display_destroy(display);
        return 1;
    }

    fprintf(stderr, "Running Wayland server on %s\n", socket);

    // Create a global for the compositor interface
    struct wl_global *compositor_global = wl_global_create(display, &wl_compositor_interface, 4, NULL, bind_compositor);
    if (!compositor_global) {
        printf("Failed to create compositor global\n");
        wl_display_destroy(display);
        return 1;
    }

    // Create a global for the shell interface
    struct wl_global *shell_global = wl_global_create(display, &wl_shell_interface, 1, NULL, bind_shell);
    if (!shell_global) {
        printf("Failed to create shell global\n");
        wl_display_destroy(display);
        return 1;
    }

    // Start the Wayland server
    wl_display_init_shm(display); // Initialize shared memory support

    wl_display_run(display);
    wl_display_destroy(display);
    return 0;
}

// Compositor bind function
static void bind_compositor(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
    struct wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, version, id);
    if (!resource) {
        wl_client_post_no_memory(client);
        return;
    }
}

// Shell bind function
static void bind_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
    struct wl_resource *resource = wl_resource_create(client, &wl_shell_interface, version, id);
    if (!resource) {
        wl_client_post_no_memory(client);
        return;
    }
}

the servers I tried are mutter and weston, both error the same way

@teoxoy
Copy link
Member

teoxoy commented Aug 14, 2024

This is probably a result of #4718.
It worked in 0.18 because that PR is part of 0.19+.

The validation errors you are getting are expected as the OpenGL backend/driver are more limited.

@teoxoy
Copy link
Member

teoxoy commented Aug 14, 2024

Does changing XDG_RUNTIME_DIR select a different OpenGL driver? That would explain why it works or why it doesn't.
It's not something we have control over though.

@sigmaSd
Copy link
Author

sigmaSd commented Aug 14, 2024

Im using the vulkan backend,

Wayland clients looks for Wayland sockets in XDG_RUNTIME_DIR so when it's changed the apps fallback to xorg, this have no relation to opengl or backbends as far as I can tell

@teoxoy
Copy link
Member

teoxoy commented Aug 14, 2024

Do you have multiple Vulkan drivers installed? Could you include the AdapterInfo when testing on 0.18 and on 0.19+ also with the different XDG_RUNTIME_DIR settings?

@sigmaSd
Copy link
Author

sigmaSd commented Aug 14, 2024

in version 0.19.0

wayland

[src/main.rs:44:5] &adapter.get_info() = AdapterInfo {
    name: "Mesa Intel(R) HD Graphics 4000 (IVB GT2)",
    vendor: 32902,
    device: 0,
    device_type: IntegratedGpu,
    driver: "",
    driver_info: "",
    backend: Gl,
}

xorg

No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
[src/main.rs:44:5] &adapter.get_info() = AdapterInfo {
    name: "llvmpipe (LLVM 18.1.6, 256 bits)",
    vendor: 65541,
    device: 0,
    device_type: Cpu,
    driver: "llvmpipe",
    driver_info: "Mesa 24.1.5 (LLVM 18.1.6)",
    backend: Vulkan,
}
Steps: [0, 1, 7, 2]

so it seems like when I use wayland it indeed use opengl backend,

and xorg it uses vulkan backend but with the cpu implementation

so I guess I have a coupe of remarks/questions left

  • I still have this message printed MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete when running on wayland that's why I thought its using the vulkan backend
  • I wanted to try the vulkan backend in wayland but WGPU_BACKEND=vulkan doesn't work, that's probably on purpose because the cpu is not supported but is it possible like xorg to use llvmpipe ?

So indeed its because of the old cpu, though I think it would be great if the error message said your cpu is not supported

@sigmaSd sigmaSd closed this as completed Aug 14, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in WebGPU for Firefox Aug 14, 2024
@sigmaSd
Copy link
Author

sigmaSd commented Aug 14, 2024

also I want to try vulkan in wayland but this doesn't work (it still chooses gl)

WGPU_BACKEND=vulkan WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1 $CARGO_TARGET_DIR/debug/a
No numbers were provided, defaulting to [1, 2, 3, 4]
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
[src/main.rs:44:5] &adapter.get_info() = AdapterInfo {
    name: "Mesa Intel(R) HD Graphics 4000 (IVB GT2)",
    vendor: 32902,
    device: 0,
    device_type: IntegratedGpu,
    driver: "",
    driver_info: "",
    backend: Gl,
}
thread 'main' panicked at src/main.rs:58:10:
called `Result::unwrap()` on an `Err` value: RequestDeviceError { inner: Core(LimitsExceeded(FailedLimit { name: "max_compute_workgroups_per_dimension", requested: 65535, allowed: 0 })) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@teoxoy
Copy link
Member

teoxoy commented Aug 15, 2024

I think the "MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete" message is printed by the driver itself which happens before we filter out the driver.

So indeed its because of the old cpu, though I think it would be great if the error message said your cpu is not supported

I think we do show a warning, make sure to set RUST_LOG to warn or lower.

also I want to try vulkan in wayland but this doesn't work (it still chooses gl)

The env var won't work unless you hook it up.

You should set the InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER flag instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: wayland Issues with integration with linux/wayland type: bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants