csullivan commented on a change in pull request #10558:
URL: https://github.com/apache/tvm/pull/10558#discussion_r825216241



##########
File path: src/tir/transforms/texture_flatten.cc
##########
@@ -115,8 +115,9 @@ class TextureFlattener : public TextureLoweringBase {
       size_t axis = DefaultTextureLayoutSeparator(op->bounds.size(), 
storage_scope);
       auto texture =
           ApplyTexture2DFlattening<PrimExpr>(ShapeFromRange{op->bounds}, 
op->bounds.size(), axis);
-      Array<PrimExpr> args = {texture.width, texture.height};
-      stmt = LetStmt(buffer_var, Call(buffer_var.dtype(), 
builtin::texture2d_alloca(), args), body);
+      Array<PrimExpr> args = {StringImm(storage_scope), 2, texture.width, 
texture.height};

Review comment:
       @echuraev If you have the cycles, could you please check that texture 
support in opencl continues to work as expected with this patch?

##########
File path: src/tir/transforms/lower_vtcm_alloc.cc
##########
@@ -0,0 +1,83 @@
+/*
+ * 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 <tvm/tir/builtin.h>
+#include <tvm/tir/stmt.h>
+#include <tvm/tir/transform.h>
+
+#include "../../arith/ir_visitor_with_analyzer.h"
+
+namespace tvm {
+namespace tir {
+
+inline bool IsVtcmStorage(std::string scope) { return scope.find("vtcm") != 
std::string::npos; }

Review comment:
       global.vtcm

##########
File path: src/runtime/hexagon/hexagon/hexagon_device_api_v2.cc
##########
@@ -163,6 +177,63 @@ 
TVM_REGISTER_GLOBAL("device_api.hexagon.mem_copy").set_body([](TVMArgs args, TVM
   *rv = static_cast<int32_t>(0);
 });
 
+std::map<void*, HexagonBuffer*> vtcmallocs;
+
+TVM_REGISTER_GLOBAL("device_api.hexagon.AllocNd").set_body([](TVMArgs args, 
TVMRetValue* rv) {
+  int32_t device_type = args[0];
+  int32_t device_id = args[1];
+  int32_t dtype_code_hint = args[2];
+  int32_t dtype_bits_hint = args[3];
+  std::string scope = args[4];
+  CHECK(scope.find("vtcm") != std::string::npos);
+  int64_t ndim = args[5];
+  // Forcing contiguous allocation, for now
+  // TODO(Straw): Enable discontiguous allocation
+  CHECK_EQ(ndim, 1);
+  std::vector<int64_t> shape;
+  for (int i = 0; i < ndim; ++i) {
+    shape.push_back(args[6 + i]);
+  }

Review comment:
       Since we are now lowering an NdAlloc it would be cleaner to codegen a 
builtin::kArrShape struct. This also then makes the function signature no 
longer variadic wrt the shape. Kind of analogous to using a DLTensor* in the 
runtime API for CopyDataToFrom overload.




-- 
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]


Reply via email to