Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

BindTemporaryResource hangs on new IDMLDevice after prior device removal during operator initializer dispatch

Open
#735 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp

Research direction

Start by running the documented reproduction sequence with DirectML 1.15.4, focusing on device removal during operator initializer dispatch and the later BindTemporaryResource call. Compare it with device removal during inference, which does not reproduce the hang. Done means identifying the cause of the CPU deadlock and verifying that BindTemporaryResource returns on the newly created device.

Written by the indexing model from the issue text.

Description

Summary

IDMLBindingTable::BindTemporaryResource with a non-null buffer deadlocks CPU-side (never returns, no exception, no error HRESULT) on a freshly-created IDMLDevice when a prior IDMLDevice in the same process experienced device removal during operator initializer dispatch.

The deadlock is conditional on the cause of the prior device removal: device removal during inference does NOT cause this hang on the revival device. Only device removal during the initial operator initializer dispatch poisons subsequent device creation in the same process.

Environment

  • DirectML.dll version: 1.15.4
  • OS: Windows 11 Pro Version 25H2 (OS Build 26200.8117)
  • GPU: NVIDIA RTX 4060 Ti 16GB
  • GPU driver version: 595.97
  • D3D12 feature level: 12 (12_2)

Reproduction Conditions

The deadlock requires all three of the following:

  1. A prior IDMLDevice in the same process experienced device removal (GetDeviceRemovedReason returns DXGI_ERROR_DEVICE_HUNG / 0x887A0005) during an IDMLOperatorInitializer dispatch
  2. A new IDMLDevice is created via DMLCreateDevice after the prior device's removal (the underlying ID3D12Device is still alive — only the DML device died)
  3. A binding table is created on the new device for an IDMLOperatorInitializer whose GetBindingProperties().TemporaryResourceSize > 0, and BindTemporaryResource is called with a non-null DML_BUFFER_BINDING

When all three hold, BindTemporaryResource does not return. The calling thread blocks indefinitely.

Reproduction Sequence

// 1. First IDMLDevice runs a 2225-op operator initializer.
//    The dispatch's ExecuteCommandLists returns success and the wait fence advances,
//    but GetDeviceRemovedReason reports 0x887A0005 immediately afterward.
//    (Specific model: RAFT optical flow, 2225 ops, tempSz=50,323,456 bytes,
//    8 persistent-buffer Conv ops at persistSz=86,528 each.)

// 2. Create new IDMLDevice on the same (still-alive) ID3D12Device
ComPtr<IDMLDevice> revivalDml;
DMLCreateDevice(d3d12Device.Get(), DML_CREATE_DEVICE_FLAG_NONE,
                IID_PPV_ARGS(&revivalDml));  // succeeds

// 3. Build operator initializer for the same 2225 ops
ComPtr<IDMLOperatorInitializer> init;
revivalDml->CreateOperatorInitializer(2225, compiledOps, IID_PPV_ARGS(&init));

DML_BINDING_PROPERTIES bp = init->GetBindingProperties();
// bp.TemporaryResourceSize    = 50,323,456
// bp.PersistentResourceSize   = 692,224  (8 * 86,528)
// bp.RequiredDescriptorCount  = 84

// 4. Allocate fresh resources on revival device
//    (NOT reused from prior device — all freshly created)
ComPtr<ID3D12DescriptorHeap> heap = CreateDescriptorHeap(84);
ComPtr<IDMLBindingTable>     bt   = CreateBindingTable(init.Get(), heap.Get(), 84);
ComPtr<ID3D12Resource>       tempBuf = CreateUAVBuffer(50'323'456);

// 5. Bind temporary resource — DEADLOCKS HERE, never returns
DML_BUFFER_BINDING bb = { tempBuf.Get(), 0, 50'323'456 };
DML_BINDING_DESC   desc = { DML_BINDING_TYPE_BUFFER, &bb };
bt->BindTemporaryResource(&desc);   // CPU hang

Dominant language
C++
Stars
2.6k
Forks
338
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectML

All issues in microsoft/DirectML

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.