onnxruntime
ac216267 - DML EP EinSum make more generic to avoid EP fallback (#21114)

Commit
1 year ago
DML EP EinSum make more generic to avoid EP fallback (#21114) ### Problem Newer models using more novel equations (e.g. `bhwc,hkc->bhwk` in Segment Anything's encoder or `bqc,bchw->bqhw`) cause fallback from DML to CPU, yielding performance issues. The EP had some pattern matching to map more common equations to existing DML operators, but the number of permutations was prohibitive and could not catch them all. ### Solution So, ditch the static mapping, and instead handle any 1-input or 2-input cases via remapped strides and a mini-graph of elementwise multiplication & sum reduction (as if DML had a `DML_OPERATOR_DOT_PRODUCT` that took `axes`). A subset of mappings still exist for performance (GEMM, pure reduction, transpose...), but they are identified generally rather than via a pattern table. Also... - Diagonals are supported now (e.g. iji->i). - Removes any remaining DML-specific EinSum `GTEST_SKIP` statements. - Handles any cases up to 8 unique labels (DML dimension limit is 8D). - \>= 3 inputs and arbitrary size inputs via ellipsis are not handled, but we have yet to come across a model.
Author
Parents
Loading