[locoex] Enhance COpTypeInference test (#7204)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Thu, 5 Sep 2019 05:51:09 +0000 (14:51 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 5 Sep 2019 05:51:09 +0000 (14:51 +0900)
This includes CanonicalTypeInferenceRule check. This is required for future change of loco::TypeInference, which looks into the dtype of all input nodes. So, the type of loco::Pull should be inferred to infer the type of locoex::COpCall.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
compiler/locoex-customop/src/Service/COpTypeInference.test.cpp

index add3419..97ddd86 100644 (file)
 
 #include <locoex/Service/COpTypeInference.h>
 #include <locoex/COpCall.h>
+#include <locoex/COpDialect.h>
+
+#include <loco/IR/CanonicalDialect.h>
+#include <loco/Service/TypeInference.h>
 
 #include <gtest/gtest.h>
 
@@ -45,9 +49,13 @@ TEST(TypeInferenceRuleTest, COpTypeInference)
   loco::link(graph_output, push_node);
 
   // Run Type Inference
-  locoex::COpTypeInferenceRule rule;
+  locoex::COpTypeInferenceRule cop_rule;
+  loco::CanonicalTypeInferenceRule canon_rule;
+  loco::MultiDialectTypeInferenceRule rules;
+
+  rules.bind(locoex::COpDialect::get(), &cop_rule).bind(loco::CanonicalDialect::get(), &canon_rule);
 
-  loco::apply(&rule).to(g.get());
+  loco::apply(&rules).to(g.get());
 
   // Verify!
   ASSERT_TRUE(loco::dtype_known(call_node));