[coco] Remove BagInfo (#1536)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 18 Sep 2018 09:47:29 +0000 (18:47 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 18 Sep 2018 09:47:29 +0000 (18:47 +0900)
This commit removes all the reference of deprecated BagInfo from coco IR
codebase.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
25 files changed:
contrib/coco/core/include/coco/IR/Bag.h
contrib/coco/core/include/coco/IR/BagInfo.forward.h [deleted file]
contrib/coco/core/include/coco/IR/BagInfo.h [deleted file]
contrib/coco/core/include/coco/IR/Dep.h
contrib/coco/core/include/coco/IR/InstrManager.h
contrib/coco/core/include/coco/IR/Read.h
contrib/coco/core/include/coco/IR/Update.h
contrib/coco/core/src/IR/Bag.cpp
contrib/coco/core/src/IR/Bag.test.cpp
contrib/coco/core/src/IR/BagInfo.test.cpp [deleted file]
contrib/coco/core/src/IR/BagManager.cpp
contrib/coco/core/src/IR/BagManager.test.cpp
contrib/coco/core/src/IR/Dep.cpp
contrib/coco/core/src/IR/Dep.test.cpp
contrib/coco/core/src/IR/Input.cpp
contrib/coco/core/src/IR/Input.test.cpp
contrib/coco/core/src/IR/Object.cpp
contrib/coco/core/src/IR/Object.test.cpp
contrib/coco/core/src/IR/Output.cpp
contrib/coco/core/src/IR/Output.test.cpp
contrib/coco/core/src/IR/Read.cpp
contrib/coco/core/src/IR/Read.test.cpp
contrib/coco/core/src/IR/Shuffle.test.cpp
contrib/coco/core/src/IR/Update.cpp
contrib/coco/core/src/IR/Update.test.cpp

index 1328b43..296f9fe 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef __COCO_IR_BAG_H__
 #define __COCO_IR_BAG_H__
 
-#include "coco/IR/BagInfo.forward.h"
-
 #include "coco/IR/Entity.h"
 #include "coco/IR/ObjectSet.h"
 #include "coco/IR/DepSet.h"
@@ -55,7 +53,7 @@ public:
   friend class Output;
 
 public:
-  explicit Bag(std::unique_ptr<BagInfo> &&info);
+  explicit Bag(uint32_t size);
 
 public:
   ~Bag();
@@ -105,9 +103,6 @@ private:
   void output(Output *o) { _output = o; }
 
 private:
-  std::unique_ptr<BagInfo> _info;
-
-private:
   uint32_t _size;
 
   /** @brief Links to dependent Object(s) */
diff --git a/contrib/coco/core/include/coco/IR/BagInfo.forward.h b/contrib/coco/core/include/coco/IR/BagInfo.forward.h
deleted file mode 100644 (file)
index 856eed6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __COCO_IR_BAG_INFO_FORWARD_H__
-#define __COCO_IR_BAG_INFO_FORWARD_H__
-
-namespace coco
-{
-
-class BagInfo;
-
-} // namespace coco
-
-#endif // __COCO_IR_BAG_INFO_FORWARD_H__
diff --git a/contrib/coco/core/include/coco/IR/BagInfo.h b/contrib/coco/core/include/coco/IR/BagInfo.h
deleted file mode 100644 (file)
index f098f2c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef __COCO_IR_BAG_INFO_H__
-#define __COCO_IR_BAG_INFO_H__
-
-#include "coco/IR/Bag.h"
-#include "coco/IR/DepSet.h"
-#include "coco/IR/ReadSet.h"
-#include "coco/IR/UpdateSet.h"
-
-#include <set>
-
-#include <cstdint>
-
-namespace coco
-{
-
-class BagMask
-{
-public:
-  enum Field
-  {
-    Input,
-    Output,
-  };
-
-public:
-  // @brief Mask field F
-  void set(const Field &f) { _masked.insert(f); }
-  // @brief Unmask field F
-  void unset(const Field &f) { _masked.erase(f); }
-
-public:
-  // @brief Return true if field F is masked
-  bool masked(const Field &f) { return _masked.find(f) != _masked.end(); }
-
-private:
-  std::set<Field> _masked;
-};
-
-/***
- * @brief The internal state of Bag
- *
- * BagInfo is the internal state of Bag. IR elements such as Object can access BagInfo,
- * but users (who builds IR) can't access.
- */
-class BagInfo
-{
-public:
-  BagInfo(uint32_t size) : _size{size}
-  {
-    // DO NOTHING
-  }
-
-public:
-  uint32_t size(void) const { return _size; }
-
-private:
-  uint32_t const _size;
-
-public:
-  BagMask *mask(void) { return &_mask; }
-  const BagMask *mask(void) const { return &_mask; }
-
-private:
-  BagMask _mask;
-};
-
-} // namespace coco
-
-#endif // __COCO_IR_BAG_INFO_H__
index 240d37b..ca8feb2 100644 (file)
@@ -2,7 +2,6 @@
 #define __COCO_IR_DEP_H__
 
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.forward.h"
 #include "coco/IR/Object.forward.h"
 
 #include "coco/ADT/PtrLink.h"
index a3bade4..67bbd03 100644 (file)
@@ -8,7 +8,6 @@
 #include "coco/IR/Op.forward.h"
 
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.forward.h"
 
 #include "coco/IR/Object.forward.h"
 #include "coco/IR/ObjectInfo.forward.h"
index 01df36a..4ef7c50 100644 (file)
@@ -2,7 +2,6 @@
 #define __COCO_IR_READ_H__
 
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.forward.h"
 
 #include "coco/ADT/PtrLink.h"
 
index 6870ae5..60322b1 100644 (file)
@@ -2,7 +2,6 @@
 #define __COCO_IR_UPDATE_H__
 
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.forward.h"
 
 #include "coco/ADT/PtrLink.h"
 
index 1e468e2..8cfa7f8 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.h"
 
 #include "coco/IR/Object.h"
 #include "coco/IR/Read.h"
 namespace coco
 {
 
-Bag::Bag(std::unique_ptr<BagInfo> &&info) : _info{std::move(info)} { _size = _info->size(); }
+Bag::Bag(uint32_t size) : _size{size}
+{
+  // DO NOTHING
+}
 
 Bag::~Bag()
 {
index 04263f1..5c43d15 100644 (file)
@@ -1,15 +1,10 @@
 #include "coco/IR/Bag.h"
-#include "coco/IR/BagInfo.h"
-
-#include <nncc/foundation/Memory.h>
 
 #include <gtest/gtest.h>
 
-using nncc::foundation::make_unique;
-
 TEST(IR_BAG, ctor_should_set_size)
 {
-  coco::Bag b{make_unique<coco::BagInfo>(3)};
+  coco::Bag b{3};
 
   ASSERT_EQ(b.size(), 3);
 
diff --git a/contrib/coco/core/src/IR/BagInfo.test.cpp b/contrib/coco/core/src/IR/BagInfo.test.cpp
deleted file mode 100644 (file)
index cd7a6e5..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "coco/IR/BagInfo.h"
-
-#include <gtest/gtest.h>
-
-TEST(IR_BAG_INFO, constructor)
-{
-  coco::BagInfo info{16};
-
-  ASSERT_NE(info.mask(), nullptr);
-  ASSERT_FALSE(info.mask()->masked(coco::BagMask::Input));
-  ASSERT_FALSE(info.mask()->masked(coco::BagMask::Output));
-}
index 0cb2bae..7267b44 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/BagManager.h"
-#include "coco/IR/BagInfo.h"
 
 #include <nncc/foundation/Memory.h>
 
@@ -8,14 +7,8 @@ namespace coco
 
 Bag *BagManager::create(uint32_t size)
 {
-  auto info = nncc::foundation::make_unique<BagInfo>(size);
-  auto info_ptr = info.get();
-
-  auto bag = nncc::foundation::make_unique<Bag>(std::move(info));
-  auto bag_ptr = bag.get();
-
-  modulize(bag_ptr);
-
+  auto bag = nncc::foundation::make_unique<Bag>(size);
+  modulize(bag.get());
   return take(std::move(bag));
 }
 
index 4294ff0..98b1083 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/BagManager.h"
-#include "coco/IR/BagInfo.h"
 
 #include <gtest/gtest.h>
 
index 7429900..4dccba8 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Dep.h"
-#include "coco/IR/BagInfo.h"
 #include "coco/IR/Object.h"
 
 #include <cassert>
index 078f4c2..28e747c 100644 (file)
@@ -1,6 +1,5 @@
 #include "coco/IR/Dep.h"
 
-#include "coco/IR/BagInfo.h"
 #include "coco/IR/BagManager.h"
 
 #include "coco/IR/ObjectInfo.h"
index bd172cc..dc27712 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Input.h"
-#include "coco/IR/BagInfo.h"
 
 #include <cassert>
 
index 3f64404..bdfebeb 100644 (file)
@@ -1,6 +1,5 @@
 #include "coco/IR/Input.h"
 #include "coco/IR/BagManager.h"
-#include "coco/IR/BagInfo.h"
 
 #include <nncc/core/ADT/tensor/IndexEnumerator.h>
 
index c8a0055..90ca4a5 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Object.h"
-#include "coco/IR/BagInfo.h"
 #include "coco/IR/ObjectInfo.h"
 #include "coco/IR/Def.h"
 
index fdfa9d8..f330587 100644 (file)
@@ -1,7 +1,6 @@
 #include "coco/IR/Object.h"
 #include "coco/IR/ObjectInfo.h"
 #include "coco/IR/BagManager.h"
-#include "coco/IR/BagInfo.h"
 
 #include <nncc/foundation/Memory.h>
 
index 9928890..583c980 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Output.h"
-#include "coco/IR/BagInfo.h"
 
 namespace coco
 {
index db8ce80..aef0ff0 100644 (file)
@@ -1,6 +1,5 @@
 #include "coco/IR/Output.h"
 #include "coco/IR/BagManager.h"
-#include "coco/IR/BagInfo.h"
 
 #include <nncc/core/ADT/tensor/IndexEnumerator.h>
 
index 9e1b82a..10f04af 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Read.h"
-#include "coco/IR/BagInfo.h"
 
 #include <cassert>
 
index 2020abd..bfa6260 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Read.h"
-#include "coco/IR/BagInfo.h"
 #include "coco/IR/BagManager.h"
 
 #include "Reader.mock.h"
index a4ce2a8..32922c4 100644 (file)
@@ -19,9 +19,6 @@ protected:
     return ins;
   }
 
-protected:
-  coco::PtrLink<coco::Bag, coco::BagInfo> bag_link;
-
 private:
   std::vector<std::unique_ptr<coco::Instr>> _allocated;
 };
index 3a37701..57a8435 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Update.h"
-#include "coco/IR/BagInfo.h"
 
 #include <cassert>
 
index 06c6ebf..7bb73c5 100644 (file)
@@ -1,5 +1,4 @@
 #include "coco/IR/Update.h"
-#include "coco/IR/BagInfo.h"
 #include "coco/IR/BagManager.h"
 
 #include "Update.mock.h"