Files
apache--tvm/python/tvm/micro/micro_binary.py
T
Andrew Reusch c7ff88516f Add µTVM Zephyr support + QEMU regression test (#6603)
* Split transport classes into transport package.

* Introduce transport timeouts.

* black format

* Add metadata-only artifacts

* Simplify utvm rpc server API and ease handling of short packets.

* add zephyr test against qemu

* Add qemu build config

* fix typo

* cleanup zephyr main

* fix nonblocking piping on some linux kernels

* don't double-open transport

* validate FD are in non-blocking mode

* gitignore test debug files

* cleanup zephyr compiler

* re-comment serial until added

* remove logging

* add zephyr exclusions to check_file_type

* add asf header

* lint

* black format

* more pylint

* kill utvm rpc_server bindings, which don't work anymore and fail pylint

* fix compiler warning

* fixes related to pylint

* clang-format again

* more black format

* add qemu regression

* Fix paths for qemu/ dir

* fix typo

* fix SETFL logic

* export SessionTerminatedError and update except after moving

* fix test_micro_artifact

* retrigger staging CI

* fix jenkins syntax hopefully

* one last syntax error

* Add ci_qemu to Jenkinsfile

* build in qemu

* address liangfu comments

* fix new bug with list passing

* retrigger CI
2020-10-15 15:55:45 +08:00

66 lines
2.2 KiB
Python

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Defines an Artifact implementation for representing compiled micro TVM binaries."""
from . import artifact
class MicroBinary(artifact.Artifact):
"""An Artifact that describes a compiled binary."""
ARTIFACT_TYPE = "micro_binary"
@classmethod
def from_unarchived(cls, base_dir, labelled_files, metadata, immobile):
binary_file = labelled_files["binary_file"][0]
del labelled_files["binary_file"]
debug_files = None
if "debug_files" in labelled_files:
debug_files = labelled_files["debug_files"]
del labelled_files["debug_files"]
return cls(
base_dir,
binary_file,
debug_files=debug_files,
labelled_files=labelled_files,
metadata=metadata,
immobile=immobile,
)
def __init__(
self,
base_dir,
binary_file,
debug_files=None,
labelled_files=None,
metadata=None,
immobile=False,
):
labelled_files = {} if labelled_files is None else dict(labelled_files)
metadata = {} if metadata is None else dict(metadata)
labelled_files["binary_file"] = [binary_file]
if debug_files is not None:
labelled_files["debug_files"] = debug_files
super(MicroBinary, self).__init__(base_dir, labelled_files, metadata, immobile=immobile)
self.binary_file = binary_file
self.debug_files = debug_files