Skip to content

Conversation

@fdwr
Copy link
Contributor

@fdwr fdwr commented Nov 15, 2025

✋⏸️ Pause review for now, as there are some test failures:

Description

Fixes #26529. 5D or greater inputs are unsupported by DML's DML_GEMM_OPERATOR_DESC (supports 2D to 4D), and so higher ranks need to be reduced to 4D, which is achieved by folding any leading dimensions into the first dimension. So a 5D shape of [3,4,5,6,7] becomes 4D [12,4,5,6,7]. Note this approach is not fully generic for all broadcasting cases (which would need DML support), as it doesn't support a mixture of both broadcasting and non-broadcasting in the leading batch dimensions (yielding an error), but it least supports cases where all the batch dimensions are broadcasted or none of the batch dimensions are broadcasted.

{
  "tests": [
    {
      "graph_name": "MatMul float32 5D",
      "op_type": "MatMul",
      "version": 1,
      "A": [[[[[1, 2, 3], [4, 5, 6]]]], [[[[2, 3, 4], [5, 6, 7]]]]],
      "B": [[[[[1, 2], [3, 4], [5, 6]]]], [[[[2, 3], [4, 5], [6, 7]]]]],
      "Y": [[[[[22, 28], [49, 64]]]], [[[[40, 49], [76, 94]]]]],
      "T": "float32"
    }

Test result

@fdwr fdwr requested a review from sumitsays November 15, 2025 09:31
@fdwr fdwr added the ep:DML issues related to the DirectML execution provider label Nov 15, 2025
@fdwr fdwr changed the title Restrict DML EP MatMul to 4D [DML EP] Restrict MatMul to 4D Nov 15, 2025
@fdwr fdwr marked this pull request as draft November 15, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:DML issues related to the DirectML execution provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ORT GPU (DML)][WebNN] Exception during initialization when running some WebNN matmul and triangular tests with 5D input

2 participants