Commit 8cfa882
authored
[ExecuTorch][WebGPU] Add split_with_sizes_copy op (#20995)
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0)
(oldest at bottom):
* #20868
* #20996
* __->__ #20995
* #20994
* #20993
* #20992
* #20991
* #20990
* #20989
* #20988
* #20987
* #20986
* #20876
* #20875
* #20874
* #20873
* #20872
* #20871
* #20866
* #20865
* #20864
* #20863
* #20862
* #20861
* #20860
* #20859
* #20858
* #20857
* #20856
* #20855
* #20854
* #20852
* #20851
* #20850
* #20849
* #20848
* #20846
* #20845
* #20844
* #20843
* #20842
**Add `aten.split_with_sizes_copy.default` to the WebGPU backend** — the
split on YOLO's Detect head (separating the concatenated box /
objectness / class predictions).
**Problem**: The WebGPU delegate had no `split_with_sizes_copy`, so YOLO
object-detection could not fully delegate to the GPU.
**Solution**: Split `self` along `dim` into N contiguous chunks. Each
chunk is a step-1 slice from the running offset, reusing the
`slice.wgsl` gather kernel — one dispatch per output. Outputs arrive as
a serialized ValueList. Each chunk writes its own distinct output buffer
and reads only the shared input, so there is no cross-dispatch
read-after-write hazard.
**Implementation**:
- `runtime/ops/split_with_sizes/SplitWithSizes.cpp` registering
`aten.split_with_sizes_copy.default`; reuses `slice_wgsl.h` (no new
shader). Uses `utils::make_compute_pipeline` (auto-derived bind-group
layout) rather than hand-rolling the layout / pipeline / bind group.
- Mirrors the Vulkan `split_with_sizes_copy` delegate.
- CMake `WEBGPU_SRCS` entry.
**Constraints**: fp32-only; `dim` normalized + range-checked; `outputs
== sizes` count enforced (fail-loud). Reuses the `slice` op's
`slice_wgsl.h`, so this diff stacks above `slice` and must land after
it. No change to existing ops.
@exported-using-ghexport
Differential Revision:
[D112417284](https://our.internmc.facebook.com/intern/diff/D112417284/)
Differential Revision:
[D112417284](https://our.internmc.facebook.com/intern/diff/D112417284)1 parent e731b41 commit 8cfa882
1 file changed
Lines changed: 147 additions & 0 deletions
Lines changed: 147 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
0 commit comments