Skip to content

Latest commit

 

History

History
252 lines (120 loc) · 4.87 KB

yatuner.utils.md

File metadata and controls

252 lines (120 loc) · 4.87 KB

module yatuner.utils


function execute

execute(command) → Dict[str, Any]

Execute given command.

Args:

  • command: Command to be executed.

function fetch_perf_stat

fetch_perf_stat(command) → Dict[str, Any]

Use perf stat <command> to analyze given program and get dict of counters.

Args:

  • command: Command to be used in perf stat.

function ir2vec

ir2vec(llvm_ir, outfile, mode='fa', vocab='vocab.txt', level='p')

Call ir2vec tool and fetch the result.


function generate_llvm

generate_llvm(src, llvm_ir, llvm_compiler='clang') → None

Generate llvm ir for source code.


function fetch_src_feature

fetch_src_feature(
    src: str,
    llvm_ir=None,
    outfile=None,
    clean=False
) → <built-in function array>

Fetch source code feature by using ir2vec.


function fetch_arch

fetch_arch() → str

Fetch machine architecture information.

Returns:

  • str: The architecture

function fetch_gcc_optimizers

fetch_gcc_optimizers(cc='gcc') → List[str]

Fetch gcc optimizers

Args:

  • cc (str, optional): Specified gcc binary. Defaults to 'gcc'.

Returns:

  • List[str]: Optimizers

function fetch_gcc_version

fetch_gcc_version(cc='gcc') → Tuple[int, int, int]

Fetch gcc version.

Args:

  • cc (str, optional): Specified gcc binary. Defaults to 'gcc'.

Returns:

  • Tuple[int, int, int]: gcc version in triplet.

function fetch_gcc_parameters

fetch_gcc_parameters(
    cc='gcc',
    params_def: str = None
) → Dict[str, Tuple[int, int, int]]

Fetch gcc parameters and its range

Args:

  • cc (str, optional): Specified gcc binary. Defaults to 'gcc'.
  • params_def (str, optional): params.def of gcc source for version earlier then 10. Defaults to None.

Raises:

  • RuntimeError: If params.def is not given for gcc earlier than 10.

Returns:

  • Dict[str, Tuple[int, int, int]]: Parameters in format of param: (min, max, default).

function fetch_gcc_enabled_optimizers

fetch_gcc_enabled_optimizers(cc='gcc', options='-O3') → List[str]

Fetch enabled optimizers of certain options

Args:

  • cc (str, optional): Specified gcc binary. Defaults to 'gcc'.
  • options (str, optional): Options to look into. Defaults to '-O3'.

Returns:

  • List[str]: Enabled optimizers.

function fetch_size

fetch_size(filename: str) → int

Fetch file size

Args:

  • filename (str): Path to file.

Returns:

  • int: File size in bytes.

This file was automatically generated via lazydocs.