gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.79k stars 938 forks source link

[d3d12] driver crash while allocating GPU memory #5288

Open nical opened 9 months ago

nical commented 9 months ago

CTS test: cts/webgpu/api/operation/vertex_state/correctness/cts.https.html?q=webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:*

Backtrace:

0  D3D12SDKLayers.dll + 0x559a6
     rax = 0x0000000000000001    rdx = 0x0000002640b1c898
     rcx = 0x0000000000000000    rbx = 0x0000002640b1c898
     rsi = 0x0000000000000000    rdi = 0x0000017f1b67a3c0
     rbp = 0x0000002640b1c7f0    rsp = 0x0000002640b1c6b0
      r8 = 0x000001802c65a8f0     r9 = 0x0000000000000040
     r10 = 0x0000000000000200    r11 = 0x0000002640b1c6e0
     r12 = 0x000001802a73eb70    r13 = 0x0000017f205d73c0
     r14 = 0x000001802a73eb00    r15 = 0x0000002640b1c984
     rip = 0x00007ffeb00d59a6
    Found by: given as instruction pointer in context
 1  D3D12SDKLayers.dll + 0x82301
     rbp = 0x0000002640b1c7f0    rsp = 0x0000002640b1c6f0
     rip = 0x00007ffeb0102302
    Found by: stack scanning
 2  D3D12Core.dll!<unknown in d3d12core.pdb> + 0x84a57
     rbp = 0x0000002640b1c7f0    rsp = 0x0000002640b1c738
     rip = 0x00007ffec08df9c0
    Found by: stack scanning
 3  D3D12SDKLayers.dll + 0x415a27
     rbp = 0x0000002640b1c7f0    rsp = 0x0000002640b1c778
     rip = 0x00007ffeb0495a28
    Found by: stack scanning
 4  D3D12SDKLayers.dll + 0x7a5c3
     rsp = 0x0000002640b1c870    rip = 0x00007ffeb00fa5c4
    Found by: stack scanning
 5  ntdll.dll!RtlpAllocateHeapInternal + 0x129
     rsp = 0x0000002640b1c890    rip = 0x00007fff0490c7ba
    Found by: stack scanning
 6  0x10433
     rbx = 0xfffffffffffffffe    rsi = 0x0000000000000000
     rdi = 0x0000000000000000    rbp = 0x0000000000000000
     rsp = 0x0000002640b1c990    r12 = 0x0000017f1b0cfac0
     r13 = 0x0000002640b1c980    r14 = 0x0000002640b1c984
     r15 = 0x0000017f00000001    rip = 0x0000000000010434
    Found by: call frame info
 7  D3D12SDKLayers.dll + 0x7328d
     rsp = 0x0000002640b1ca20    rip = 0x00007ffeb00f328e
    Found by: stack scanning
 8  ucrtbase.dll!__crt_state_management::wrapped_invoke<void* (*)(uint64_t), uint64_t, void*>(void* (*)(uint64_t), uint64_t) + 0x33
     rsp = 0x0000002640b1ca50    rip = 0x00007fff01d9ff74
    Found by: stack scanning
 9  0x17f205aaebf
     rbx = 0x0000017f21521dc0    rdi = 0x0000000000000004
     rsp = 0x0000002640b1ca80    rip = 0x0000017f205aaec0
    Found by: call frame info
10  D3D12Core.dll!CLayeredObject<CDescriptorHeap>::CContainedObject::AddRef(void) + 0xf
     rsp = 0x0000002640b1cac0    rip = 0x00007ffec0754890
    Found by: stack scanning
11  0xffff
     rsp = 0x0000002640b1caf0    rip = 0x0000000000010000
    Found by: call frame info
12  D3D12Core.dll!CLayeredObject<CD3D12ShaderCacheSession>::CContainedObject::Release(void) + 0xf
     rsp = 0x0000002640b1cb30    rip = 0x00007ffec077e010
    Found by: stack scanning
13  D3D12SDKLayers.dll + 0xd9b90
     rsp = 0x0000002640b1cb60    rip = 0x00007ffeb0159b91
    Found by: call frame info
