Build API
- iree.build.cl_arg(name: str, *, action=None, default=None, type=None, help=None)
Used to define or reference a command-line argument from within actions and entry-points.
Keywords have the same interpretation as ArgumentParser.add_argument().
Any ClArg set as a default value for an argument to an entrypoint will be added to the global argument parser. Any particular argument name can only be registered once and must not conflict with a built-in command line option. The implication of this is that for single-use arguments, the =cl_arg(…) can just be added as a default argument. Otherwise, for shared arguments, it should be created at the module level and referenced.
When called, any entrypoint arguments that do not have an explicit keyword set will get their value from the command line environment.
Note that this does not have a typing annotation, allowing the argument to be annotated with a type, assuming that resolution will happen dynamically in some fashion.
- iree.build.compile(*, name: str, source: iree.build.executor.BuildFile | str, target_default: bool = True) tuple[iree.build.executor.BuildFile]
Invokes iree-compile on a source file, producing binaries for one or more target machines.
- Parameters
name – The logical name of the compilation command. This is used as the stem for multiple kinds of output files.
source – Input source file.
target_default – Whether to use command line arguments to compute a target machine configuration (default True). This would be set to False to explicitly depend on target information contained in the source file and not require any target flags passed to the build tool.
- iree.build.entrypoint(f=None, *, description: str | None = None)
Function decorator to turn it into a build entrypoint.
- iree.build.iree_build_main(module='__main__', args: list[str] | None = None, stdout: IO | None = None, stderr: IO | None = None)
Make a build module invoke iree.build on itself when run.
Typically, if you have a module that declares build entrypoints, you will add a stanza at the end:
from iree.build import * if __name__ == "__main__": iree_build_main()
- iree.build.load_build_module(module_path: pathlib.Path | str)
Loads a build module by path, evaling and returning it.