osaca package

Submodules

osaca.db_interface module

sanity_check(arch: str, verbose=False, output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Checks the database for missing TP/LT values, instructions might missing int the ISA DB and duplicate instructions.

Parameters:
  • arch (str) – micro-arch key to define DB to check
  • verbose (bool, optional) – verbose output flag, defaults to False
  • output_file (stream, optional) – output stream specifying where to write output, defaults to sys.      stdout
import_benchmark_output(arch, bench_type, filepath, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Import benchmark results from micro-benchmarks.

Parameters:
  • arch (str) – target architecture key
  • bench_type (str) – key for defining type of benchmark output
  • filepath (str) – filepath to the output file
  • output (stream) – output stream to dump, defaults to sys.stdout

osaca.frontend module

Frontend interface for OSACA. Does everything necessary for analysis report generation.

class Frontend(filename='', arch=None, path_to_yaml=None)[source]

Bases: object

throughput_analysis(kernel, show_lineno=False, show_cmnts=True)[source]

Build throughput analysis only.

Parameters:
  • kernel (list) – Kernel to build throughput analysis for.
  • show_lineno (bool, optional) – flag for showing the line number of instructions, defaults to False
  • show_cmnts (bool, optional) – flag for showing comment-only lines in kernel, defaults to True
latency_analysis(cp_kernel, separator='|')[source]

Build a list-based CP analysis report.

Parameters:cp_kernel (list) – loop kernel containing the CP information for each instruction form
Separator:separator symbol for the columns, defaults to ‘|’
loopcarried_dependencies(dep_dict, separator='|')[source]

Print a list-based LCD analysis to the terminal.

Parameters:dep_dict (dict) – dictionary with first instruction in LCD as key and the deps as value
Separator:separator symbol for the columns, defaults to ‘|’
full_analysis(kernel, kernel_dg: osaca.semantics.kernel_dg.KernelDG, ignore_unknown=False, verbose=False)[source]

Build the full analysis report including header, the symbol map, the combined TP/CP/LCD view and the list based LCD view.

Parameters:
  • kernel (list) – kernel to report on
  • kernel_dg (KernelDG) – directed graph containing CP and LCD
  • ignore_unknown (boolean, optional) – flag for ignore warning if performance data is missing, defaults to False
  • verbose (boolean, optional) – flag for verbosity level, defaults to False
combined_view(kernel, cp_kernel: osaca.semantics.kernel_dg.KernelDG, dep_dict, ignore_unknown=False, show_cmnts=True)[source]

Build combined view of kernel including port pressure (TP), a CP column and a LCD column.

Parameters:
  • kernel (list) – kernel to report on
  • kernel_dg (KernelDG) – directed graph containing CP and LCD
  • dep_dict (dict) – dictionary with first instruction in LCD as key and the deps as value
  • ignore_unknown (bool, optional) – flag for showing result despite of missing instructions, defaults to False
  • show_cmnts (bool, optional) – flag for showing comment-only lines in kernel, defaults to True

osaca.osaca module

CLI for OSACA

get_version()[source]

Gets the current OSACA version stated in the __init__ file

Returns:str – the version string.
create_parser(parser=None)[source]

Return argparse parser.

Parameters:parser (ArgumentParser) – Existing parser object to add the arguments, defaults to None
Returns:The newly created ArgumentParser object.
check_arguments(args, parser)[source]

Check arguments passed by user that are not checked by argparse itself.

Parameters:
  • args – arguments given from ArgumentParser after parsing
  • parserArgumentParser object
import_data(benchmark_type, arch, filepath, output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Imports benchmark results from micro-benchmarks.

Parameters:
  • benchmark_type (str) – key for defining type of benchmark output
  • arch (str) – target architecture to put the data into the right database
  • filepath (str) – filepath of the output file”
  • output_file (stream, optional) – output stream specifying where to write output, defaults to sys.stdout
insert_byte_marker(args)[source]

Inserts byte markers into an assembly file using kerncraft.

Parameters:args – arguments given from ArgumentParser after parsing
inspect(args, output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Does the actual throughput and critical path analysis of OSACA and prints it to the terminal.

Parameters:
  • args – arguments given from ArgumentParser after parsing
  • output_file (stream, optional) – Define the stream for output, defaults to sys.stdout
run(args, output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Main entry point for OSACAs workflow. Decides whether to run an analysis or other things.

Parameters:
  • args – arguments given from ArgumentParser after parsing
  • output_file (stream, optional) – Define the stream for output, defaults to sys.stdout
get_asm_parser(arch) → osaca.parser.base_parser.BaseParser[source]

Helper function to create the right parser for a specific architecture.

Parameters:arch (str) – architecture code
Returns:BaseParser object
get_unmatched_instruction_ratio(kernel)[source]

Return ratio of unmatched from total instructions in kernel.

main()[source]

Initialize and run command line interface.

osaca.utils module

find_file(name)[source]

Check for existence of name in user or package data folders and return path.

exists_cached_file(name)[source]

Check for existence of file in cache dir. Returns path if it exists and False otherwise.