14  D3D12Core.dll!ConvertDDICreateResource0088to0075_Helper::ConvertDDICreateResource0088to0075_Helper(D3D12DDIARG_CREATERESOURCE_0088const*) + 0x1a
     rsp = 0x0000002640b1cba0    rip = 0x00007ffec074fc3f
    Found by: stack scanning
15  0x1802a663e6f
     rsp = 0x0000002640b1cc30    rip = 0x000001802a663e70
    Found by: call frame info
16  D3D12Core.dll!CDevice::GetLayeredChildSize(unsigned int, void const*, uint64_t) + 0xec7
     rsp = 0x0000002640b1cd10    rip = 0x00007ffec076b2f0
    Found by: stack scanning
17  D3D12.dll!NOutermost::CDevice::CreateLayeredChild(unsigned int, void const*, uint64_t, ID3D12LayeredUseCounted*, _GUID const&, void**) + 0x189
     rbx = 0x0000002640b1d050    rsi = 0x00000000000004b8
     rdi = 0x0000000000000000    rsp = 0x0000002640b1cf80
     r12 = 0x0000000000000090    r14 = 0x000001802a663e50
     rip = 0x00007ffed5d01f4a
    Found by: call frame info
18  D3D12.dll!<unknown in d3d12.pdb> + 0x2072
     rsp = 0x0000002640b1cfb0    rip = 0x00007ffed5d1b060
    Found by: stack scanning
19  D3D12SDKLayers.dll + 0x15d1e
     rsp = 0x0000002640b1cfc0    rip = 0x00007ffeb0095d1f
    Found by: stack scanning
20  D3D12Core.dll!CHeap::GetDesc(void) + 0xd1
     rsp = 0x0000002640b1d0c0    rip = 0x00007ffec07e0ef2
    Found by: stack scanning
21  D3D12Core.dll!CDevice::CreateTestResourceAndHeap_Worker<D3D12_RESOURCE_STATES>(D3D12_HEAP_DESC const*, D3D12TEST_HEAP_FLAGS, ID3D12Heap*, ID3D12Resource*, uint64_t, void*, D3D12_RESOURCE_DESC1const*, D3D11_RESOURCE_FLAGS const*, D3D12TEST_RESOURCE_FLAGS, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, ID3D12ProtectedResourceSession*, ID3D12LifetimeTracker*, ID3D12SwapChainAssistant*, unsigned int, DXGI_FORMAT*, _GUID const&, void**, _GUID const&, void**) + 0x139e
     rbp = 0x0000000000080000    rsp = 0x0000002640b1d140
     rip = 0x00007ffec073a123
    Found by: call frame info
22  D3D12Core.dll!CDevice::CreatePlacedResource_Worker<D3D12_RESOURCE_STATES>(ID3D12Heap*, uint64_t, D3D12_RESOURCE_DESC1const*, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, unsigned int, DXGI_FORMAT*, _GUID const&, void**) + 0x139
     rbx = 0x0000002640b1d9a0    rsi = 0x0000017f61613880
     rdi = 0x0000017f20b04210    rbp = 0x0000000000080000
     rsp = 0x0000002640b1d860    r12 = 0x0000000000000000
     r13 = 0x0000002640b1dcf0    r14 = 0x0000000000080000
     r15 = 0x0000000000000000    rip = 0x00007ffec07368b6
    Found by: call frame info
23  D3D12Core.dll!CDevice::CreatePlacedResource(ID3D12Heap*, uint64_t, D3D12_RESOURCE_DESC const*, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, _GUID const&, void**) + 0x7e
     rbx = 0x0000000000000000    rsi = 0x0000017f61613880
     rdi = 0x0000017f20b04210    rbp = 0x0000000000080000
     rsp = 0x0000002640b1d950    r12 = 0x0000002640b1dcf0
     r13 = 0x0000017f616137a0    r14 = 0x0000000000000000
     r15 = 0x0000017f20b03100    rip = 0x00007ffec076157f
    Found by: call frame info
