[enco] Introduce extended coco IR (#2496)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 5 Dec 2018 04:12:09 +0000 (13:12 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 5 Dec 2018 04:12:09 +0000 (13:12 +0900)
This commit introduces a placeholder for extended coco IR entities. The
current implementation includes only one extended instruction (ANNDepthConcatF).

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/coex/IR.h [new file with mode: 0644]
contrib/enco/core/src/coex/IR.test.cpp [new file with mode: 0644]

diff --git a/contrib/enco/core/src/coex/IR.h b/contrib/enco/core/src/coex/IR.h
new file mode 100644 (file)
index 0000000..a80d64e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. 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 __ENCO_COEX_IR_H__
+#define __ENCO_COEX_IR_H__
+
+#include <coco/IR.h>
+
+/**
+ * @brief Concatenate feature maps along "depth" dimension through Andoird NN API
+ */
+class ANNDepthConcatF : public coco::Instr,
+                        public coco::Object::Producer,
+                        public coco::Object::Consumer
+{
+public:
+  ANNDepthConcatF() : _out{this}, _fst{this}, _snd{this}
+  {
+    // DO NOTHING
+  }
+
+public:
+  coco::Instr *loc(void) override { return this; }
+
+public:
+  coco::Object *out(void) const { return _out.value(); }
+  void out(coco::Object *o) { _out.value(o); }
+
+  coco::Object *fst(void) const { return _fst.value(); }
+  void fst(coco::Object *o) { _fst.value(o); }
+
+  coco::Object *snd(void) const { return _snd.value(); }
+  void snd(coco::Object *o) { _snd.value(o); }
+
+private:
+  coco::Def _out;
+
+  // TODO Support variadic-length inputs
+  coco::Use _fst;
+  coco::Use _snd;
+};
+
+#endif // __ENCO_COEX_IR_H__
diff --git a/contrib/enco/core/src/coex/IR.test.cpp b/contrib/enco/core/src/coex/IR.test.cpp
new file mode 100644 (file)
index 0000000..9d8389a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. 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 "IR.h"
+
+#include <gtest/gtest.h>
+
+TEST(IRTest, ANNDepthConcatF_default_constructor)
+{
+  ANNDepthConcatF ins;
+
+  ASSERT_EQ(ins.out(), nullptr);
+  ASSERT_EQ(ins.fst(), nullptr);
+  ASSERT_EQ(ins.snd(), nullptr);
+}