@@ -34,7 +34,7 @@ def read_configs(
3434 Returns:
3535 Configuration object with populated configurations.
3636 """
37- config : Config = Config ([], [], [])
37+ config : Config = Config ([], [], [], None )
3838
3939 dirname : str = os .path .dirname (__file__ )
4040
@@ -51,6 +51,9 @@ def read_configs(
5151 impl_postfix_path = os .path .join (
5252 dirname , "../configs/impl_postfix.toml"
5353 ),
54+ precision_dtypes_path = os .path .join (
55+ dirname , "../configs/precision_dtypes.toml"
56+ ),
5457 ),
5558 ]
5659
@@ -96,6 +99,8 @@ def read_configs(
9699 read_frameworks (config , mod .framework_configs_path )
97100 if mod .impl_postfix_path != "" :
98101 read_implementation_postfixes (config , mod .impl_postfix_path )
102+ if mod .precision_dtypes_path != "" :
103+ read_precision_dtypes (config , mod .precision_dtypes_path )
99104 if mod .path != "" :
100105 sys .path .append (mod .path )
101106
@@ -127,8 +132,6 @@ def read_benchmarks(
127132 recursive: Either to load configs recursively.
128133 parent_package: Package that contains benchmark packages.
129134 benchmarks: list of benchmarks to load. None means all.
130-
131- Returns: nothing.
132135 """
133136 for bench_info_file in os .listdir (bench_info_dir ):
134137 bench_info_file_path = os .path .join (bench_info_dir , bench_info_file )
@@ -172,8 +175,6 @@ def read_frameworks(config: Config, framework_info_dir: str) -> None:
172175 Args:
173176 config: Configuration object where settings should be populated.
174177 framework_info_dir: Path to the directory with configuration files.
175-
176- Returns: nothing.
177178 """
178179 for framework_info_file in os .listdir (framework_info_dir ):
179180 if not framework_info_file .endswith (".toml" ):
@@ -201,8 +202,6 @@ def read_implementation_postfixes(
201202 Args:
202203 config: Configuration object where settings should be populated.
203204 impl_postfix_file: Path to the configuration file.
204-
205- Returns: nothing.
206205 """
207206 with open (impl_postfix_file ) as file :
208207 file_contents = file .read ()
@@ -213,15 +212,26 @@ def read_implementation_postfixes(
213212 config .implementations .append (implementation )
214213
215214
215+ def read_precision_dtypes (config : Config , precision_dtypes_file : str ) -> None :
216+ """Read and populate dtype_obj data types file.
217+
218+ Args:
219+ config: Configuration object where settings should be populated.
220+ precision_dtypes_file: Path to the configuration file.
221+ """
222+ with open (precision_dtypes_file ) as file :
223+ file_contents = file .read ()
224+
225+ config .dtypes = tomli .loads (file_contents )
226+
227+
216228def setup_init (config : Benchmark , modules : list [str ]) -> None :
217229 """Read and discover initialization module and function.
218230
219231 Args:
220232 config: Benchmark configuration object where settings should be
221233 populated.
222234 modules: List of available modules for the benchmark to find init.
223-
224- Returns: nothing.
225235 """
226236 if config .init is None :
227237 return
@@ -292,8 +302,6 @@ def read_benchmark_implementations(
292302 available implementations. It does not affect initialization import.
293303 implementations: Prepopulated list of implementations.
294304
295- Returns: nothing.
296-
297305 Raises:
298306 RuntimeError: Implementation file does not match any known postfix.
299307 """
0 commit comments