Skip to content

[Feature Request] Improve Xnnpack execution provider capabilities and structure by calling the Xnnpack subgraph API instead of the operator AI when creating Xnnpack layer/kernel #24133

@pl121lp

Description

@pl121lp

Describe the feature request

Xnnpack execution provider currently calls the Xnnpack operatior APIs directly when creating a Xnnpack layer/kernel. For example: when creating conv layer the function "xnn_create_convolution2d_nhwc_f32" is called directly from conv_base.cc:CreateXnnpackKernel().

I gather it would be better for Xnnpack execution provider to use the Xnnpack subgraph API instead by calling the "define_" functions to create an xnnpack supported layer instead. For example: xnn_define_convolution_2d() which is part of the Xnnpack subgraph API.

Note that the Xnnpack runtime/execution capabilities does not have to be used (like Executorch and LiteRT does). Just use the Xnnpack subgraph API to handle creating of the Xnnpack layers.

By taking this approach the Xnnpack execution provider can be simplified since:

  1. it does not have to handle data type mapping to correct Xnnpack kernel
  2. have subgraph layer handle data validation
  3. benefit from any remapping to other kernel type (this is especially useful for the 1x1 convolution kernels that can be mapped to fully connected layer... the subgraph layer would take care of this).
  4. Implicit handling of reshape since appropriate reshape handling function is created during "define" call. This for instance will resolve current issues with 3Dx2D Matmul
  5. automatic creation of packing layers which is needed to support ARM SME use cases
  6. make the Xnnpack execution provider more futureproof as Xnnpack add new capabilities

Note that when using the subgraph API to create Xnnpack layers the actual created layer (xnn_operator type) object needs to be extracted from the subgraph object as follows: subgraph->nodes[x] ->op. (xnn_subgraph->xnn_node->xnn_operator)

Describe scenario use case

See above

Metadata

Metadata

Assignees

No one assigned

    Labels

    ep:Xnnpackissues related to XNNPACK EPfeature requestrequest for unsupported feature or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions