Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microNPU][2c] Add performance modelling to cascader #9778

Merged
merged 3 commits into from
Jan 17, 2022
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
3 changes: 3 additions & 0 deletions python/tvm/contrib/ethosu/cascader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
for both performance and memory usage on Arm(R) Ethos(TM)-U NPUs.
"""
from .stripe_config import StripeConfig
from .block_config import BlockConfig
from .propagator import Propagator
from .graph import (
PerformanceInfo,
Tensor,
Part,
TESubgraph,
CascaderGraph,
BufferMode,
register_matcher,
create_cascader_graph,
)
from .parts import InlinePart, EthosuPart
from .device_config import EthosuDeviceConfig
49 changes: 49 additions & 0 deletions python/tvm/contrib/ethosu/cascader/block_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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.
# pylint: disable=invalid-name
"""Block config to hold an output block shape and a corresponding input block shape"""
from typing import List
import tvm._ffi

from tvm.runtime import Object

from . import _ffi_api


@tvm._ffi.register_object("contrib.ethosu.cascader.BlockConfig")
class BlockConfig(Object):
"""BlockConfig class"""

def __init__(self, output_shape: List[int], compute_cycles: int, output_cycles: int):
self.__init_handle_by_constructor__(
_ffi_api.BlockConfig, output_shape, compute_cycles, output_cycles
)

@property
def output_shape(self) -> List[int]:
return list(self._output_shape)

@property
def compute_cycles(self) -> int:
return int(self._compute_cycles)

@property
def output_cycles(self) -> int:
return int(self._output_cycles)

def __repr__(self) -> str:
return f"BlockConfig(output_shape={self.output_shape})"
Loading