# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_launch_config.pyx

from __future__ import annotations

from typing import Any


class LaunchConfig:
    """Customizable launch options.

    Note
    ----
    When cluster is specified, the grid parameter represents the number of
    clusters (not blocks). The hierarchy is: grid (clusters) -> cluster (blocks) ->
    block (threads). Each dimension in grid specifies clusters in the grid, each dimension in
    cluster specifies blocks per cluster, and each dimension in block specifies
    threads per block.

    Attributes
    ----------
    grid : Union[tuple, int]
        Collection of threads that will execute a kernel function. When cluster
        is not specified, this represents the number of blocks, otherwise
        this represents the number of clusters.
    cluster : Union[tuple, int]
        Group of blocks (Thread Block Cluster) that will execute on the same
        GPU Processing Cluster (GPC). Blocks within a cluster have access to
        distributed shared memory and can be explicitly synchronized.
    block : Union[tuple, int]
        Group of threads (Thread Block) that will execute on the same
        streaming multiprocessor (SM). Threads within a thread blocks have
        access to shared memory and can be explicitly synchronized.
    shmem_size : int, optional
        Dynamic shared-memory size per thread block in bytes.
        (Default to size 0)
    is_cooperative : bool, optional
        Whether this config can be used to launch a cooperative kernel.
    """

    def __init__(self, grid: int | tuple[int, ...] | None=None, cluster: int | tuple[int, ...] | None=None, block: int | tuple[int, ...] | None=None, shmem_size: int | None=None, is_cooperative: bool=False) -> None:
        """Initialize LaunchConfig with validation.

        Parameters
        ----------
        grid : Union[tuple, int], optional
            Grid dimensions (number of blocks or clusters if cluster is specified)
        cluster : Union[tuple, int], optional
            Cluster dimensions (Thread Block Cluster)
        block : Union[tuple, int], optional
            Block dimensions (threads per block)
        shmem_size : int, optional
            Dynamic shared memory size in bytes (default: 0)
        is_cooperative : bool, optional
            Whether to launch as cooperative kernel (default: False)
        """

    def _identity(self) -> tuple[Any, ...]:
        ...

    def __repr__(self) -> str:
        """Return string representation of LaunchConfig."""

    def __eq__(self, other: object) -> bool:
        ...

    def __hash__(self) -> int:
        ...
_LAUNCH_CONFIG_ATTRS = ('grid', 'cluster', 'block', 'shmem_size', 'is_cooperative')

def _to_native_launch_config(config: LaunchConfig) -> object:
    """Convert LaunchConfig to native driver CUlaunchConfig.

    Parameters
    ----------
    config : LaunchConfig
        High-level launch configuration

    Returns
    -------
    driver.CUlaunchConfig
        Native CUDA driver launch configuration
    """