tinygrad features.search
Note
You likely want the upstream tinygrad, not tinygrab. Tinygrab contains AI generated docstrings for a tinygrad snapshot. Upstream: https://tinygrad.org
- tinygrad.features.search.beam_search(lin: Linearizer, rawbufs, amt: int, allow_test_size=True) Linearizer [source]
Perform a beam search on the given linearizer.
- tinygrad.features.search.lin
The input linearizer to perform the beam search on.
- Type:
- tinygrad.features.search.rawbufs
A collection of raw buffers.
- tinygrad.features.search.amt
The number of results to return from the beam search.
- Type:
int
- tinygrad.features.search.allow_test_size
Whether or not to allow the test size. Defaults to True.
- Type:
bool, optional
- Returns:
The linearizer after performing the beam search.
- Return type:
- tinygrad.features.search.bufs_from_lin(lin: Linearizer) List[Buffer] [source]
Retrieve (scrap) buffers for timing the linearizer.
This function processes the memory buffers of a given linearizer and returns a list of buffers that can be used in further computations.
- tinygrad.features.search.lin
The linearizer object to process.
- Type:
- Returns:
A list of buffer objects for further processing.
- Return type:
List[Buffer]
- tinygrad.features.search.get_linearizer_actions(lin: Linearizer, include_0=True) Dict[int, Linearizer] [source]
Get a dictionary of all possible actions for the given linearizer.
- tinygrad.features.search.lin
The input linearizer.
- Type:
- tinygrad.features.search.include_0
Whether to include the original linearizer in the output dictionary with key 0. Default is True.
- Type:
bool
- Returns:
A dictionary where keys are integers starting from 1 (or 0 if include_0 is True) and values are resulting linearizers after applying each action.
- Return type:
Dict[int, Linearizer]
- tinygrad.features.search.optimize_local_size(clprg: Callable, global_size: List[int], rawbufs: List[Buffer]) List[int] [source]
This function optimizes the local size for a given OpenCL program and global size.
- tinygrad.features.search.clprg
The OpenCL program to be optimized.
- Type:
Callable
- tinygrad.features.search.global_size
A list representing the desired global size.
- Type:
List[int]
- Returns:
A list containing the optimal local size.
- Return type:
List[int]
- tinygrad.features.search.time_linearizer(lin: Linearizer, rawbufs: List[Buffer], allow_test_size=True, max_global_size=65536, cnt=3, disable_cache=False, clear_l2=False) float [source]
This function is used to time the linearizer. It takes in a Linearizer object and a list of Buffer objects, along with optional parameters for controlling how it operates.
- tinygrad.features.search.lin
The input Linearizer object.
- Type:
- tinygrad.features.search.allow_test_size
A flag to allow test size. Defaults to True.
- Type:
bool, optional
- tinygrad.features.search.max_global_size
The maximum global size allowed. Defaults to 65536.
- Type:
int, optional
- tinygrad.features.search.cnt
The number of times the linearizer is timed. Defaults to 3.
- Type:
int, optional
- tinygrad.features.search.disable_cache
A flag to disable cache. Defaults to False.
- Type:
bool, optional
- tinygrad.features.search.clear_l2
A flag to clear level 2 cache. Defaults to False.
- Type:
bool, optional
- Returns:
The minimum of the timed values.
- Return type:
float