etha.tensor_bus.batch_state
===========================

.. py:module:: etha.tensor_bus.batch_state

.. autoapi-nested-parse::

   Batch state management for TensorBus.

   A batch represents one call to register_tensors(). Multiple batches can exist
   for the same pair, each with independent tensors and handlers.



Classes
-------

.. autoapisummary::

   etha.tensor_bus.batch_state.BatchState


Module Contents
---------------

.. py:class:: BatchState

   Bases: :py:obj:`msgspec.Struct`


   State for a single batch of registered tensors.

   A batch is created for each register_tensors() call and contains all
   tensor data and execution plans for that specific registration.

   Key design: chunks and buckets are FLATTENED across all pairs in the batch,
   allowing single-pass execution via execute_bucket_pipeline().


   .. py:attribute:: batch_group
      :type:  torch.distributed.ProcessGroup | None
      :value: None



   .. py:attribute:: batch_id
      :type:  str


   .. py:attribute:: bucket_size
      :type:  int | None
      :value: None



   .. py:attribute:: local_group
      :type:  torch.distributed.ProcessGroup | None
      :value: None



   .. py:attribute:: local_leader
      :type:  int | None
      :value: None



   .. py:attribute:: pair_names
      :type:  list[str]


   .. py:attribute:: pair_target_dtypes
      :type:  dict[str, list[torch.dtype]]


   .. py:attribute:: pair_tensors
      :type:  dict[str, list[torch.Tensor]]


   .. py:attribute:: recv_buckets
      :type:  list[etha.comm.ir.Bucket] | None
      :value: None



   .. py:attribute:: recv_chunks
      :type:  list[etha.comm.ir.Chunk]


   .. py:attribute:: send_buckets
      :type:  list[etha.comm.ir.Bucket] | None
      :value: None



   .. py:attribute:: send_chunks
      :type:  list[etha.comm.ir.Chunk]


