Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Change-Id: Iff5f1effa08e0628de91f5577487d0cecebec824
  • Loading branch information
mbaret committed Nov 18, 2021
1 parent 52edffa commit b878cb5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
3 changes: 0 additions & 3 deletions python/tvm/contrib/ethosu/cascader/propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ def __init__(self, transform, offset):
def propagate(self, stripe_config):
return _ffi_api.PropagatorPropagate(self, stripe_config)

def benchmark_propagate(self, stripe_config, repeats):
return _ffi_api.PropagatorPropagateBenchmark(self, stripe_config, repeats)

@property
def transform(self):
"""Get the transform matrix"""
Expand Down
8 changes: 0 additions & 8 deletions src/contrib/ethosu/cascader/propagator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ TVM_REGISTER_GLOBAL("contrib.ethosu.cascader.PropagatorPropagate")
return propagator->propagate(stripe_config);
});

TVM_REGISTER_GLOBAL("contrib.ethosu.cascader.PropagatorPropagateBenchmark")
.set_body_typed([](Propagator propagator, StripeConfig stripe_config, int repeats) {
for (int i = 0; i < repeats; i++) {
propagator->propagate(stripe_config);
}
return propagator->propagate(stripe_config);
});

TVM_REGISTER_NODE_TYPE(PropagatorNode);

} // namespace cascader
Expand Down
16 changes: 16 additions & 0 deletions src/contrib/ethosu/cascader/stripe_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,22 @@ class StripeConfig : public ObjectRef {
* \param enable_sliding_window Whether to assume the sliding window optimization.
* \return A map between stripe shapes and the number of stripes of that shape that need
* executing.
* \note If the StripeConfig were to split an (8, 8) tensor into (4, 4) stripes with
* (4, 4) striding, then this function will return {(4, 4): 4} indicating that 4 (4, 4)
* stripes will be executed. If instead an (8, 8) were striped using (5, 5) stripes
* with (5, 5) striding, this function would return:
*
* {
* (5, 5): 1,
* (3, 5): 1,
* (5, 3): 1,
* (3, 3): 1,
* }
*
* This is because some of the stripes will exceed the extent of the tensor and so only part
* of them will need executing. Therefore, CountStripes will return the exact number of each
* shape of stripe that is executed, accounting for edge and overlap behaviour which is not
* explicit in the StripeConfig alone.
*/
std::map<std::vector<int>, int> CountStripes(const StripeConfig& stripe_config,
bool enable_sliding_window);
Expand Down

0 comments on commit b878cb5

Please sign in to comment.