microsoft / microsoft/onnxruntime

[Feature Request] DirectML expose enumeration API

Open
#22,108 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api:CSharp ep:DML feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

When using DirectML, we have access to any DirectX 12 device and can run a model on that device provided it supports the required operators. However, there is no documentation for a way we can identify the available devices - namely, we can tell the DirectML EP to run on device ID 0, 1, ... but unless there's some mapping, how do we tell a priori which device we will use?

### Describe scenario use case

This becomes especially important when I want to use DirectML for both GPU devices and NPU devices (when supported).
Suppose I am on a system with two GPUs (let's say Intel primary and NVIDIA gaming) and an NPU that is supported by DirectML. Technically, all three of these devices should be visible to DirectML. Suppose I'm writing an application that can hot-switch the model to another device based on the user choice (i.e. I should list all the directX devices) - I cannot do that right now and even if I took the time to write the C# wrapper for DXGI (or find one that is properly maintained as of 2024), I would still then need to connect those to the IDs in DirectML's options input.

Contributor guide

Open the contributing guide

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.

Research direction

Start by reviewing DirectML execution-provider device-ID handling and the options input described in the issue. No files or tests are named, so first locate the existing device-selection implementation and documentation. Done means exposing the available DirectML devices and a reliable mapping between enumerated devices and the IDs accepted by the provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.