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

CRASH in wgpuInstanceRequestAdapter, D3D12 backend, Razer Blade Intel Graphics #370

Open
garettbass opened this issue Feb 21, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@garettbass
Copy link

I have reproduced this crash using v0.18.1.4 and an older version for which I only have the commit SHA 22eaa9caeb4e856cb926ca54eefa9f783fc4c524. The crash occurs when I call wgpuInstanceRequestAdapter() with the following options:

WGPURequestAdapterOptions opts {
    .powerPreference = WGPUPowerPreference_HighPerformance,
};

On this Razer Blade, I would expect .powerPreference = WGPUPowerPreference_HighPerformance to select the NVIDIA adapter, but the crash appears to be in the function ctlGetSet3DFeature(), which seems to be an Intel Graphics API.
If I explicitly select .backendType = WGPUBackendType_Vulkan, there is no crash, and I do get an NVIDIA adapter.

Below is a stack trace of the crash obtained using StackWalk64():

exception: breakpoint
    0 ctlGetSet3DFeature
    1 ctlGetSet3DFeature
    2 ctlGetSet3DFeature
    3 ctlGetSet3DFeature
    4 ctlGetSet3DFeature
    5 ?
    6 ?
    7 ?
    8 ?
    9 ?
   10 D3D12GetInterface
   11 D3D12GetInterface
   12 ?
   13 ?
   14 ?
   15 ?
   16 D3D12GetInterface
   17 D3D12CreateDevice
   18 D3D12CreateDevice
   19 _ZN8wgpu_hal4dx127adapter41_$LT$impl$u20$wgpu_hal..dx12..Adapter$GT$6expose17h63dc652a0cae2d45E
   20 _ZN5alloc3vec16in_place_collect108_$LT$impl$u20$alloc..vec..spec_from_iter..SpecFromIter$LT$T$C$I$GT$$u20$for$u20$alloc..vec..Vec$LT$T$GT$$GT$9from_iter17h42b957e4d40723c1E
   21 _ZN8wgpu_hal4dx128instance100_$LT$impl$u20$wgpu_hal..Instance$LT$wgpu_hal..dx12..Api$GT$$u20$for$u20$wgpu_hal..dx12..Instance$GT$18enumerate_adapters17h3b9085f5c279362fE
   22 _ZN9wgpu_core8instance52_$LT$impl$u20$wgpu_core..global..Global$LT$G$GT$$GT$15request_adapter6gather17h3d0002381ff5cc91E
   23 _ZN9wgpu_core8instance52_$LT$impl$u20$wgpu_core..global..Global$LT$G$GT$$GT$15request_adapter17ha2e1e1d44597edb5E
   24 wgpuInstanceRequestAdapter
   25 `gtb::gpu::wgpu_api::wgpu_api(struct gtb::app::api &)'::`1'::<lambda_2>::operator()(void)const
   26 gtb::gpu::wgpu_api::wgpu_api(struct gtb::app::api &)
   27 main
   28 WinMain
   29 __scrt_common_main_seh
   30 BaseThreadInitThunk
   31 RtlUserThreadStart
@garettbass
Copy link
Author

I get the same crash with these options as well:

WGPURequestAdapterOptions opts {
    .powerPreference = WGPUPowerPreference_LowPower,
};
WGPURequestAdapterOptions opts {
    .backendType = WGPUBackendType_D3D12,
};
WGPURequestAdapterOptions opts {
};

@nical nical added the bug Something isn't working label Feb 21, 2024
@rajveermalviya

This comment was marked as off-topic.

@rajveermalviya
Copy link
Collaborator

@garettbass, is this reproducible reliably with wgpu-native?
If so, can you also try the wgpu rust examples?

~> # Install Rust toolchain - https://www.rust-lang.org/learn/get-started
~> git clone https://github.com/gfx-rs/wgpu.git
~> cd wgpu
~> cargo run --bin wgpu-examples hello_triangle

@garettbass
Copy link
Author

I am happy to investigate, but there may be a delay before I can undertake this due to other pressing issues. Thank you for the informative recommendation.

@frapa
Copy link

frapa commented May 22, 2024

I reproduced this issue with

WGPURequestAdapterOptions opts {
    .powerPreference = WGPUPowerPreference_LowPower,
};

Unless you pass WGPUPowerPreference_Undefined, it's gonna crash if you pass this settings. I am calling wgpu_native from C code. My error looks like this:

X Error of failed request:  136
  Major opcode of failed request:  148 ()
  Minor opcode of failed request:  1
  Serial number of failed request:  310
  Current serial number in output stream:  310

Changing this line in the triangle demo causes the demo to crash with exactly the same error, so easy to reproduce for me. I have a discrete Nvidia GPU + an integrated Intel one if that helps.

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

4 participants