24  D3D12SDKLayers.dll + 0x23e0c
     rbx = 0x0000017f616137a0    rsi = 0x0000000000000000
     rdi = 0x0000017f20b031a0    rbp = 0x0000002640b1db11
     rsp = 0x0000002640b1da20    r12 = 0x0000002640b1dcf0
     r13 = 0x0000017f616137a0    r14 = 0x0000000000000000
     r15 = 0x0000017f20b03100    rip = 0x00007ffeb00a3e0d
    Found by: call frame info
25  xul.dll!<unknown in xul.pdb> + 0x16a63f1
     rbp = 0x0000002640b1db11    rsp = 0x0000002640b1da70
     rip = 0x00007ffebd6fd0c0
    Found by: stack scanning
26  D3D12SDKLayers.dll + 0x3eefef
     rbp = 0x0000002640b1db11    rsp = 0x0000002640b1da88
     rip = 0x00007ffeb046eff0
    Found by: stack scanning
27  xul.dll!winapi::um::d3d12::ID3D12Device::CreatePlacedResource(winapi::um::d3d12::ID3D12Heap*, unsigned long long, winapi::um::d3d12::D3D12_RESOURCE_DESC*, unsigned int, winapi::um::d3d12::D3D12_CLEAR_VALUE*, winapi::shared::guiddef::GUID*, core::ffi::c_void**) [d3d12.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 2351]
    Found by: inlining
28  xul.dll!wgpu_hal::dx12::suballocation::placed::create_buffer_resource(wgpu_hal::dx12::Device*, wgpu_hal::BufferDescriptor*, winapi::um::d3d12::D3D12_RESOURCE_DESC, d3d12::com::ComPtr<winapi::um::d3d12::ID3D12Resource>*) [suballocation.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 108]
    Found by: inlining
29  xul.dll!wgpu_hal::dx12::device::impl$1::create_buffer(wgpu_hal::dx12::Device*, wgpu_hal::BufferDescriptor*) [device.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 360 + 0x182]
     rsp = 0x0000002640b1db60    rip = 0x00007ffebb33a765
    Found by: stack scanning
30  xul.dll!<unknown in xul.pdb> + 0x49eb1
     rsp = 0x0000002640b1db78    rip = 0x00007ffebc0a0b80
    Found by: stack scanning
nical commented 9 months ago

Another instance of the same crash in cts/webgpu/api/validation/encoding/cmds/copyTextureToTexture/cts.https.html?q=webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:*. This time while creating a texture (but most of the stack looks the same):

 0  D3D12SDKLayers.dll + 0x559a6
     rax = 0x0000000000000001    rdx = 0x0000007e4c04ba38
     rcx = 0x0000000000000000    rbx = 0x0000007e4c04ba38
     rsi = 0x0000000000000000    rdi = 0x000001f8e6fc3da0
     rbp = 0x0000007e4c04b990    rsp = 0x0000007e4c04b850
      r8 = 0x000001f9a1274430     r9 = 0x0000000000000040
     r10 = 0x0000000000000100    r11 = 0x0000007e4c04b880
     r12 = 0x000001f8fed89510    r13 = 0x000001f8e61ed710
     r14 = 0x000001f8fed89500    r15 = 0x0000007e4c04bb24
     rip = 0x00007fff3faa59a6
    Found by: given as instruction pointer in context
 1  D3D12SDKLayers.dll + 0x82301
     rbp = 0x0000007e4c04b990    rsp = 0x0000007e4c04b890
     rip = 0x00007fff3fad2302
    Found by: stack scanning
 2  D3D12SDKLayers.dll + 0x415a27
     rbp = 0x0000007e4c04b990    rsp = 0x0000007e4c04b918
     rip = 0x00007fff3fe65a28
    Found by: stack scanning
 3  D3D12SDKLayers.dll + 0x7a5c3
     rsp = 0x0000007e4c04ba10    rip = 0x00007fff3faca5c4
    Found by: stack scanning
 4  ntdll.dll!RtlpAllocateHeapInternal + 0x129
     rsp = 0x0000007e4c04ba30    rip = 0x00007fff86e0c7ba
    Found by: stack scanning
 5  0x219bf
     rbx = 0xfffffffffffffffe    rsi = 0x0000000000000000
     rdi = 0x0000000000000000    rbp = 0x0000000000000000
     rsp = 0x0000007e4c04bb30    r12 = 0x000001f8e61842c0
     r13 = 0x0000007e4c04bb20    r14 = 0x0000007e4c04bb24
     r15 = 0x000001f800000001    rip = 0x00000000000219c0
    Found by: call frame info
 6  D3D12SDKLayers.dll + 0x7328d
     rsp = 0x0000007e4c04bbc0    rip = 0x00007fff3fac328e
    Found by: stack scanning
 7  ucrtbase.dll!__crt_state_management::wrapped_invoke<void* (*)(uint64_t), uint64_t, void*>(void* (*)(uint64_t), uint64_t) + 0x33
     rsp = 0x0000007e4c04bbf0    rip = 0x00007fff8429ff74
    Found by: stack scanning
 8  0x1f8d8de13ff
     rbx = 0x000001f8e7120fa0    rdi = 0x0000000000000034
     rsp = 0x0000007e4c04bc20    rip = 0x000001f8d8de1400
    Found by: call frame info
 9  D3D12Core.dll!CLayeredObject<CDescriptorHeap>::CContainedObject::AddRef(void) + 0xf
     rsp = 0x0000007e4c04bc60    rip = 0x00007fff40fc4890
    Found by: stack scanning
