hespas.estimator.compute_estimator
Classes
|
This is the base class for Estimators that should be user-facing. |
Exceptions
- exception hespas.estimator.compute_estimator.InvalidOpError
Bases:
Exception
- class hespas.estimator.compute_estimator.ComputeEstimator(hw_config=None, **kwargs)
Bases:
EstimatorThis is the base class for Estimators that should be user-facing. Most Estimators should derive from this. For the specification of the Estimator compute api itself, refer to the documentation in the base Estimator class.
- compute_estimator = True
- type = <hespas.estimator.config_option.ConfigOption object>
- __unknown_op_panic(op_info: OpInfo) OpResult
This is a default for descended classes that an exception is thrown if the operator isn’t known. This can be overriden through the @register_default_op_handler decorator, but not directly. This should not be directly overidden or called manually.
- Parameters:
op_info – The operator to estimate the time of. This method will not estimate, and just throw an exception
- Returns:
The result of the estimator for this operator (to match the type of operator estimators - will not return)
- Raises:
InvalidOpError – Raises an InvalidOpError for any unknown operator
- __setup_per_module_stat_tree(module: MLIRModule) Never
Setup the per-module stats subtree for this module
- Parameters:
module – The module to be estimated
- __setup_per_op_stat_tree(op_info: OpInfo) Never
Setup the per-op stats subtree for this operator
- Parameters:
op_info – The info for the operator to be estimated
- __total_estimate_start_time(module: MLIRModule) Never
A simple, universal pre-run hook that keeps track of the start wall clock time of all estimations
- Parameters:
module – The module to be estimated
- __setup_per_op_tree(_: MLIRModule, _1: EstimatorResult) Never
Setup the per-op stats subtree for the estimated module, included cached modules
- Parameters:
_ – The module that finished estimating (ignored)
_1 – The result of estimating the module (ignored)
- __get_total_estimate_time(module: MLIRModule, result: EstimatorResult) Never
A simple, universal post-estimation hook that calculates the total wall clock and uncached time
- Parameters:
module – The module that finished estimating
result – The result of estimating the module
- __get_module_runtime(_: MLIRModule, result: ModuleResult) Never
A simple, universal post-run hook that keeps track of the runtime for each module estimated
- Parameters:
_ – The module that finished estimating (ignored)
result – The result of estimating the module
- __get_total_runtime(_: MLIRModule, _1: EstimatorResult) Never
A simple, universal post-estimation hook that keeps track of the runtime for each module estimated
- Parameters:
_ – The module that finished estimating (ignored)
_1 – The result of estimating the module (ignored)
- __count_processed(module: MLIRModule, _: EstimatorResult) Never
A simple, universal post-estimation hook that keeps track of the number of operators and modules that have been run
- Parameters:
module – The module that has been run
_ – The result of estimating the module (ignored)
- __get_per_op_runtime(_: MLIRModule, _1: EstimatorResult) Never
Collects the per-op runtime stats and populates the per_op and per_op_runtime_props stat subtrees
- Parameters:
_ – Module that has finished estimating (ignored)
_1 – Result of estimation (ignored)
- __module_run_start_time(module: MLIRModule) Never
A simple, universal pre-run hook that keeps track of the start wall clock time of a module that will be run
- Parameters:
module – The module to be run
- __module_run_end_time(module: MLIRModule, result: ModuleResult) Never
A simple, universal post-run hook that keeps track of the end wall clock time and total wall clock time for the ran module
- Parameters:
module – The module that has been run
result – The result of estimating the module
- __print_start_line(_: MLIRModule) Never
Prints the dividing start line
- Parameters:
_ – The module to be estimated (ignored)
- __count_cache_hits(module: MLIRModule, hash: str) Never
A simple, universal cache hit hook that keeps track of the number of total and per-hash cache hits
- Parameters:
module – The module that has hit in cache
hash – Hash of the module that has hit in cache
- __get_cached_module_times(_: MLIRModule, hash: str) Never
A simple, universal cache hit hook that sets up the statistics for the module that hit in cache
- Parameters:
_ – The module that hit in cache (ignored)
hash – Hash of the module that has miss in cache
- __get__module_op_times(op_info: OpInfo, result: OpResult) Never
A simple, universal post-op estimation hook to collect the total op times for this module
- Parameters:
op_info – The operator estimated
result – The result of the estimation of this operator
- __print_cached_runtime(module: MLIRModule, hash: str) Never
A simple, universal cache hit hook that prints the runtime of the cached module
- Parameters:
module – The module that hit in cache
hash – Hash of the module that has miss in cache
- __print_run_runtime(module: MLIRModule, result: ModuleResult) Never
A simple, universal cache hit hook that prints the runtime of the module that is actually run
- Parameters:
module – The module that hit in cache
result – Result of the estimation
- _cache_hit_hooks = [<function ComputeEstimator.__count_cache_hits>, <function ComputeEstimator.__get_cached_module_times>, <function ComputeEstimator.__print_cached_runtime>]
- _cache_miss_hooks = []
- _default_op_handler(op_info: OpInfo) OpResult
This is a default for descended classes that an exception is thrown if the operator isn’t known. This can be overriden through the @register_default_op_handler decorator, but not directly. This should not be directly overidden or called manually.
- Parameters:
op_info – The operator to estimate the time of. This method will not estimate, and just throw an exception
- Returns:
The result of the estimator for this operator (to match the type of operator estimators - will not return)
- Raises:
InvalidOpError – Raises an InvalidOpError for any unknown operator
- _init_hooks = []
- _metadata_hooks = []
- _module_metadata_hooks = []
- _op_handlers = {}
- _post_estimate_hooks = [<function ComputeEstimator.__setup_per_op_tree>, <function ComputeEstimator.__get_total_estimate_time>, <function ComputeEstimator.__get_total_runtime>, <function ComputeEstimator.__count_processed>, <function ComputeEstimator.__get_per_op_runtime>]
- _post_op_hooks = [<function ComputeEstimator.__get__module_op_times>]
- _post_run_hooks = [<function ComputeEstimator.__get_module_runtime>, <function ComputeEstimator.__module_run_end_time>, <function ComputeEstimator.__print_run_runtime>]
- _pre_estimate_hooks = [<function ComputeEstimator.__setup_per_module_stat_tree>, <function ComputeEstimator.__total_estimate_start_time>, <function ComputeEstimator.__print_start_line>]
- _pre_op_hooks = [<function ComputeEstimator.__setup_per_op_stat_tree>]
- _pre_run_hooks = [<function ComputeEstimator.__module_run_start_time>]
- bases_order = {'': 0}
- config_arguments = {'cache_dir': <hespas.estimator.config_option.ConfigOption object>, 'disable_cache': <hespas.estimator.config_option.ConfigOption object>, 'in_memory_only_cache': <hespas.estimator.config_option.ConfigOption object>, 'num_npus': <hespas.estimator.config_option.ConfigOption object>, 'type': <hespas.estimator.config_option.ConfigOption object>}
- config_options = {'cache_dir': <hespas.estimator.config_option.ConfigOption object>, 'disable_cache': <hespas.estimator.config_option.ConfigOption object>, 'in_memory_only_cache': <hespas.estimator.config_option.ConfigOption object>, 'num_npus': <hespas.estimator.config_option.ConfigOption object>, 'type': <hespas.estimator.config_option.ConfigOption object>}
- display_name = 'compute'
- display_name_map = {'': <class 'hespas.estimator.estimator.Estimator'>}