Commit 35ae30c
cuda.core: close the old buffer when a VMM grow moves the mapping
The slow path of VirtualMemoryResource.modify_allocation unmapped the
old VA range, remapped the physical memory into the new range, freed
the old reservation by hand and then reset the old buffer's handle with
Buffer._clear(). That reset runs the handle's deleter, which calls
mr.deallocate() on the range that was just freed. The failing
cuMemRetainAllocationHandle is reported as a CUDAWarning since #2759
and was silently swallowed before.
Map the old physical memory into the new range as a second mapping
instead, which the VMM APIs allow (virtual aliasing), and then close the
old buffer. Closing runs deallocate() on a range that is still mapped,
so the old range is unmapped, its reservation freed and its handle
reference released through the normal path. The remap-on-rollback undo
step, which swallowed its own errors, is no longer needed because the
old mapping is never removed before the transaction commits.
Issue #2877
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>1 parent 872908c commit 35ae30c
3 files changed
Lines changed: 65 additions & 29 deletions
File tree
- cuda_core
- cuda/core/_memory
- docs/source/release
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
| |||
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | | - | |
| 389 | + | |
389 | 390 | | |
| 391 | + | |
390 | 392 | | |
391 | 393 | | |
392 | 394 | | |
| |||
396 | 398 | | |
397 | 399 | | |
398 | 400 | | |
399 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
421 | 412 | | |
422 | 413 | | |
423 | 414 | | |
| |||
449 | 440 | | |
450 | 441 | | |
451 | 442 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
458 | 447 | | |
459 | 448 | | |
460 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
1540 | 1579 | | |
1541 | 1580 | | |
1542 | 1581 | | |
| |||
0 commit comments