Skip to content

Commit c4a307a

Browse files
committed
ensure Buffer.handle is None everywhere
1 parent 3e3f93a commit c4a307a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

cuda_core/docs/source/release/0.X.Y-notes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Breaking Changes
1919
----------------
2020

2121
- **LaunchConfig grid parameter interpretation**: When :attr:`LaunchConfig.cluster` is specified, the :attr:`LaunchConfig.grid` parameter now correctly represents the number of clusters instead of blocks. Previously, the grid parameter was incorrectly interpreted as blocks, causing a mismatch with the expected C++ behavior. This change ensures that ``LaunchConfig(grid=4, cluster=2, block=32)`` correctly produces 4 clusters × 2 blocks/cluster = 8 total blocks, matching the C++ equivalent ``cudax::make_hierarchy(cudax::grid_dims(4), cudax::cluster_dims(2), cudax::block_dims(32))``.
22+
- When :class:`Buffer` is closed, :attr:`Buffer.handle` is now set to `None`. It was previously set to ``0`` by accident.
2223

2324

2425
New features
@@ -39,4 +40,5 @@ Fixes and enhancements
3940
- Improved :class:`DeviceMemoryResource` allocation performance when there are no active allocations by setting a higher release threshold (addresses issue #771).
4041
- Improved :class:`StridedMemoryView` creation time performance by optimizing shape and strides tuple creation using Python/C API (addresses issue #449).
4142
- Fix :class:`LaunchConfig` grid unit conversion when cluster is set (addresses issue #867).
42-
- Fixed a bug in :class:`GraphBuilder.add_child` where dependencies extracted from capturing stream were passed inconsistently with num_dependencies parameter (addresses issue #843).
43+
- Fixed a bug in :class:`GraphBuilder.add_child` where dependencies extracted from capturing stream were passed inconsistently with num_dependencies parameter (addresses issue #843).
44+
- Make :class:`Buffer` creation more performant.

cuda_core/examples/memory_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@
129129
cp.cuda.Stream.null.use() # reset CuPy's current stream to the null stream
130130

131131
# Verify buffers are properly closed
132-
assert device_buffer.handle == 0, "Device buffer should be closed"
133-
assert pinned_buffer.handle == 0, "Pinned buffer should be closed"
134-
assert new_device_buffer.handle == 0, "New device buffer should be closed"
132+
assert device_buffer.handle is None, "Device buffer should be closed"
133+
assert pinned_buffer.handle is None, "Pinned buffer should be closed"
134+
assert new_device_buffer.handle is None, "New device buffer should be closed"
135135

136136
print("Memory management example completed!")

cuda_core/tests/test_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,4 @@ def test_launch_with_buffers_allocated_by_memory_resource(init_cuda, memory_reso
368368
cp.cuda.Stream.null.use() # reset CuPy's current stream to the null stream
369369

370370
# Verify buffer is properly closed
371-
assert buffer.handle == 0, f"{memory_resource_class.__name__} buffer should be closed"
371+
assert buffer.handle is None, f"{memory_resource_class.__name__} buffer should be closed"

0 commit comments

Comments
 (0)