Commit f52fd32
change dtype of block_bucketize_row_pos and fix flaky test_kjt_bucketize_before_all2all_cpu (meta-pytorch#2689)
Summary:
Pull Request resolved: meta-pytorch#2689
# context
* found a test failure from OSS [test run](https://github.com/pytorch/torchrec/actions/runs/12816026713/job/35736016089): P1714445461
* the issue is a recent change (D65912888) incorrectly calling the `_fx_wrap_tensor_to_device_dtype` function
```
block_bucketize_pos=(
_fx_wrap_tensor_to_device_dtype(block_bucketize_row_pos, kjt.lengths())
if block_bucketize_row_pos is not None
else None
),
```
where `block_bucketize_row_pos: List[torch.tensor]`, but the function only accepts torch.Tensor
```
torch.fx.wrap
def _fx_wrap_tensor_to_device_dtype(
t: torch.Tensor, tensor_device_dtype: torch.Tensor
) -> torch.Tensor:
return t.to(device=tensor_device_dtype.device, dtype=tensor_device_dtype.dtype)
```
* the fix is supposed to be straightforward to apply a list-comprehension over the function
```
block_bucketize_pos=(
[
_fx_wrap_tensor_to_device_dtype(pos, kjt.lengths()) # <---- pay attention here, kjt.lengths()
for pos in block_bucketize_row_pos
]
```
* according to the previous comments, the `block_bucketize_pos`'s `dtype` should be the same as `kjt._length`, however, it triggers the following error
{F1974430883}
* according to the operator implementation ([codepointer](https://fburl.com/code/9gyyl8h4)), the `block_bucketize_pos` should have the same dtype as `kjt._values`.
length has a type name of `offset_t`, values has a type name of `index_t`, the same as `block_bucketize_pos`.
Reviewed By: dstaay-fb
Differential Revision: D68358894
fbshipit-source-id: 13303c54288c99c6cf58d550365f8d3c698c34b11 parent 53752ea commit f52fd32
File tree
2 files changed
+18
-100
lines changed- torchrec/distributed
- tests
2 files changed
+18
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | 266 | | |
359 | 267 | | |
360 | 268 | | |
| |||
363 | 271 | | |
364 | 272 | | |
365 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
366 | 277 | | |
367 | | - | |
368 | | - | |
| 278 | + | |
| 279 | + | |
369 | 280 | | |
370 | 281 | | |
371 | 282 | | |
372 | 283 | | |
373 | 284 | | |
374 | 285 | | |
375 | 286 | | |
| 287 | + | |
376 | 288 | | |
377 | 289 | | |
378 | 290 | | |
| |||
423 | 335 | | |
424 | 336 | | |
425 | 337 | | |
426 | | - | |
| 338 | + | |
427 | 339 | | |
428 | 340 | | |
429 | | - | |
430 | | - | |
| 341 | + | |
| 342 | + | |
431 | 343 | | |
432 | 344 | | |
433 | 345 | | |
434 | 346 | | |
435 | 347 | | |
436 | | - | |
| 348 | + | |
437 | 349 | | |
438 | 350 | | |
439 | 351 | | |
| |||
442 | 354 | | |
443 | 355 | | |
444 | 356 | | |
445 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
446 | 361 | | |
447 | 362 | | |
448 | 363 | | |
| |||
0 commit comments