10  0xffff
     rsp = 0x0000007e4c04bc90    rip = 0x0000000000010000
    Found by: call frame info
11  D3D12Core.dll!CLayeredObject<CD3D12ShaderCacheSession>::CContainedObject::Release(void) + 0xf
     rsp = 0x0000007e4c04bcd0    rip = 0x00007fff40fee010
    Found by: stack scanning
12  D3D12SDKLayers.dll + 0xd9b90
     rsp = 0x0000007e4c04bd00    rip = 0x00007fff3fb29b91
    Found by: call frame info
13  D3D12Core.dll!ConvertDDICreateResource0088to0075_Helper::ConvertDDICreateResource0088to0075_Helper(D3D12DDIARG_CREATERESOURCE_0088const*) + 0x1a
     rsp = 0x0000007e4c04bd40    rip = 0x00007fff40fbfc3f
    Found by: stack scanning
14  0x1f9a131142f
     rsp = 0x0000007e4c04bdd0    rip = 0x000001f9a1311430
    Found by: call frame info
15  D3D12Core.dll!CDevice::GetLayeredChildSize(unsigned int, void const*, uint64_t) + 0xec7
     rsp = 0x0000007e4c04beb0    rip = 0x00007fff40fdb2f0
    Found by: stack scanning
16  D3D12.dll!NOutermost::CDevice::CreateLayeredChild(unsigned int, void const*, uint64_t, ID3D12LayeredUseCounted*, _GUID const&, void**) + 0x189
     rbx = 0x0000007e4c04c1f0    rsi = 0x00000000000004b8
     rdi = 0x0000000000000000    rsp = 0x0000007e4c04c120
     r12 = 0x0000000000000090    r14 = 0x000001f9a1311410
     rip = 0x00007fff7c041f4a
    Found by: call frame info
17  D3D12.dll!<unknown in d3d12.pdb> + 0x2072
     rsp = 0x0000007e4c04c150    rip = 0x00007fff7c05b060
    Found by: stack scanning
18  D3D12SDKLayers.dll + 0x15d1e
     rsp = 0x0000007e4c04c160    rip = 0x00007fff3fa65d1f
    Found by: stack scanning
19  D3D12Core.dll!CHeap::GetDesc(void) + 0xd1
     rsp = 0x0000007e4c04c260    rip = 0x00007fff41050ef2
    Found by: stack scanning
20  D3D12Core.dll!CDevice::CreateTestResourceAndHeap_Worker<D3D12_RESOURCE_STATES>(D3D12_HEAP_DESC const*, D3D12TEST_HEAP_FLAGS, ID3D12Heap*, ID3D12Resource*, uint64_t, void*, D3D12_RESOURCE_DESC1const*, D3D11_RESOURCE_FLAGS const*, D3D12TEST_RESOURCE_FLAGS, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, ID3D12ProtectedResourceSession*, ID3D12LifetimeTracker*, ID3D12SwapChainAssistant*, unsigned int, DXGI_FORMAT*, _GUID const&, void**, _GUID const&, void**) + 0x139e
     rbp = 0x0000000000000000    rsp = 0x0000007e4c04c2e0
     rip = 0x00007fff40faa123
    Found by: call frame info
