@@ -186,6 +186,9 @@ def cluster_scheduling_policy_preference(self, device_id: int = None) -> int:
186186 )
187187
188188
189+ MaxPotentialBlockSizeOccupancyResult = namedtuple ("MaxPotential" , ("min_grid_size" , "max_block_size" ))
190+
191+
189192class KernelOccupancy :
190193 """ """
191194
@@ -207,16 +210,18 @@ def max_active_blocks_per_multiprocessor(self, block_size: int, dynamic_shared_m
207210 driver .cuOccupancyMaxActiveBlocksPerMultiprocessor (self ._handle , block_size , dynamic_shared_memory_size )
208211 )
209212
210- # FIXME: better docstring needed
211- def max_potential_block_size (self , dynamic_shared_memory_size : int , block_size_limit : int ) -> tuple [int ]:
212- """(int, int): Suggested launch configuration for reasonable occupancy.
213+ def max_potential_block_size (
214+ self , dynamic_shared_memory_size : int , block_size_limit : int
215+ ) -> MaxPotentialBlockSizeOccupancyResult :
216+ """MaxPotentialBlockSizeOccupancyResult: Suggested launch configuration for reasonable occupancy.
213217
214218 Returns the minimum grid size needed to achieve the maximum occupancy and
215219 the maximum block size that can achieve the maximum occupancy.
216220 """
217- return handle_return (
221+ min_grid_size , max_block_size = handle_return (
218222 driver .cuOccupancyMaxPotentialBlockSize (self ._handle , None , dynamic_shared_memory_size , block_size_limit )
219223 )
224+ return MaxPotentialBlockSizeOccupancyResult (min_grid_size = min_grid_size , max_block_size = max_block_size )
220225
221226 def available_dynamic_shared_memory_per_block (self , num_blocks_per_multiprocessor : int , block_size : int ) -> int :
222227 """int: Dynamic shared memory available per block for given launch configuration."""
0 commit comments