aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/hvx
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-11 17:02:46 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-11 17:22:52 -0800
commit6ee46a339eea3a77396cc9f488595ae94481595d (patch)
tree8df973b1e9b1a9ab42a926cc31c225dc0319070d /tensorflow/contrib/hvx
parent83c6e0c63acdcab2c58c4ed7220bfa58879b1d57 (diff)
Add a placeholder for hexagon_controller
Change: 144268749
Diffstat (limited to 'tensorflow/contrib/hvx')
-rw-r--r--tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/include/soc_interface.h98
-rwxr-xr-xtensorflow/contrib/hvx/hexagon_controller/src_soc_interface/soc_interface.c124
2 files changed, 222 insertions, 0 deletions
diff --git a/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/include/soc_interface.h b/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/include/soc_interface.h
new file mode 100644
index 0000000000..6d85e6ce48
--- /dev/null
+++ b/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/include/soc_interface.h
@@ -0,0 +1,98 @@
+/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
+
+Licensed 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 TENSORFLOW_PLATFORM_HEXAGON_SOC_INTERFACE_H_
+#define TENSORFLOW_PLATFORM_HEXAGON_SOC_INTERFACE_H_
+
+#include <inttypes.h>
+
+// Declaration of APIs provided by hexagon shared library. This header is shared
+// with both hexagon library built with qualcomm SDK and tensorflow.
+// All functions defined here must have prefix "soc_interface" to avoid
+// naming conflicts.
+#ifdef __cplusplus
+extern "C" {
+#else
+#include <stdbool.h>
+#endif // __cplusplus
+// Returns the version of loaded hexagon wrapper shared library.
+// You should assert that the version matches the expected version before
+// calling APIs defined in this header.
+int soc_interface_GetWrapperVersion();
+// Returns the version of hexagon binary.
+// You should assert that the version matches the expected version before
+// calling APIs defined in this header.
+int soc_interface_GetSocControllerVersion();
+// Initialize SOC
+bool soc_interface_Init();
+// Finalize SOC
+bool soc_interface_Finalize();
+// Execute graph on SOC
+bool soc_interface_ExecuteGraph();
+// Teardown graph setup
+bool soc_interface_TeardownGraph();
+// Send input data to SOC
+bool soc_interface_FillInputNodeFloat(int x, int y, int z, int d,
+ const uint8_t* const buf,
+ uint64_t buf_size);
+// Load output data from SOC
+bool soc_interface_ReadOutputNodeFloat(const char* const node_name,
+ uint8_t** buf, uint64_t* buf_size);
+// Setup graph
+// TODO(satok): Remove and use runtime version
+bool soc_interface_setupDummyGraph(int version);
+
+// Allocate memory for params of node inputs and node outputs
+bool soc_interface_AllocateNodeInputAndNodeOutputArray(int total_input_count,
+ int total_output_count);
+
+// Release memory for params of node inputs and node outputs
+bool soc_interface_ReleaseNodeInputAndNodeOutputArray();
+
+// Set one node's inputs and return pointer to that struct
+void* soc_interface_SetOneNodeInputs(int input_count, const int* const node_id,
+ const int* const port);
+
+// Set one node's outputs and return pointer to that struct
+void* soc_interface_SetOneNodeOutputs(int output_count, int* max_size);
+
+// Append const node to the graph
+bool soc_interface_AppendConstNode(const char* const name, int node_id,
+ int batch, int height, int width, int depth,
+ const uint8_t* const data, int data_length);
+
+// Append node to the graph
+bool soc_interface_AppendNode(const char* const name, int node_id, int op_id,
+ int padding_id, const void* const inputs,
+ int inputs_count, const void* const outputs,
+ int outputs_count);
+
+// Instantiate graph
+bool soc_interface_InstantiateGraph();
+
+// Construct graph
+bool soc_interface_ConstructGraph();
+
+// Set log level
+void soc_interface_SetLogLevel(int log_level);
+
+// Set debug flag
+void soc_interface_SetDebugFlag(uint64_t flag);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // TENSORFLOW_PLATFORM_HEXAGON_SOC_INTERFACE_H_
diff --git a/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/soc_interface.c b/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/soc_interface.c
new file mode 100755
index 0000000000..ebcbb963e8
--- /dev/null
+++ b/tensorflow/contrib/hvx/hexagon_controller/src_soc_interface/soc_interface.c
@@ -0,0 +1,124 @@
+/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
+
+Licensed 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 "soc_interface.h"
+
+int soc_interface_GetWrapperVersion() {
+ // TODO(satok): implement
+ return -1;
+}
+
+int soc_interface_GetSocControllerVersion() {
+ // TODO(satok): implement
+ return -1;
+}
+
+bool soc_interface_Init() {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_Finalize() {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_ExecuteGraph() {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_TeardownGraph() {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_FillInputNodeFloat(
+ int x, int y, int z, int d, const uint8_t* const buf, uint64_t buf_size) {
+ // TODO(satok): implement
+ return false;
+}
+
+// TODO(satok): Remove and use runtime version
+bool soc_interface_ReadOutputNodeFloat(
+ const char* const node_name, uint8_t** buf, uint64_t *buf_size) {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_SetupGraphDummy(int version) {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_AllocateNodeInputAndNodeOutputArray(
+ int total_input_count, int total_output_count) {
+ // TODO(satok): implement
+ return false;
+}
+
+bool soc_interface_ReleaseNodeInputAndNodeOutputArray() {
+ // TODO(satok): implement
+ return false;
+}
+
+void* soc_interface_SetOneNodeInputs(
+ int input_count, const int* const node_id, const int* const port) {
+ // TODO(satok): implement
+ return 0;
+}
+
+void* soc_interface_SetOneNodeOutputs(int output_count, int* max_size) {
+ // TODO(satok): implement
+ return 0;
+}
+
+// Append const node to the graph
+bool soc_interface_AppendConstNode(
+ const char* const name, int node_id, int batch, int height, int width,
+ int depth, const uint8_t* const data, int data_length) {
+ // TODO(satok): implement
+ return false;
+}
+
+// Append node to the graph
+bool soc_interface_AppendNode(
+ const char* const name, int node_id, int ops_id, int padding_id,
+ const void* const inputs, int inputs_count, const void* const outputs,
+ int outputs_count) {
+ // TODO(satok): implement
+ return false;
+}
+
+
+// Instantiate graph
+bool soc_interface_InstantiateGraph() {
+ // TODO(satok): implement
+ return false;
+}
+
+// Construct graph
+bool soc_interface_ConstructGraph() {
+ // TODO(satok): implement
+ return false;
+}
+
+void soc_interface_SetLogLevel(int log_level) {
+ // TODO(satok): implement
+}
+
+void soc_interface_SetDebugFlag(uint64_t flag) {
+ // TODO(satok): implement
+}