21  D3D12Core.dll!CDevice::CreatePlacedResource_Worker<D3D12_RESOURCE_STATES>(ID3D12Heap*, uint64_t, D3D12_RESOURCE_DESC1const*, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, unsigned int, DXGI_FORMAT*, _GUID const&, void**) + 0x139
     rbx = 0x0000007e4c04cb40    rsi = 0x000001f8febbeb90
     rdi = 0x000001f8e6704420    rbp = 0x0000000000000000
     rsp = 0x0000007e4c04ca00    r12 = 0x0000000000000000
     r13 = 0x0000007e4c04cea0    r14 = 0x0000000000000000
     r15 = 0x0000000000000000    rip = 0x00007fff40fa68b6
    Found by: call frame info
22  D3D12Core.dll!CDevice::CreatePlacedResource(ID3D12Heap*, uint64_t, D3D12_RESOURCE_DESC const*, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE const*, _GUID const&, void**) + 0x7e
     rbx = 0x0000000000000000    rsi = 0x000001f8febbeb90
     rdi = 0x000001f8e6704420    rbp = 0x0000000000000000
     rsp = 0x0000007e4c04caf0    r12 = 0x0000007e4c04cea0
     r13 = 0x000001f8febbeab0    r14 = 0x0000000000000000
     r15 = 0x000001f8e6703310    rip = 0x00007fff40fd157f
    Found by: call frame info
23  D3D12SDKLayers.dll + 0x23e0c
     rbx = 0x000001f8febbeab0    rsi = 0x0000000000000000
     rdi = 0x000001f8e67033b0    rbp = 0x0000007e4c04ccb1
     rsp = 0x0000007e4c04cbc0    r12 = 0x0000007e4c04cea0
     r13 = 0x000001f8febbeab0    r14 = 0x0000000000000000
     r15 = 0x000001f8e6703310    rip = 0x00007fff3fa73e0d
    Found by: call frame info
24  xul.dll!<unknown in xul.pdb> + 0x16a6401
     rbp = 0x0000007e4c04ccb1    rsp = 0x0000007e4c04cc10
     rip = 0x00007fff32d4d0d0
    Found by: stack scanning
25  D3D12SDKLayers.dll + 0x3eefef
     rbp = 0x0000007e4c04ccb1    rsp = 0x0000007e4c04cc28
     rip = 0x00007fff3fe3eff0
    Found by: stack scanning
26  xul.dll!winapi::um::d3d12::ID3D12Device::CreatePlacedResource(winapi::um::d3d12::ID3D12Heap*, unsigned long long, winapi::um::d3d12::D3D12_RESOURCE_DESC*, unsigned int, winapi::um::d3d12::D3D12_CLEAR_VALUE*, winapi::shared::guiddef::GUID*, core::ffi::c_void**) [d3d12.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 2351]
    Found by: inlining
27  xul.dll!wgpu_hal::dx12::suballocation::placed::create_texture_resource(wgpu_hal::dx12::Device*, wgpu_hal::TextureDescriptor*, winapi::um::d3d12::D3D12_RESOURCE_DESC, d3d12::com::ComPtr<winapi::um::d3d12::ID3D12Resource>*) [suballocation.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 157]
    Found by: inlining
28  xul.dll!wgpu_hal::dx12::device::impl$1::create_texture(wgpu_hal::dx12::Device*, wgpu_hal::TextureDescriptor*) [device.rs:94c7d956509d4818aa4580c84b48e16a6933627b : 442 + 0x154]
     rsp = 0x0000007e4c04cd00    rip = 0x00007fff3098b151
    Found by: stack scanning
29  xul.dll!<unknown in xul.pdb> + 0x16a6401
     rsp = 0x0000007e4c04cd70    rip = 0x00007fff32d4d0d0
    Found by: stack scanning