adstraw commented on a change in pull request #9390: URL: https://github.com/apache/tvm/pull/9390#discussion_r743871619
########## File path: tests/python/contrib/test_hexagon/test_conv2d_conv2d.md ########## @@ -0,0 +1,860 @@ +<!--- 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. --> + +Hexagon conv2d -> conv2d schedules + +# Baseline conv2d -> conv2d + +This is a baseline 1x1 conv2d -> 1x1 conv2d schedule for Hexagon. + +## Command + +pytest -sv "tests/python/contrib/test_hexagon/test_conv2d_conv2d.py::TestConv2dConv2dPackedFilter::test_conv2d[1-64-128-0-1-1-128-1-1-128-1-1-float32-llvm]" + +## Parameters + +| Parameter | Value | +| ------------------------ | ----- | +| Batch | 1 | +| Input Size | 64x64 | +| Input Channel | 128 | +| Conv2d #1 Pad | 0 | +| Conv2d #1 Stride | 1 | +| Conv2d #1 Kernel Size | 1 | +| Conv2d #1 Output Channel | 128 | +| Conv2d #2 Stride | 1 | +| Conv2d #2 Kernel Size | 1 | +| Conv2d #2 Output Channel | 128 | +| k_split | 1 | +| h_split | 1 | + +## Constants + +| Constant | Value | +| ------------------ | ----- | +| Conv2d #2 Pad | 0 | +| Conv2d #1 Dilation | 1 | +| Conv2d #2 Dilation | 1 | + +## Shapes and Layouts + +The input is provided and padded in logical layout and then packed into its physical layout prior to compute. Logical layout / shape information is provided as a reference for phsyical tensors. + +| Tensor | Type | Layout | Shape | Logical Layout | Logical Shape | +| ------------ | -------- | ----------- | ---------------------- | -------------- | ---------------- | +| Input | Logical | NHWC | [1, 64, 64, 128] | | | +| Padded Input | Logical | NHWC | [1, 64, 64, 128] | | | +| Packed Input | Physical | NHWC8h8w32c | [1, 8, 8, 4, 8, 8, 32] | NHWC | [1, 64, 64, 128] | +| Filter 1 | Physical | OIHW8i32o4i | [4, 4, 1, 1, 8, 32, 4] | OIHW | [128, 128, 1, 1] | +| Temp Output | Physical | NHWC8h8w32c | [1, 8, 8, 4, 8, 8, 32] | NHWC | [1, 64, 64, 128] | +| Filter 2 | Physical | OIHW8i32o4i | [4, 4, 1, 1, 8, 32, 4] | OIHW | [128, 128, 1, 1] | +| Output | Physical | NHWC8h8w32c | [1, 8, 8, 4, 8, 8, 32] | NHWC | [1, 64, 64, 128] | + +## Schedule + +This is the conv2d compute schedule: + +``` + for (ko.outer: int32, 0, 4) { + for (ho.outer: int32, 0, 8) { + // caches computed here + for (wo.c: int32, 0, 8) { + for (rc.outer_1: int32, 0, 4) { + for (hi.c: int32, 0, 8) { + for (wi.c: int32, 0, 8) { + for (ki.c: int32, 0, 32) { + for (rc.inner_1: int32, 0, 32) { +``` + +Note that conv2d #1 has an independent loop over the channel out `ko.outer` dimension. This is because the output channels of conv2d #1 are the input channels to conv2d #2 and we compute over all input channels for each conv2d so we must compute over all output channels of conv2d #1 before we compute conv2d #2. Review comment: Agree. This is confusing. Yes, you are correct that `ko.outer` is the iterator over conv2d #2 output channels and `ko.outer_1` is the iterator over conv2d #1 output channels. Just like with the schedule overview above, I was glossing over this level of detail both here in the notes. I have clarified the notes for all test cases which I believe will address your concern. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
