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

Error compiling and running example runners/ash #31

Open
utensil opened this issue Oct 11, 2024 · 4 comments
Open

Error compiling and running example runners/ash #31

utensil opened this issue Oct 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@utensil
Copy link

utensil commented Oct 11, 2024

Expected Behaviour

Example runners/ash compiles and runs.

Example & Steps To Reproduce

  1. git clone https://github.com/Rust-GPU/rust-gpu
  2. cd rust-gpu/yard-rs/example-xp/rust-gpu/examples/runners/ash
  3. cargo run --release
  4. error:
thread 'main' panicked at examples/runners/ash/src/main.rs:255:10:
called `Result::unwrap()` on an `Err` value: CratePathDoesntExist("examples/shaders/sky-shader")

Following the working example multibuilder, one can change the error line from

SpirvBuilder::new("examples/shaders/sky-shader", "spirv-unknown-vulkan1.1")

to

SpirvBuilder::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../../shaders/sky-shader"), "spirv-unknown-vulkan1.1")

Now the example and the shader crate compiles, but running it gives an error

[mvk-error] VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_shader_non_semantic_info is not supported.
thread 'main' panicked at examples/runners/ash/src/main.rs:441:22:
called `Result::unwrap()` on an `Err` value: ERROR_EXTENSION_NOT_PRESENT

This might be fixable by updating ash, or might not be fixable at the moment. In the latter case, an explicit "support matrix"-ish table would be nice.

System Info

  • Rust: rustc 1.79.0-nightly (244da22fa 2024-04-23)
  • OS: MacBook Pro M1, 16-inch, 2021, macOS 14.4.1 (23E224)
  • GPU: Integrated
  • SPIR-V: SPIRV-Tools v2024.3 unknown hash, 2024-06-20T14:29:42+00:00

Backtrace

N/A

Backtrace

<backtrace>

@LegNeato LegNeato added the bug Something isn't working label Oct 11, 2024
@Firestar99
Copy link
Member

CratePathDoesntExist("examples/shaders/sky-shader")

It can also be worked around by doing cargo run --bin example-runner-ash in the root of the repo, but ideally your way should also work

VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_shader_non_semantic_info is not supported

That is your device / driver not supporting the VK_KHR_shader_non_semantic_info extension, which should be available on literally all platforms. As you're on MacOS: The MoltenVK driver also lists this extension as supported, so could you try updating it?

@utensil
Copy link
Author

utensil commented Oct 14, 2024

Thanks for the reply!

For the path issue, it's better to make it robust despite the working directory.

For the Vulkan extension issue, the version of MoltenVK in use seems to be determined by

[target.'cfg(target_os = "macos")'.dependencies]
ash-molten = { version = "0.13.1", features = ["pre-built"] }

so I tried bumping this, unfortunately none worked, the results per version are:

v0.14.0+1.1.10:  VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_shader_non_semantic_info is not supported

v0.15.0+1.2.2:
[mvk-error] VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_shader_non_semantic_info is not supported.
[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested feature is not available on this device.
[mvk-info] Created VkDevice to run on GPU Apple M1 Pro with the following 1 Vulkan extensions enabled:
                VK_KHR_swapchain v70
thread 'main' panicked at examples/runners/ash/src/main.rs:441:22:

v0.16.0+1.2.6:

[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested physical device feature specified by the 1st flag in VkPhysicalDeviceVulkanMemoryModelFeatures is not available on this device.
[mvk-info] Created VkDevice to run on GPU Apple M1 Pro with the following 2 Vulkan extensions enabled:
                VK_KHR_shader_non_semantic_info v1
                VK_KHR_swapchain v70
[mvk-info] Destroyed VkDevice on GPU Apple M1 Pro with 2 Vulkan extensions enabled.

v0.17.0+1.2.7:
[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested physical device feature specified by the 1st flag in VkPhysicalDeviceVulkanMemoryModelFeatures is not available on this device.

v0.18.0+1.2.8:
[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCreateDevice(): Requested physical device feature specified by the 1st flag in VkPhysicalDeviceVulkanMemoryModelFeatures is not available on this device.
[mvk-info] Created VkDevice to run on GPU Apple M1 Pro with the following 2 Vulkan extensions enabled:
                VK_KHR_shader_non_semantic_info v1
                VK_KHR_swapchain v70

v0.19.0+1.2.8:

compilation error:
error[E0308]: mismatched types
   --> examples/runners/ash/src/main.rs:338:38
    |
338 |                     .create_instance(&instance_create_info, None)
    |                      --------------- ^^^^^^^^^^^^^^^^^^^^^ expected `&InstanceCreateInfo<'_>`, found `&InstanceCreateInfoBuilder<'_>`
    |                      |
    |                      arguments to this method are incorrect
    |
    = note: expected reference `&ash::vk::definitions::InstanceCreateInfo<'_>`
               found reference `&InstanceCreateInfoBuilder<'_>`

...omitted...

@utensil
Copy link
Author

utensil commented Oct 14, 2024

Per MoltenVK's changelog, the support for VK_KHR_shader_non_semantic_info is added in MoltenVK 1.2.5, so at least not present in the version v0.13.1+1.1.10 of ash-molten in use by the example.

From the error log above, one can see that indeed after v0.16.0+1.2.6, it starts to complain about another feature: "Requested physical device feature specified by the 1st flag in VkPhysicalDeviceVulkanMemoryModelFeatures is not available on this device" and the VK_KHR_shader_non_semantic_info v1 is successfully enabled.

@Firestar99
Copy link
Member

Firestar99 commented Oct 15, 2024

Afaik rust-gpu always writes it's shaders as requiring the VulkanMemoryModel to make sure it's atomic intrinsics work correctly (as before the vulkan memory model atomics were very vague about how they should actually work), even if the shaders themselves don't use atomics. And again it was assumed every major vendor has implemented it, given how critical it is. So I'm very surprised to be unable to even find a mention of that extension in MoltenVK's docs.
https://vulkan.gpuinfo.org/listdevicescoverage.php?platform=macos&extension=VK_KHR_vulkan_memory_model

And I would guess most devs using apple have been using it via wgpu, so noone noticed the regression.

I'll be forwarding this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants