SIGN IN SIGN UP

Implement initial SDK profiler support in XNNPACK delegate (#1632)

Summary:
Initial implementation of SDK support in the XNNPACK delegate. Does not include support for mapping event blocks to edge graph node IDs yet, but does implement a baseline level of support by tracing XNNPACK profiler output. Implementation of debug handle association with event tracing will be implemented as a follow-up.

Also update XNNPACK AOT and runner example scripts to support ETDump and ETRecord generation.
 Example AOT invocation: `python3 -m examples.xnnpack.aot_compiler --model_name="mv2" --delegate -r mv2_etrecord.bin`

Example output (MV2 example model, `Inspector.print_data_tabular()`):
```
╒════╤════════════════════╤═══════════════════════════════════╤════════════╤════════════╤════════════╤════════════╤════════════╤════════════╤══════════════════════════════════════════════════╤═══════════════════╤═════════════════════════╕
│    │ event_block_name   │ event_name                        │   p10 (ms) │   p50 (ms) │   p90 (ms) │   avg (ms) │   min (ms) │   max (ms) │ op_types                                         │ is_delegated_op   │ delegate_backend_name   │
╞════╪════════════════════╪═══════════════════════════════════╪════════════╪════════════╪════════════╪════════════╪════════════╪════════════╪══════════════════════════════════════════════════╪═══════════════════╪═════════════════════════╡
│  0 │ Default            │ Method::init                      │   28.3858  │   28.3858  │   28.3858  │   28.3858  │   28.3858  │   28.3858  │ []                                               │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  1 │ Default            │ Program::load_method              │   28.3976  │   28.3976  │   28.3976  │   28.3976  │   28.3976  │   28.3976  │ []                                               │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  2 │ Execute            │ Transpose (ND, X32)               │    1       │    1       │    1       │    1       │    1       │    1       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  3 │ Execute            │ Convolution (NHWC, F32) IGEMM     │  217       │  217       │  217       │  217       │  217       │  217       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  4 │ Execute            │ Convolution (NHWC, F32) DWConv    │  105       │  105       │  105       │  105       │  105       │  105       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  5 │ Execute            │ Convolution (NHWC, F32) GEMM      │  227       │  227       │  227       │  227       │  227       │  227       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  6 │ Execute            │ Add (ND, F32)                     │    3       │    3       │    3       │    3       │    3       │    3       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  7 │ Execute            │ Global Average Pooling (NWC, F32) │   15       │   15       │   15       │   15       │   15       │   15       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  8 │ Execute            │ DELEGATE_CALL                     │   11.9553  │   11.9553  │   11.9553  │   11.9553  │   11.9553  │   11.9553  │ ['aten.view_copy.default', 'aten.clone.default'] │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│  9 │ Execute            │ native_call_view_copy.out         │    0.01666 │    0.01666 │    0.01666 │    0.01666 │    0.01666 │    0.01666 │ ['aten.view_copy.default']                       │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│ 11 │ Execute            │ native_call_clone.out             │    0.01319 │    0.01319 │    0.01319 │    0.01319 │    0.01319 │    0.01319 │ ['aten.clone.default']                           │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│ 13 │ Execute            │ Fully Connected (NC, F32) GEMM    │  173       │  173       │  173       │  173       │  173       │  173       │ []                                               │ True              │ XnnpackBackend          │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│ 14 │ Execute            │ DELEGATE_CALL                     │    0.19363 │    0.19363 │    0.19363 │    0.19363 │    0.19363 │    0.19363 │ []                                               │ False             │                         │
├────┼────────────────────┼───────────────────────────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼────────────┼──────────────────────────────────────────────────┼───────────────────┼─────────────────────────┤
│ 15 │ Execute            │ Method::execute                   │   12.195   │   12.195   │   12.195   │   12.195   │   12.195   │   12.195   │ []                                               │ False             │                         │
╘════╧════════════════════╧═══════════════════════════════════╧════════════╧════════════╧════════════╧════════════╧════════════╧════════════╧══════════════════════════════════════════════════╧═══════════════════╧═════════════════════════╛
```

Pull Request resolved: https://github.com/pytorch/executorch/pull/1632

Test Plan:
python3 -m examples.xnnpack.aot_compiler --model_name="mv2" --delegate -r mv2_etrecord.bin
Run via fb runner and dump etdump.
Validate dump via Inspector.print_data_tabular().

Reviewed By: digantdesai

Differential Revision: D52862750

Pulled By: GregoryComer

fbshipit-source-id: 5b02325e621cba07198f0a286719493d850a7014
G
Gregory Comer committed
47ba2a903e99705ca9f53ada9133f4db85827b9c
Parent: 24e428c
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 2/2/2024, 1:15:52 AM