kparzysz-quic commented on code in PR #12204: URL: https://github.com/apache/tvm/pull/12204#discussion_r949410521
########## src/runtime/hexagon/ops/conv2d.h: ########## @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#include <HAP_farf.h> +#include <tvm/runtime/c_runtime_api.h> +#include <tvm/runtime/device_api.h> + +#include <cassert> + +#ifndef TVM_RUNTIME_HEXAGON_OPS_CONV2D_H_ +#define TVM_RUNTIME_HEXAGON_OPS_CONV2D_H_ + +#ifdef DEBUG_CONV +#define DEBUG_BLOCK(X) \ + { X } +#define debug(...) FARF(ALWAYS, ##__VA_ARGS__) +#else +#define DEBUG_BLOCK(X) +#define debug(...) +#endif + +#define HAP_CALL(hap_fn, ...) \ + { \ + int rc = hap_fn(__VA_ARGS__); \ + if (rc != 0) { \ + debug("%s failed: rc=%x", #hap_fn, rc); \ + } \ + } + +namespace detail { +static constexpr auto hexagon_device = DLDevice{static_cast<DLDeviceType>(kDLHexagon), 0}; + +// Standalone DLTensor: the standalone-ness means that this object owns the shape +// (as opposed to a DLTensor). Review Comment: `DLTensor` has a pointer to an array of dimensions, but doesn't own the storage, someone else has to allocate it somewhere, put the shape in it, and store the pointer in the DLTensor. This is annoying, since DLTensor is not an entity that can live on its own (the strides are also like this, iirc, but we don't use them here). Standalone DLTensor was invented to contain the shape as a part of the tensor object. -- 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: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org