From bc14da2d1e4828a6b1f9258b96aca73919c00c8c Mon Sep 17 00:00:00 2001 From: Milan Topalovic Date: Thu, 25 Jul 2024 12:17:47 +0000 Subject: [PATCH] Add target to generate stubs for python modules. To invoke run `cmake --build build -- make_stubs` --- CMakeLists.txt | 8 + pybuda/pybuda/_C/__init__.pyi | 2 +- pybuda/pybuda/_C/backend_api.pyi | 338 --------------------------- pybuda/pybuda/_C/balancer.pyi | 313 ------------------------- pybuda/pybuda/_C/pattern_matcher.pyi | 11 - pybuda/pybuda/_C/runtime.pyi | 8 + pybuda/pybuda/_C/scheduler.pyi | 29 --- 7 files changed, 17 insertions(+), 692 deletions(-) delete mode 100644 pybuda/pybuda/_C/backend_api.pyi delete mode 100644 pybuda/pybuda/_C/balancer.pyi delete mode 100644 pybuda/pybuda/_C/pattern_matcher.pyi create mode 100644 pybuda/pybuda/_C/runtime.pyi delete mode 100644 pybuda/pybuda/_C/scheduler.pyi diff --git a/CMakeLists.txt b/CMakeLists.txt index 50ea356e6..9a96d0caf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,3 +48,11 @@ set(SHARED_LIB_FLAGS -fPIC) add_subdirectory(third_party) add_subdirectory(pybuda) +### Generate stubs for ttforge +### Run `cmake --build build -- make_stubs` to generate stubs +add_custom_target(make_stubs + COMMAND pip install mypy + COMMAND stubgen -m pybuda._C -m pybuda._C.autograd -m pybuda._C.graph -m pybuda._C.torch_device -m pybuda._C.runtime -o pybuda -v + COMMENT "Generating stubs for ttforge" + USES_TERMINAL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/pybuda/pybuda/_C/__init__.pyi b/pybuda/pybuda/_C/__init__.pyi index cbddcae24..20a2ef06a 100644 --- a/pybuda/pybuda/_C/__init__.pyi +++ b/pybuda/pybuda/_C/__init__.pyi @@ -1,4 +1,4 @@ -from . import autograd as autograd, graph as graph, torch_device as torch_device +from . import autograd as autograd, graph as graph, runtime as runtime, torch_device as torch_device from typing import ClassVar BLACKHOLE: Arch diff --git a/pybuda/pybuda/_C/backend_api.pyi b/pybuda/pybuda/_C/backend_api.pyi deleted file mode 100644 index 37deb4d2e..000000000 --- a/pybuda/pybuda/_C/backend_api.pyi +++ /dev/null @@ -1,338 +0,0 @@ -import pybuda._C -from _typeshed import Incomplete -from typing import ClassVar, Dict, List, Tuple, overload - -class BackendApi: - def __init__(self, arg0: str, arg1: BackendConfig) -> None: ... - def finish(self) -> BackendStatusCode: ... - def get_queue_descriptor(self, arg0: str) -> DramIODesc: ... - @overload - def initialize(self) -> BackendStatusCode: ... - @overload - def initialize(self, arg0: BackendCompileResult) -> BackendStatusCode: ... - def run_program(self, arg0: str, arg1: Dict[str, str]) -> BackendStatusCode: ... - def wait_for_idle(self) -> BackendStatusCode: ... - -class BackendCompileFailure: - __members__: ClassVar[dict] = ... # read-only - BlobGen: ClassVar[BackendCompileFailure] = ... - BriscCompile: ClassVar[BackendCompileFailure] = ... - EriscCompile: ClassVar[BackendCompileFailure] = ... - Invalid: ClassVar[BackendCompileFailure] = ... - L1Size: ClassVar[BackendCompileFailure] = ... - Net2Pipe: ClassVar[BackendCompileFailure] = ... - NriscCompile: ClassVar[BackendCompileFailure] = ... - OverlaySize: ClassVar[BackendCompileFailure] = ... - PipeGen: ClassVar[BackendCompileFailure] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class BackendBaseCompileResult: - success: bool - failure_type: BackendCompileFailure - failure_message: str - failure_target: str - -class BackendCompileResultPerEpoch(BackendBaseCompileResult): - device_id: int - temporal_epoch_id: int - logical_core_x: int - logical_core_y: int - maximum_size_bytes: int - allocated_size_bytes: int - extra_size_bytes: int - def __init__(self) -> None: ... - -class BackendFwCompileResult(BackendBaseCompileResult): - def __init__(self) -> None: ... - -class BackendOverlayCompileResult(BackendBaseCompileResult): - failed_compile_results_per_epoch: List[BackendCompileResultPerEpoch] - blob_usage_per_epoch_per_core: dict[int, dict[str, int]] - def __init__(self) -> None: ... - -class BackendCompileResult(BackendBaseCompileResult): - fw_compile_result: BackendBaseCompileResult - overlay_compile_result: BackendOverlayCompileResult - def __init__(self) -> None: ... - -class BackendConfig: - def __init__(self, arg0, arg1, arg2, arg3: int, arg4: str, arg5: str, arg6: str) -> None: ... - def set_golden_ignore_df_precision(self, arg0: bool) -> None: ... - def set_performance_trace_args(self, arg0: str) -> None: ... - def set_runtime_args(self, arg0: str) -> None: ... - -class BackendDevice: - __members__: ClassVar[dict] = ... # read-only - Grayskull: ClassVar[BackendDevice] = ... - Invalid: ClassVar[BackendDevice] = ... - Wormhole_B0: ClassVar[BackendDevice] = ... - Blackhole: ClassVar[BackendDevice] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def from_json(self) -> BackendDevice: ... - @classmethod - def from_string(cls, arg0: str) -> BackendDevice: ... - def to_json(self) -> str: ... - def to_string(self) -> str: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class BackendDeviceDesc: - def __init__(self) -> None: ... - @property - def arch(self) -> BackendDevice: ... - @property - def harvesting_mask(self) -> int: ... - @property - def mmio(self) -> bool: ... - @property - def soc_desc_yaml(self) -> str: ... - -class BackendStatusCode: - __members__: ClassVar[dict] = ... # read-only - RuntimeError: ClassVar[BackendStatusCode] = ... - Success: ClassVar[BackendStatusCode] = ... - TimeoutError: ClassVar[BackendStatusCode] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class BackendType: - __members__: ClassVar[dict] = ... # read-only - Model: ClassVar[BackendType] = ... - Versim: ClassVar[BackendType] = ... - Silicon: ClassVar[BackendType] = ... - Golden: ClassVar[BackendType] = ... - Emulation: ClassVar[BackendType] = ... - NoBackend: ClassVar[BackendType] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def from_json(self) -> BackendType: ... - @classmethod - def from_string(cls, arg0: str) -> BackendType: ... - def to_json(self) -> str: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class DeviceConfig: - @overload - def __init__(self, arg0: str, arg1: str, arg2: str, arg3: str, arg4: str, arg5: bool, arg6: List[int]) -> None: ... - @overload - def __init__(self, arg0: str, arg1: str, arg2: str, arg3: str, arg4: str, arg5: bool, arg6: List[Tuple[int, int, int, int]]) -> None: ... - def get_dram_backend_reserved_max(self) -> int: ... - def get_ethernet_connections(self) -> Dict[int, Dict[int, Tuple[int, int]]]: ... - def get_harvested_cfg(self) -> Dict[int, int]: ... - def get_host_memory_channel_size(self, arg0: int) -> int: ... - def get_host_memory_channel_start_address(self) -> int: ... - def get_host_memory_num_channels(self) -> int: ... - @property - def arch(self) -> BackendDevice: ... - @property - def arch_name(self) -> str: ... - @property - def backend_type(self) -> str: ... - @property - def chip_ids(self) -> List[int]: ... - @property - def cluster_config_yaml(self) -> str: ... - @property - def device_yaml(self) -> str: ... - @property - def grid_size(self) -> DeviceGrid: ... - -class DeviceGrid: - def __init__(self, arg0: Tuple[int, int]) -> None: ... - @property - def c(self) -> int: ... - @property - def r(self) -> int: ... - -class DeviceMode: - __members__: ClassVar[dict] = ... # read-only - CompileAndRun: ClassVar[DeviceMode] = ... - CompileOnly: ClassVar[DeviceMode] = ... - RunOnly: ClassVar[DeviceMode] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def from_json(self) -> DeviceMode: ... - def to_json(self) -> str: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class DramIODesc: - bufq_grid_dim_c: int - bufq_grid_dim_r: int - hstack_factor: int - input_count: int - mblock_m: int - mblock_n: int - netlist_path: str - s_descriptor: StrideDescriptor - stack_row_major: bool - t: int - tile_height: int - tile_width: int - ublock_ct: int - ublock_rt: int - vstack_factor: int - def __init__(self, *args, **kwargs) -> None: ... - @property - def data_format(self) -> pybuda._C.DataFormat: ... - @property - def name(self) -> str: ... - -class IOLayout: - __members__: ClassVar[dict] = ... # read-only - Flat: ClassVar[IOLayout] = ... - Invalid: ClassVar[IOLayout] = ... - Tilized: ClassVar[IOLayout] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class IOType: - __members__: ClassVar[dict] = ... # read-only - Invalid: ClassVar[IOType] = ... - Queue: ClassVar[IOType] = ... - RandomAccess: ClassVar[IOType] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class OpModelDesc: - approx_mode: bool - arch: str - data_format: pybuda._C.DataFormat - math_fidelity: Incomplete - mblock_k: int - mblock_m: int - mblock_n: int - op_attr: str - reduce_z: int - sparse_indices: int - sparse_nz_strips: int - sparse_nz_ublocks: int - t: int - type: str - ublock_ct: int - ublock_kt: int - ublock_rt: int - version: int - def __init__(self) -> None: ... - -class PytorchTensorDesc: - dim: int - format: pybuda._C.DataFormat - itemsize: int - shape: List[int[4]] - strides: List[int[4]] - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, arg0: object, arg1: int, arg2: pybuda._C.DataFormat, arg3: int, arg4: List[int[4]], arg5: List[int[4]]) -> None: ... - @overload - def __init__(self, arg0: capsule, arg1: int, arg2: pybuda._C.DataFormat, arg3: int, arg4: List[int[4]], arg5: List[int[4]]) -> None: ... - def print(self) -> None: ... - -class StrideDescriptor: - stride: int - xy_offsets: List[Tuple[int, int]] - def __init__(self) -> None: ... - -class TilizedTensorDesc: - buf_size_bytes: int - format: pybuda._C.DataFormat - num_buffers: int - def __init__(self) -> None: ... - def print(self) -> None: ... - -@overload -def binarize_tensor(arg0: PytorchTensorDesc, arg1: str) -> None: ... -@overload -def binarize_tensor(arg0: TilizedTensorDesc, arg1: str) -> None: ... -def clear_backend_param_cache() -> None: ... -@overload -def debinarize_tensor(arg0: PytorchTensorDesc, arg1: str) -> None: ... -@overload -def debinarize_tensor(arg0: TilizedTensorDesc, arg1: str) -> None: ... -def detect_available_silicon_devices(only_detect_mmio: bool = ...) -> List[BackendDevice]: ... -def finish_child_process() -> BackendStatusCode: ... -@overload -def free_tensor(arg0: PytorchTensorDesc) -> BackendStatusCode: ... -@overload -def free_tensor(arg0: TilizedTensorDesc) -> BackendStatusCode: ... -def get_custom_device_desc(arch: BackendDevice = ..., mmio: bool = ..., harvesting_mask: int = ..., grid_dim: Tuple[int, int] = ..., out_dir: str = ...) -> BackendDeviceDesc: ... -def get_device_cluster_yaml(out_dir: str) -> str: ... -def get_device_descs_for_available_devices(out_dir: str = ...) -> List[BackendDeviceDesc]: ... -def get_golden_config() -> BackendConfig: ... -def get_io_size_in_bytes(data_formati: pybuda._C.DataFormat, is_untilizesd: bool, ublock_ct: int, ublock_rt: int, mblock_m: int, mblock_n: int, t: int, entries: int, tile_height: int = ..., tile_width: int = ...) -> int: ... -def get_next_aligned_address(arg0: int) -> int: ... -def get_op_model_execution_cycles(arg0: OpModelDesc) -> int: ... -def get_op_model_param(arg0: OpModelDesc, arg1: str) -> int: ... -def get_output(arg0: DramIODesc, arg1: PytorchTensorDesc, arg2: bool, arg3: int, arg4: int) -> BackendStatusCode: ... -def initialize_child_process(arg0: str) -> BackendStatusCode: ... -def load_cached_sys_param(arg0: str) -> Dict[str, str]: ... -def pop_output(arg0: DramIODesc, arg1: bool, arg2: int) -> BackendStatusCode: ... -@overload -def push_input(arg0: DramIODesc, arg1: PytorchTensorDesc, arg2: bool, arg3: int, arg4: int) -> BackendStatusCode: ... -@overload -def push_input(arg0: DramIODesc, arg1: TilizedTensorDesc, arg2: int, arg3: int) -> BackendStatusCode: ... -def release_backend_ptr(arg0: BackendApi) -> None: ... -def tilize_tensor(arg0: DramIODesc, arg1: PytorchTensorDesc) -> TilizedTensorDesc: ... -def translate_addresses(arg0: DramIODesc) -> BackendStatusCode: ... -def get_format_from_string(arg0: str) -> pybuda._C.DataFormat: ... diff --git a/pybuda/pybuda/_C/balancer.pyi b/pybuda/pybuda/_C/balancer.pyi deleted file mode 100644 index 29651c4cf..000000000 --- a/pybuda/pybuda/_C/balancer.pyi +++ /dev/null @@ -1,313 +0,0 @@ -import pybuda._C -import pybuda._C.graph -import pybuda._C.scheduler -import typing -from _typeshed import Incomplete -from typing import ClassVar, Dict, List, Optional, Tuple, Union, overload - -C: TStreamDir -CNN: PolicyType -CZ: TStreamDir -ConsumerOperandDataEdgesFirst: GraphSolverSelfCutType -FastCut: GraphSolverSelfCutType -MMIO_LAST: ChipPlacementPolicy -MinimizeGrid: PolicyType -NLP: PolicyType -ProducerUserDataEdgesFirst: GraphSolverSelfCutType -R: TStreamDir -RZ: TStreamDir -Random: PolicyType -Ribbon: PolicyType -SNAKE: ChipPlacementPolicy - -class BalancerConfig: - chip_ids: List[int] - default_dram_parameters: bool - device_config: Incomplete - enable_auto_transposing_placement: bool - enable_enumerate_u_kt: bool - enable_single_buffer_fallback: bool - enable_t_streaming: bool - fork_join_tiles_treshold: int - graph_solver_self_cut_type: GraphSolverSelfCutType - input_queues_on_host: bool - manual_t_streaming: bool - op_name_to_placer_overrides: Dict[str, pybuda._C.placer.OpOverride] - op_names_to_chip_break: List[List[str]] - op_names_to_chip_id_assignment: List[List[str]] - op_names_to_epoch_break: List[List[str]] - op_overrides: Dict[str, OpOverride] - output_queues_on_host: bool - policy_type: PolicyType - random_policy_seed: int - scheduler_config: pybuda._C.scheduler.SchedulerConfig - skip_l1_usage_validation: bool - target_cycles_offset: int - use_interactive_placer: bool - def __init__(self, device_config, scheduler_config: pybuda._C.scheduler.SchedulerConfig, policy_type: PolicyType = ..., random_policy_seed: int = ..., chip_ids: List[int] = ..., chip_placement_policy: ChipPlacementPolicy = ..., default_dram_parameters: bool = ..., skip_l1_usage_validation: bool = ..., enable_t_streaming: bool = ..., manual_t_streaming: bool = ..., input_queues_on_host: bool = ..., output_queues_on_host: bool = ..., op_overrides: Dict[str, OpOverride] = ..., op_names_to_epoch_break: List[List[str]] = ..., op_names_to_chip_break: List[List[str]] = ..., op_names_to_chip_id_assignment: Dict[str, int] = ..., op_name_to_placer_overrides: Dict[str, pybuda._C.placer.OpOverride] = ..., enable_auto_transposing_placement: bool = ..., graph_solver_self_cut_type: GraphSolverSelfCutType = ..., use_interactive_placer: bool = ..., enable_enumerate_u_kt: bool = ..., enable_single_buffer_fallback: bool = ...) -> None: ... - -class BalancerSolution: - def __init__(self, *args, **kwargs) -> None: ... - def cut_edges_as_override(self, arg0: pybuda._C.graph.Graph) -> List[Tuple[str, str, int]]: ... - @property - def op_models(self): ... - @property - def output_host_tms(self): ... - @property - def placer_solution(self) -> pybuda._C.placer.PlacerSolution: ... - -class BlockShape: - def __init__(self, *args, **kwargs) -> None: ... - def buffer_tiles(self, arg0: int) -> int: ... - def volume(self) -> int: ... - def __eq__(self, arg0: BlockShape) -> bool: ... - @property - def mblock_m(self) -> int: ... - @property - def mblock_n(self) -> int: ... - @property - def t(self) -> int: ... - @property - def ublock(self) -> UBlockShape: ... - -class BufferModel: - def __init__(self, *args, **kwargs) -> None: ... - @property - def block_shape(self) -> BlockShape: ... - @property - def data_format(self) -> pybuda._C.DataFormat: ... - @property - def l1_size_tiles(self) -> int: ... - -class ChipPlacementPolicy: - __members__: ClassVar[dict] = ... # read-only - MMIO_LAST: ClassVar[ChipPlacementPolicy] = ... - SNAKE: ClassVar[ChipPlacementPolicy] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class Constant: - def __init__(self, value: int) -> None: ... - -class FactorizedInt: - @overload - def __init__(self) -> None: ... - @overload - def __init__(self, max_val: int) -> None: ... - @overload - def __init__(self, range: Tuple[int, int]) -> None: ... - @overload - def __init__(self, constant: Constant) -> None: ... - def __and__(self, arg0: FactorizedInt) -> FactorizedInt: ... - def __div__(self, arg0: FactorizedInt) -> FactorizedInt: ... - def __mul__(self, arg0: FactorizedInt) -> FactorizedInt: ... - def __or__(self, arg0: FactorizedInt) -> FactorizedInt: ... - def __sub__(self, arg0: FactorizedInt) -> FactorizedInt: ... - @property - def factors(self) -> List[int]: ... - @property - def max_factor(self) -> int: ... - -class FusedSubOpModel: - def __init__(self, *args, **kwargs) -> None: ... - @property - def has_dest_input(self) -> bool: ... - @property - def has_dest_output(self) -> bool: ... - @property - def mblock_k(self) -> int: ... - @property - def mblock_m(self) -> int: ... - @property - def mblock_n(self) -> int: ... - @property - def reduce_dim(self) -> str: ... - @property - def type(self) -> str: ... - @property - def ublock_ct(self) -> int: ... - @property - def ublock_kt(self) -> int: ... - @property - def ublock_rt(self) -> int: ... - -class GraphSolverSelfCutType: - __members__: ClassVar[dict] = ... # read-only - ConsumerOperandDataEdgesFirst: ClassVar[GraphSolverSelfCutType] = ... - FastCut: ClassVar[GraphSolverSelfCutType] = ... - ProducerUserDataEdgesFirst: ClassVar[GraphSolverSelfCutType] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class GridShape: - def __init__(self, *args, **kwargs) -> None: ... - @overload - def __eq__(self, arg0: GridShape) -> bool: ... - @overload - def __eq__(self, arg0: Tuple[int, int]) -> bool: ... - @property - def c(self) -> int: ... - @property - def r(self) -> int: ... - -class OpModel: - def __init__(self, *args, **kwargs) -> None: ... - def block_shape(self) -> BlockShape: ... - def buda_op_attrs(self, *args, **kwargs): ... - def get_reduce_dim(self) -> str: ... - def math_fidelity(self, *args, **kwargs): ... - def op_type(self) -> str: ... - @property - def data_format(self) -> pybuda._C.DataFormat: ... - @property - def fracture_factor(self) -> int: ... - @property - def grid_shape(self) -> GridShape: ... - @property - def input_buffers(self) -> List[BufferModel]: ... - @property - def is_sparse_matmul(self) -> bool: ... - @property - def nz_strips(self) -> int: ... - @property - def nz_tiles(self) -> int: ... - @property - def nz_ublocks(self) -> int: ... - @property - def op_shape(self) -> OpShape: ... - @property - def output_buffers(self) -> List[BufferModel]: ... - @property - def parameter_buffers(self) -> List[BufferModel]: ... - @property - def sparse_indices(self) -> int: ... - @property - def t_stream_factor(self) -> TStreamFactor: ... - -class OpOverride: - force_dram_parameters: Optional[bool] - fracture_factor: Optional[int] - grid_shape: Optional[Tuple[int, int]] - input_buffer_multiplier: Optional[Dict[int, int]] - output_buffer_multiplier: Optional[int] - t_stream_dir: str - t_stream_shape: Optional[Tuple[int, int]] - u_kt: Optional[int] - def __init__(self) -> None: ... - def from_json(self) -> OpOverride: ... - def to_json(self) -> Dict[str, Union[Optional[bool], str, Optional[int], Optional[List[int[2]]], Optional[Dict[int, int]]]]: ... - -class OpShape: - def __init__(self, input_shapes: List[Tuple[int, int, int, int]], output_shape: Tuple[int, int, int, int], scalar_dims: bool = ...) -> None: ... - @property - def inputs(self) -> List[TensorShape]: ... - @property - def outputs(self) -> List[TensorShape]: ... - -class OutputHostTM: - def __init__(self, *args, **kwargs) -> None: ... - @classmethod - def from_json(cls, arg0: Dict[str, Union[bool, int]]) -> OutputHostTM: ... - def to_json(self) -> Dict[str, Union[bool, int]]: ... - @property - def hstack_factor(self) -> int: ... - @property - def row_major(self) -> bool: ... - @property - def vstack_factor(self) -> int: ... - -class PolicyType: - __members__: ClassVar[dict] = ... # read-only - CNN: ClassVar[PolicyType] = ... - MinimizeGrid: ClassVar[PolicyType] = ... - NLP: ClassVar[PolicyType] = ... - Random: ClassVar[PolicyType] = ... - Ribbon: ClassVar[PolicyType] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class TStreamDir: - __members__: ClassVar[dict] = ... # read-only - C: ClassVar[TStreamDir] = ... - CZ: ClassVar[TStreamDir] = ... - R: ClassVar[TStreamDir] = ... - RZ: ClassVar[TStreamDir] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -class TStreamFactor: - def __init__(self, *args, **kwargs) -> None: ... - def __eq__(self, arg0: TStreamFactor) -> bool: ... - @property - def c(self) -> int: ... - @property - def dir(self) -> TStreamDir: ... - @property - def r(self) -> int: ... - -class TensorShape: - def __init__(self, *args, **kwargs) -> None: ... - def __getitem__(self, arg0: int) -> int: ... - def __iter__(self) -> typing.Iterator[int]: ... - def __setitem__(self, arg0: int, arg1: int) -> None: ... - @property - def ct(self) -> int: ... - @property - def rt(self) -> int: ... - @property - def w(self) -> int: ... - @property - def z(self) -> int: ... - -class UBlockShape: - def __init__(self, *args, **kwargs) -> None: ... - def volume(self) -> int: ... - @overload - def __eq__(self, arg0: UBlockShape) -> bool: ... - @overload - def __eq__(self, arg0: Tuple[int, int]) -> bool: ... - @property - def ct(self) -> int: ... - @property - def rt(self) -> int: ... - -def can_use_interactive_placer(policy_type: PolicyType) -> bool: ... -def chip_placement_policy_from_string(chip_placement_policy_str: str) -> ChipPlacementPolicy: ... -def graph_solver_self_cut_type_from_string(graph_solver_self_cut_type_from_string_str: str) -> GraphSolverSelfCutType: ... -def policy_from_string(policy_type_str: str) -> PolicyType: ... diff --git a/pybuda/pybuda/_C/pattern_matcher.pyi b/pybuda/pybuda/_C/pattern_matcher.pyi deleted file mode 100644 index b457eec8e..000000000 --- a/pybuda/pybuda/_C/pattern_matcher.pyi +++ /dev/null @@ -1,11 +0,0 @@ -import pybuda._C.graph -from typing import Dict, List, Tuple - -class MatchResult: - is_subgraph_loopable: bool - is_subgraph_pattern_found: bool - subgraph_matches: List[Dict[int, int]] - def __init__(self, *args, **kwargs) -> None: ... - -def lower_json_to_pattern_matcher(arg0: json, arg1: int) -> MatchResult: ... -def lower_pybuda_to_pattern_matcher(arg0: pybuda._C.graph.Graph, arg1: int) -> Tuple[pybuda._C.graph.Graph, MatchResult]: ... diff --git a/pybuda/pybuda/_C/runtime.pyi b/pybuda/pybuda/_C/runtime.pyi new file mode 100644 index 000000000..82a24b2cf --- /dev/null +++ b/pybuda/pybuda/_C/runtime.pyi @@ -0,0 +1,8 @@ +import torch + +class Binary: + def __init__(self, *args, **kwargs) -> None: ... + def get_program_inputs(self, *args, **kwargs): ... + def get_program_outputs(self, *args, **kwargs): ... + +def run_binary(arg0: Binary, arg1: int, arg2: list[torch.Tensor]) -> list[torch.Tensor]: ... diff --git a/pybuda/pybuda/_C/scheduler.pyi b/pybuda/pybuda/_C/scheduler.pyi deleted file mode 100644 index ebd6cc592..000000000 --- a/pybuda/pybuda/_C/scheduler.pyi +++ /dev/null @@ -1,29 +0,0 @@ -import pybuda._C.graph -from typing import ClassVar, List - -ModuleInputsBFS: SchedulerPolicy -Topological: SchedulerPolicy - -class SchedulerConfig: - policy: SchedulerPolicy - scheduler_constraints: List[List[str]] - def __init__(self, scheduler_policy: SchedulerPolicy, scheduler_constraints: List[List[str]]) -> None: ... - -class SchedulerPolicy: - __members__: ClassVar[dict] = ... # read-only - ModuleInputsBFS: ClassVar[SchedulerPolicy] = ... - Topological: ClassVar[SchedulerPolicy] = ... - __entries: ClassVar[dict] = ... - def __init__(self, value: int) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - @property - def name(self) -> str: ... - @property - def value(self) -> int: ... - -def policy_from_string(schedule_policy_str: str) -> SchedulerPolicy: ... -def run_scheduler(scheduler_config: SchedulerConfig, graph: pybuda._C.graph.Graph) -> List[str]: ...