Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion backends/arm/arm_vela.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def vela_bin_pack_io(prefix, data, shape_order=None):
# Output via Vela to binary stream for ArmBackendEthosU
# WARNING: Do not change this without changing VelaBinStream.cpp as that
# function consumes this format and the two need to align.
def vela_compile(tosa_flatbuffer: bytes, args: List[str], shape_order=None):
def vela_compile(
tosa_flatbuffer: bytes, args: List[str], shape_order=None, verbose: bool = False
):
"""
Compile a TOSA graph to a binary stream for ArmBackendEthosU using Vela.
"""
with tempfile.TemporaryDirectory() as tmpdir:
tosaname = "out.tosa"
tosa_path = os.path.join(tmpdir, tosaname)
Expand All @@ -50,6 +55,8 @@ def vela_compile(tosa_flatbuffer: bytes, args: List[str], shape_order=None):
output_dir = os.path.join(tmpdir, "output")
args.append(f"--output-dir={output_dir}")
args.append(tosa_path)
if verbose:
args.append("--verbose-all")
vela.main(" ".join(args).split(" "))

if any("ethos-u85" in arg for arg in args) or any(
Expand Down
7 changes: 6 additions & 1 deletion backends/arm/ethosu_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ def _compile_tosa_flatbuffer(
)

# Pass on the TOSA flatbuffer to the vela compiler.
binary = vela_compile(tosa_flatbuffer, compile_flags, input_order)
binary = vela_compile(
tosa_flatbuffer,
compile_flags,
input_order,
verbose=logger.getEffectiveLevel() == logging.INFO,
)
return binary

@staticmethod
Expand Down
Loading