Skip to content

Commit 1816c46

Browse files
author
Shrestha Malik
authored
shrestha/upgrade ng-core to master (#356)
ugrade ngraph_version = "e543688981ea2083a260929a70420f5ba6984d95" Nagy Mostafa [MLIR] Fused Ops dialect declaration (#3860) Fixed Parallel Executor to take in the node name PTS asserts out if depth>0 but no of inputs and outputs is 0. Behavior to be fixed in another PR. Unit tests that have NoOp make a cluster with no inputs and outputs. disabled support of NoOp for them. All pipelines except --var go to Parallel Executor.
1 parent 41c3169 commit 1816c46

File tree

11 files changed

+57
-30
lines changed

11 files changed

+57
-30
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
248248
ExternalProject_Add(
249249
ext_ngraph
250250
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
251-
GIT_TAG effcc47d39de1d5e662d6b78a8d42675ecf7815d
251+
GIT_TAG e543688981ea2083a260929a70420f5ba6984d95
252252
CMAKE_ARGS
253253
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
254254
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}

bazel/WORKSPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow")
5555
http_archive(
5656
name = "ngraph",
5757
build_file = "//:bazel/ngraph.BUILD",
58-
sha256 = "1249b2cbbd89d83405ae2aedf058258fe1290045a7ed3a80ae690e5b2cfe4e0b",
59-
strip_prefix = "ngraph-effcc47d39de1d5e662d6b78a8d42675ecf7815d",
58+
sha256 = "b178f456dcfb212e0ab97fbb9b60efe35e749c8c361234bf2810c71083b8c455",
59+
strip_prefix = "ngraph-e543688981ea2083a260929a70420f5ba6984d95",
6060
urls = [
61-
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/effcc47d39de1d5e662d6b78a8d42675ecf7815d.tar.gz",
62-
"https://github.com/NervanaSystems/ngraph/archive/effcc47d39de1d5e662d6b78a8d42675ecf7815d.tar.gz"
61+
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/e543688981ea2083a260929a70420f5ba6984d95.tar.gz",
62+
"https://github.com/NervanaSystems/ngraph/archive/e543688981ea2083a260929a70420f5ba6984d95.tar.gz"
6363
],
6464
)
6565

bazel/ngraph.BUILD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ cc_library(
6868
"-fstack-protector-all",
6969
'-D SHARED_LIB_PREFIX=\\"lib\\"',
7070
'-D SHARED_LIB_SUFFIX=\\".so\\"',
71-
'-D NGRAPH_VERSION=\\"v0.27.0-rc.0\\"',
71+
'-D NGRAPH_VERSION=\\"e543688981ea2083a260929a70420f5ba6984d95\\"',
7272
"-D NGRAPH_DEX_ONLY",
7373
'-D PROJECT_ROOT_DIR=\\"\\"',
7474
'-D NGRAPH_STATIC_LIB_ENABLE',
@@ -111,7 +111,7 @@ cc_library(
111111
"-fstack-protector-all",
112112
'-D SHARED_LIB_PREFIX=\\"lib\\"',
113113
'-D SHARED_LIB_SUFFIX=\\".so\\"',
114-
'-D NGRAPH_VERSION=\\"effcc47d39de1d5e662d6b78a8d42675ecf7815d\\"',
114+
'-D NGRAPH_VERSION=\\"e543688981ea2083a260929a70420f5ba6984d95\\"',
115115
"-D NGRAPH_DEX_ONLY",
116116
'-D PROJECT_ROOT_DIR=\\"\\"',
117117
] + CXX_ABI,
@@ -202,6 +202,7 @@ cc_library(
202202
"src/ngraph/runtime/cpu/builder/softmax.cpp",
203203
"src/ngraph/runtime/cpu/builder/get_output_element.cpp",
204204
"src/ngraph/runtime/cpu/builder/sum.cpp",
205+
"src/ngraph/runtime/cpu/builder/cum_sum.cpp",
205206
"src/ngraph/runtime/cpu/builder/topk.cpp",
206207
"src/ngraph/runtime/cpu/builder/tile.cpp",
207208
"src/ngraph/runtime/cpu/builder/update_slice.cpp",

build_ngtf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main():
5353
'''
5454

5555
# Component versions
56-
ngraph_version = "effcc47d39de1d5e662d6b78a8d42675ecf7815d" # Scott Cyphers CropAndResize op
56+
ngraph_version = "e543688981ea2083a260929a70420f5ba6984d95" # Nagy Mostafa [MLIR] Fused Ops dialect declaration (#3860)
5757
tf_version = "v1.14.0"
5858

5959
# Command line parser options

ngraph_bridge/ngraph_encapsulate_op.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ void NGraphEncapsulateOp::CreateParallelExecutor(OpKernelConstruction* ctx,
157157
}
158158

159159
// Create the Executor object
160-
m_parallel_executor = move(unique_ptr<NGraphExecutor>(
161-
new NGraphExecutor(s_instance_id, cluster_id, graph_id, encap_subgraph,
162-
backend_name, my_function_cache_depth_in_items)));
160+
m_parallel_executor = move(unique_ptr<NGraphExecutor>(new NGraphExecutor(
161+
s_instance_id, cluster_id, graph_id, encap_subgraph, backend_name, name(),
162+
my_function_cache_depth_in_items)));
163163

164164
auto tensor_manager = m_parallel_executor->GetTensorManager();
165165
OP_REQUIRES(ctx, tensor_manager->GetNumberOfInputs() == ctx->num_inputs(),
@@ -302,7 +302,11 @@ void NGraphEncapsulateOp::CreateLegacyExecutor(OpKernelConstruction* ctx,
302302
bool exec_can_create_tensor =
303303
BackendManager::GetBackend(ng_encap_impl_.GetOpBackend())
304304
->executable_can_create_tensors();
305-
ng_encap_impl_.SetExecCanCreateTensor(exec_can_create_tensor);
305+
if (ng_encap_impl_.GetOpBackend() == "CPU") {
306+
ng_encap_impl_.SetExecCanCreateTensor(false);
307+
} else {
308+
ng_encap_impl_.SetExecCanCreateTensor(exec_can_create_tensor);
309+
}
306310
NGRAPH_VLOG(5) << "Executable can " << (exec_can_create_tensor ? "" : "not")
307311
<< " create tensors";
308312

ngraph_bridge/ngraph_executor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ namespace ngraph_bridge {
6262
NGraphExecutor::NGraphExecutor(int instance_id, int cluster_id, int graph_id,
6363
unique_ptr<tensorflow::Graph>& graph,
6464
const string& backend_name,
65-
const int cache_depth)
65+
const string& node_name, const int cache_depth)
6666
: m_instance_id(instance_id),
6767
m_ngraph_cluster_id(cluster_id),
6868
m_graph_id(graph_id),
6969
m_graph(std::move(graph)),
7070
m_op_backend_name(backend_name),
71+
m_node_name(node_name),
7172
m_ng_data_cache(cache_depth) {
7273
// Sanity checks
7374
if (m_graph == nullptr) {
@@ -85,7 +86,6 @@ NGraphExecutor::NGraphExecutor(int instance_id, int cluster_id, int graph_id,
8586
throw std::runtime_error(string("Requested backend: '") +
8687
m_op_backend_name + string("' not available."));
8788
}
88-
8989
// Initialize the "m_input_is_static" vector as follows:
9090
// (1) create m_input_is_static with n+1 elements, where n is the max arg
9191
// index

ngraph_bridge/ngraph_executor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class NGraphExecutor {
4242
// Transforms, compiles and executes TesnorFlow computation graph using nGraph
4343
explicit NGraphExecutor(int instance_id, int cluster_id, int graph_id,
4444
unique_ptr<tensorflow::Graph>& graph,
45-
const string& backend_name, const int cache_depth);
45+
const string& backend_name, const string& node_name,
46+
const int cache_depth);
4647

4748
~NGraphExecutor();
4849

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
diff --git a/tensorflow/python/framework/test_util.py b/tensorflow/python/framework/test_util.py
2-
index aa8ecf8161..b8d2266132 100644
2+
index 544190e23d..9b652bd49e 100644
33
--- a/tensorflow/python/framework/test_util.py
44
+++ b/tensorflow/python/framework/test_util.py
5-
@@ -971,6 +971,7 @@ class TensorFlowTestCase(googletest.TestCase):
5+
@@ -1662,6 +1662,9 @@ class TensorFlowTestCase(googletest.TestCase):
66
self._threads = []
77
self._tempdir = None
88
self._cached_session = None
99
+ import ngraph_bridge
10+
+
11+
+ ngraph_bridge.set_disabled_ops('NoOp')
1012

1113
def setUp(self):
12-
self._ClearCachedSession()
14+
self._ClearCachedSession()

test/python/test_variableops_static_input.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def test_variable_static_input_variables_dont_share_buffer(self):
115115
env_var_map = self.store_env_variables([buffer_sharing_env])
116116
self.set_env_variable(buffer_sharing_env, "0")
117117

118+
# disable NoOp it forms a single cluster with no inputs or outputs
119+
# Pipelined Tensor Store thinks it is depth 0 and errors out
120+
# TODO: Revisit PTS to set valid PTS depth
121+
ngraph_bridge.set_disabled_ops('NoOp')
122+
118123
# Run on nGraph
119124
ng_var_init_val, ng_mean_values, ng_var_final = self.with_ngraph(
120125
self.__run_test)
@@ -143,6 +148,7 @@ def test_variable_static_input_variables_dont_share_buffer(self):
143148
assert np.allclose(ng_var_final, tf_var_final)
144149

145150
# clean up
151+
ngraph_bridge.set_disabled_ops('')
146152
self.unset_env_variable(buffer_sharing_env)
147153
self.restore_env_variables(env_var_map)
148154

@@ -153,6 +159,11 @@ def test_variable_static_input_variables_share_buffer(self):
153159
env_var_map = self.store_env_variables([buffer_sharing_env])
154160
self.set_env_variable(buffer_sharing_env, "1")
155161

162+
# disable NoOp it forms a single cluster with no inputs or outputs
163+
# Pipelined Tensor Store thinks it is depth 0 and errors out
164+
# TODO: Revisit PTS to set valid PTS depth
165+
ngraph_bridge.set_disabled_ops('NoOp')
166+
156167
# Run on nGraph
157168
ng_var_init_val, ng_mean_values, ng_var_final = self.with_ngraph(
158169
self.__run_test)
@@ -181,3 +192,4 @@ def test_variable_static_input_variables_share_buffer(self):
181192
# clean up
182193
self.unset_env_variable(buffer_sharing_env)
183194
self.restore_env_variables(env_var_map)
195+
ngraph_bridge.set_disabled_ops('')

test/test_parallel_executor.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,23 @@ TEST(ParallelExecutor, Construction) {
6060

6161
// First test with a backend not yet created
6262
unique_ptr<NGraphExecutor> executor;
63-
ASSERT_THROW(executor = unique_ptr<NGraphExecutor>(
64-
new NGraphExecutor(100, 500, 600, input_graph, "bogus", 5)),
63+
ASSERT_THROW(executor = unique_ptr<NGraphExecutor>(new NGraphExecutor(
64+
100, 500, 600, input_graph, "bogus", "xyz_500", 5)),
6565
std::runtime_error);
6666

6767
// Next test with a null graph not yet created
68-
ASSERT_THROW(executor = unique_ptr<NGraphExecutor>(
69-
new NGraphExecutor(100, 500, 600, input_graph, "bogus", 12)),
68+
ASSERT_THROW(executor = unique_ptr<NGraphExecutor>(new NGraphExecutor(
69+
100, 500, 600, input_graph, "bogus", "xyz_500", 12)),
7070
std::runtime_error);
7171

7272
// Now read the graph
7373
ASSERT_OK(LoadGraphFromPbTxt("test_axpy_launchop.pbtxt", input_graph));
7474

7575
// Next test with a backend after creating
7676
tf::ngraph_bridge::BackendManager::CreateBackend("INTERPRETER");
77-
ASSERT_NO_THROW(executor = unique_ptr<NGraphExecutor>(new NGraphExecutor(
78-
100, 500, 600, input_graph, "INTERPRETER", 16)));
77+
ASSERT_NO_THROW(
78+
executor = unique_ptr<NGraphExecutor>(new NGraphExecutor(
79+
100, 500, 600, input_graph, "INTERPRETER", "xyz_500", 16)));
7980

8081
// Now that the object has been cobstructed, test various internal parts
8182
// TODO: Create a Test Class and mark that as a friend of the Executor class
@@ -93,7 +94,8 @@ TEST(ParallelExecutor, CompilerTest) {
9394
ASSERT_OK(LoadGraphFromPbTxt("test_axpy_launchop.pbtxt", input_graph));
9495

9596
tf::ngraph_bridge::BackendManager::CreateBackend("INTERPRETER");
96-
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", 10);
97+
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", "xyz_500",
98+
10);
9799

98100
// Create the inputs for this graph
99101
Tensor x(DT_FLOAT, TensorShape({2, 3}));
@@ -132,7 +134,8 @@ TEST(ParallelExecutor, ExecuteOnSingleThread) {
132134
unique_ptr<tf::Graph> input_graph;
133135
ASSERT_OK(LoadGraphFromPbTxt("test_axpy_launchop.pbtxt", input_graph));
134136
tf::ngraph_bridge::BackendManager::CreateBackend("INTERPRETER");
135-
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", 12);
137+
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", "xyz_500",
138+
12);
136139

137140
// Create the inputs for this graph
138141
Tensor x(DT_FLOAT, TensorShape({2, 3}));
@@ -214,7 +217,8 @@ TEST(ParallelExecutor, ExecuteOnSingleThread8Bit) {
214217
}
215218

216219
tf::ngraph_bridge::BackendManager::CreateBackend(backend_name);
217-
NGraphExecutor executor(100, 500, 600, input_graph, backend_name, 5);
220+
NGraphExecutor executor(100, 500, 600, input_graph, backend_name, "xyz_500",
221+
5);
218222

219223
// Create the inputs for this graph
220224
Tensor x(DT_INT8, TensorShape({2, 2}));
@@ -296,7 +300,8 @@ TEST(ParallelExecutor, ExecuteOnMultipleThreads8Bit) {
296300
}
297301

298302
tf::ngraph_bridge::BackendManager::CreateBackend(backend_name);
299-
NGraphExecutor executor(100, 500, 600, input_graph, backend_name, 16);
303+
NGraphExecutor executor(100, 500, 600, input_graph, backend_name, "xyz_500",
304+
16);
300305

301306
// Create the inputs for this graph
302307
Tensor x(DT_INT8, TensorShape({2, 2}));
@@ -383,7 +388,8 @@ TEST(ParallelExecutor, ExecuteOnMultipleThreads) {
383388
unique_ptr<tf::Graph> input_graph;
384389
ASSERT_OK(LoadGraphFromPbTxt("test_axpy_launchop.pbtxt", input_graph));
385390
tf::ngraph_bridge::BackendManager::CreateBackend("INTERPRETER");
386-
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", 16);
391+
NGraphExecutor executor(100, 500, 600, input_graph, "INTERPRETER", "xyz_500",
392+
16);
387393

388394
// Create the inputs for this graph
389395
Tensor x(DT_FLOAT, TensorShape({2, 3}));

0 commit comments

Comments
 (0)