Skip to content

Generic API for ops that are require context, such as packed weights. #34913

@kimishpatel

Description

@kimishpatel

🚀 Feature

A generic API that encapsulates certain operators that require contexts. For example weights are prepacked in certain format.

Pitch

  • Instead of using _xnnpack::conv2d_prepack and _xnnpack::conv2d_packed, prepacked::.., prepacked::..
    • Conv:
      • prepacked::conv2d_clamp_prepack -> Conv2dOpContext
      • prepacked::conv2d_clamp_run
    • Linear:
      • prepacked::linear_clamp_prepack -> LinearOpContext
      • prepacked::linear_clamp_run
    • OpContext:
      • Stores the engine info or backend info to be used by _packed ops during op execution.
    • Context creation during deserialization can use heuristics to decide which backend to chose from available ones.
      • e.g. if mobile has both XNNPACK and GPU backend available, some heuristics may help decided which backend to use and create context accordingly.
      • For now this can be just based on global context. e.g. if xnnpack backend enabled (and is only enabled on mobile) pack for xnnpack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA request for a proper, new feature.triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions