Commit 8b4d3cb
authored
[hipDNN] Expand TensorAttribute validate and refactor where it's called (#3474)
## Motivation
Run `TensorAttributes::validate()` on node inputs in graph validation so
nodes can assume their inputs have been validated, and expanded the
checks covered in that function.
## Technical Details
- Expanded tensor validation to include
- Dims and strides must be set
- Dims must be positive
- Tensor cannot be virtual and pass by value
- Dims and strides must have the same cardinality
- Moved tensor validation checks from nodes into validate function. In
graph::validate(), all graph tensor inputs that are not also graph
outputs will be validated. After that, each node will validate their
outputs in post_validate_node(), ensuring that they've had an
opportunity to infer tensor output attributes before checking
validation.
- Removed checks that force strides to be positive (valid tensors can
exist without positive strides, this should be checked at the plugin
level)
- [BREAKING CHANGE] removed `validate_dims_set_and_positive()` and
`validate_dims_and_strides_set_and_positive()`
- Fixed suspected UB from having two different FakeNode classes defined
in separate source files1 parent 5104576 commit 8b4d3cb
File tree
16 files changed
+394
-839
lines changed- projects/hipdnn
- frontend
- include/hipdnn_frontend
- attributes
- node
- tests
- python/src
16 files changed
+394
-839
lines changedLines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
84 | 103 | | |
85 | 104 | | |
86 | 105 | | |
| |||
Lines changed: 36 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
338 | 364 | | |
339 | 365 | | |
340 | 366 | | |
| |||
346 | 372 | | |
347 | 373 | | |
348 | 374 | | |
349 | | - | |
350 | | - | |
| 375 | + | |
351 | 376 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 377 | + | |
| 378 | + | |
357 | 379 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 380 | + | |
363 | 381 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
| 382 | + | |
369 | 383 | | |
370 | | - | |
| 384 | + | |
371 | 385 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 386 | + | |
| 387 | + | |
377 | 388 | | |
378 | 389 | | |
| 390 | + | |
| 391 | + | |
379 | 392 | | |
380 | 393 | | |
381 | 394 | | |
| |||
Lines changed: 15 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
198 | 207 | | |
199 | | - | |
200 | | - | |
201 | 208 | | |
202 | | - | |
203 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
204 | 212 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 213 | + | |
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| |||
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 93 | | |
106 | 94 | | |
107 | 95 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 86 | | |
92 | 87 | | |
93 | 88 | | |
| |||
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
| |||
76 | 71 | | |
77 | 72 | | |
78 | 73 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 74 | | |
85 | 75 | | |
86 | 76 | | |
| |||
96 | 86 | | |
97 | 87 | | |
98 | 88 | | |
99 | | - | |
100 | 89 | | |
101 | 90 | | |
102 | 91 | | |
| |||
131 | 120 | | |
132 | 121 | | |
133 | 122 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 123 | | |
148 | 124 | | |
149 | 125 | | |
| |||
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
| |||
77 | 72 | | |
78 | 73 | | |
79 | 74 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 75 | | |
86 | 76 | | |
87 | 77 | | |
| |||
111 | 101 | | |
112 | 102 | | |
113 | 103 | | |
114 | | - | |
115 | 104 | | |
116 | 105 | | |
117 | 106 | | |
| |||
135 | 124 | | |
136 | 125 | | |
137 | 126 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 127 | | |
152 | 128 | | |
153 | 129 | | |
| |||
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| |||
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 74 | | |
81 | 75 | | |
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | 79 | | |
86 | 80 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 81 | | |
93 | 82 | | |
94 | 83 | | |
| |||
132 | 121 | | |
133 | 122 | | |
134 | 123 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | 124 | | |
141 | 125 | | |
142 | 126 | | |
| |||
171 | 155 | | |
172 | 156 | | |
173 | 157 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 158 | | |
183 | 159 | | |
184 | 160 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
| |||
0 commit comments