[GitHub] [tvm] adstraw commented on a change in pull request #10217: Adding support for Hexagon User DMA Engine

2022-02-11 Thread GitBox


adstraw commented on a change in pull request #10217:
URL: https://github.com/apache/tvm/pull/10217#discussion_r804804080



##
File path: src/runtime/hexagon/hexagon/hexagon_user_dma_instructions.h
##
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+#ifndef TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_USER_DMA_INSTRUCTIONS_H_
+#define TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_USER_DMA_INSTRUCTIONS_H_
+
+namespace tvm {
+namespace runtime {
+namespace hexagon {
+
+inline unsigned int dmpause() {
+  unsigned int dm0 = 0;
+  asm volatile(" %0 = dmpause" : "=r"(dm0));
+  return dm0;
+}
+
+inline void dmstart(void* next) { asm volatile(" dmstart(%0)" : : "r"(next)); }
+
+inline unsigned int dmpoll() {
+  unsigned int dm0 = 0;
+  asm volatile(" %0 = dmpoll" : "=r"(dm0));
+  return dm0;
+}
+
+inline unsigned int dmwait() {
+  unsigned int dm0 = 0;
+  asm volatile(" %0 = dmwait" : "=r"(dm0));
+  return dm0;
+}
+
+inline void dmresume(unsigned int dm0) { asm volatile(" dmresume(%0)" : : 
"r"(dm0)); }
+
+static inline unsigned int dmsyncht() {

Review comment:
   Will change to `inline`.




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




[GitHub] [tvm] adstraw commented on a change in pull request #10217: Adding support for Hexagon User DMA Engine

2022-02-10 Thread GitBox


adstraw commented on a change in pull request #10217:
URL: https://github.com/apache/tvm/pull/10217#discussion_r804119199



##
File path: src/runtime/hexagon/hexagon/hexagon_user_dma_descriptors.h
##
@@ -0,0 +1,310 @@
+/*
+ * 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.
+ */
+
+#ifndef TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_USER_DMA_DESCRIPTORS_H_
+#define TVM_RUNTIME_HEXAGON_HEXAGON_HEXAGON_USER_DMA_DESCRIPTORS_H_
+
+namespace tvm {
+namespace runtime {
+namespace hexagon {
+
+// NOTE: Using 2D descriptor size even for 1D descriptors
+#define DMA_DESC_2D_SIZE 32
+
+// TODO(Straw): DMA Status [0][3:0]?
+
+// desc[0][31:4]
+// Descriptors addresses must be (minimum) 16 byte aligned
+// -> Lower 4 bits masked to clear DMA Status
+// -> But, descriptor address is not shifted
+#define DESC_NEXT_MASK 0xFFF0
+#define DESC_NEXT_SHIFT 0
+
+// desc[1][23:0]
+#define DESC_LENGTH_MASK 0x00FF
+#define DESC_LENGTH_SHIFT 0
+
+// desc[1][25:24]
+#define DESC_DESCTYPE_MASK 0x0300
+#define DESC_DESCTYPE_SHIFT 24
+#define DESC_DESCTYPE_1D 0
+#define DESC_DESCTYPE_2D 1
+
+// TODO(Straw): Definition?  Not in the spec.

Review comment:
   Good question.  The fields marked with this TODO were in header files 
sent by Qualcomm but the fields are not described in the spec.  I left myself a 
TODO to investigate.  Also added a "thank you" to Qualcomm in the description 
for sending code that was leveraged here.




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