Commit db8bfc8
authored
[hipDNN] Add custom op to support for plugin-provided operations (#5341)
## Motivation
Adding a new operation to hipDNN today requires changes across the full
stack (schema, attributes, node, graph builder, tests). Custom ops
provide an escape hatch: users pass an opaque byte payload and tensor
I/O topology through the graph, and coordinate directly with the target
plugin on the payload's meaning. hipDNN transports the data without
needing to understand it.
This enables:
1. **Quicker iteration:** plugin authors can add and evolve operations
without waiting on hipDNN changes.
2. **Faster support for new ops:** capabilities ship with the plugin,
not with a hipDNN release.
As a concrete use case, the
[Fusilli](https://github.com/iree-org/fusilli) plugin will use custom
ops to let users embed MLIR templates in the opaque payload. With this
PR landed, the Fusilli hipdnn-plugin can be extended to deserialize the
payload, check the `"fusilli."` prefix on `custom_op_id`, and
JIT-compile the MLIR, all without any hipDNN-side knowledge of what MLIR
is. See the [Fusilli custom op
sample](https://github.com/iree-org/fusilli/blob/707358ae866453ed961d443f219c2ef69f2da3c0/samples/custom_op/custom_op_add.cpp)
for an example of Fusilli's custom op and
[iree-org/fusilli#237](iree-org/fusilli#237)
which has example integration tests for the entire flow (hipDNN custom
op → Fusilli custom op).
## Technical Details
**Frontend:**
- `CustomOpAttributes` — attribute class with variable-length positional
tensor vectors (unlike other ops which use named tensor maps via
`Attributes<>` CRTP base, custom ops use `std::vector` since tensor
count is not known at compile time)
- `CustomOpNode` — node implementation with `post_validate_node`
checking both `custom_op_id` and `compute_data_type`, output tensor
validation
- `Graph::custom_op()` — builder method creating output tensors and
auto-naming
**Data SDK:**
- New FlatBuffers schema
- JSON serialization/deserialization support
## Test Plan
- Unit tests for `CustomOpAttributes` (setters/getters, context
propagation, FlatBuffer round-trip)
- Unit tests for `CustomOpNode` (validation, property inference,
serialization)
- Graph-level tests for `Graph::custom_op()`
- Serialization round-trip tests across all 4 formats (JSON, Binary,
FlatBuffer Detached, FlatBuffer Object)
- Data SDK JSON switch coverage for `CustomOpAttributes`
---------
Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>1 parent b17df9b commit db8bfc8
File tree
20 files changed
+1803
-11
lines changed- projects/hipdnn
- data_sdk
- include/hipdnn_data_sdk
- data_objects
- v24_12_23/hipdnn_data_sdk/data_objects
- v25_9_23/hipdnn_data_sdk/data_objects
- flatbuffer_utilities
- utilities/json
- schemas
- tests/utilities
- frontend
- include/hipdnn_frontend
- attributes
- node
- tests
- test_sdk/include/hipdnn_test_sdk/utilities
20 files changed
+1803
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
Lines changed: 200 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 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
Lines changed: 57 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | | - | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | | - | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| |||
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
238 | 250 | | |
239 | 251 | | |
240 | 252 | | |
| |||
377 | 389 | | |
378 | 390 | | |
379 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
380 | 400 | | |
381 | 401 | | |
382 | 402 | | |
| |||
442 | 462 | | |
443 | 463 | | |
444 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
445 | 469 | | |
446 | 470 | | |
447 | 471 | | |
| |||
532 | 556 | | |
533 | 557 | | |
534 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
535 | 562 | | |
536 | 563 | | |
537 | 564 | | |
| |||
606 | 633 | | |
607 | 634 | | |
608 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
609 | 640 | | |
610 | 641 | | |
611 | 642 | | |
| |||
1028 | 1059 | | |
1029 | 1060 | | |
1030 | 1061 | | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1031 | 1066 | | |
1032 | 1067 | | |
1033 | 1068 | | |
| |||
1103 | 1138 | | |
1104 | 1139 | | |
1105 | 1140 | | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1106 | 1145 | | |
1107 | 1146 | | |
1108 | 1147 | | |
| |||
1166 | 1205 | | |
1167 | 1206 | | |
1168 | 1207 | | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1169 | 1212 | | |
1170 | 1213 | | |
1171 | 1214 | | |
| |||
1228 | 1271 | | |
1229 | 1272 | | |
1230 | 1273 | | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1231 | 1278 | | |
1232 | 1279 | | |
1233 | 1280 | | |
| |||
1305 | 1352 | | |
1306 | 1353 | | |
1307 | 1354 | | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1308 | 1360 | | |
1309 | 1361 | | |
1310 | 1362 | | |
| |||
0 commit comments