microsoft / microsoft/onnxruntime

[Feature Request] CPU EP `Where` data type registration, add int8 and uint32

Open
#25,306 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Describe the feature request

The CPU EP Where op awkwardly supports unsigned uint8 and signed int32, but not signed int8 and unsigned uint32. Since the logic is already there for uint8, adding int8 adds no code bloat (because it's simply a reinterpret_cast or BitCast away), and similar for uint32. So there is no binary size tradeoff to consider here.

Op Inputs Outputs
Where condition:B
X:T
Y:T
output:T = tensor(double), tensor(float), tensor(int32), tensor(int64), tensor(string), tensor(uint8)

https://github.com/microsoft/onnxruntime/blob/main/docs/OperatorKernels.md#operators-implemented-by-cpuexecutionprovider

More broadly, this is actually true of all pure data movement operators (Gather, GatherElements, GatherND, ScatterElements, ScatterND, OneHot, Where, Tile, Expand...), that ORT should just register sibling data types of the same bitsize if a data type of that bitsize is already registered (so an op with uint8 registered implies int8 and bool8 are also supported, uint32 implies int32 and float32, uint64 implies int64 and float64...). Note at least one other EP (DML EP) already follows this rule data movement operators, that any data type of a given bitsize implies the others are registered too, and we want the CPU EP (as the ultimate fallback EP for ORT) to be at least as complete in coverage for these ops as the smaller EPs.

Describe scenario use case

Implementing the WebNN API in Chromium with OnnxRuntime.dll as a backend.

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 with the CPU Execution Provider section for Where in docs/OperatorKernels.md and compare the registered data types with the issue's table. Review the linked WebNN and Chromium context to clarify whether the work is limited to Where or the broader set of data-movement operators; done means the agreed CPU EP coverage is documented and supported by the relevant validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.