This repository was archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Sarkars/flib ngenc compute #529
Open
sayantan-nervana
wants to merge
20
commits into
master
Choose a base branch
from
sarkars/flib_ngenc_compute
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
718f32f
Search for graph def in function library if not found
sayantan-nervana b3e57b0
Handle error (when gdef not found)
sayantan-nervana 8015046
Fixing file path to pass ci
sayantan-nervana 5af5bb9
Make symlinks to the pbtxts
sayantan-nervana 0f9c6c4
Adding debug prints to see dir in ci
sayantan-nervana dd95ace
Copying to artifacts/test/python
sayantan-nervana fee79fe
WIP: check if graph is already processed
sayantan-nervana 0b1598e
Merge branch 'master' into sarkars/flib_ngenc_compute
avijit-nervana 4178724
Do not reprocess if already processed
sayantan-nervana a931716
Review comment
sayantan-nervana 84047b2
Merge branch 'sarkars/flib_ngenc_compute' of https://github.com/Nerva…
sayantan-nervana 354bc3e
Boolean flip
sayantan-nervana f404662
Making pbtxt graph default
sayantan-nervana d29966e
Pass pointer instead of unq ptr
sayantan-nervana 91b88e6
Remove check from normal pass
sayantan-nervana ca6c165
Merge branch 'master' into sarkars/flib_ngenc_compute
avijit-nervana 04c7a00
Change floor to flib
sayantan-nervana 126eeb1
Minor change
sayantan-nervana aa0ef36
Merge branch 'sarkars/flib_ngenc_compute' of https://github.com/Nerva…
sayantan-nervana ca8af0a
Minor change
sayantan-nervana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ int NGraphClusterManager::NewCluster() { | |
|
||
GraphDef* NGraphClusterManager::GetClusterGraph(int idx) { | ||
std::lock_guard<std::mutex> guard(s_cluster_graphs_mutex); | ||
return s_cluster_graphs[idx]; | ||
return idx < s_cluster_graphs.size() ? s_cluster_graphs[idx] : nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need this change since now we might have nothing stored in |
||
} | ||
|
||
} // namespace ngraph_bridge | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
#include <utility> | ||
|
||
#include "tensorflow/core/common_runtime/dma_helper.h" | ||
#include "tensorflow/core/common_runtime/function.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Included for |
||
#include "tensorflow/core/common_runtime/optimization_registry.h" | ||
#include "tensorflow/core/framework/graph.pb.h" | ||
#include "tensorflow/core/framework/node_def_util.h" | ||
|
@@ -93,9 +94,29 @@ class NGraphEncapsulateOp : public OpKernel { | |
OP_REQUIRES_OK(ctx, ctx->GetAttr<int>("ngraph_cluster", &m_ngraph_cluster)); | ||
graph_def = NGraphClusterManager::GetClusterGraph(m_ngraph_cluster); | ||
|
||
GraphConstructorOptions opts; | ||
opts.allow_internal_ops = true; | ||
OP_REQUIRES_OK(ctx, ConvertGraphDefToGraph(opts, *graph_def, &m_graph)); | ||
if (graph_def == nullptr) { | ||
sayantan-nervana marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Read graphdef from function library | ||
const FunctionLibraryDefinition flib = | ||
*ctx->function_library()->GetFunctionLibraryDefinition(); | ||
const FunctionDef* fdef = | ||
flib.Find("Enc_" + to_string(m_ngraph_cluster) + "_native_segment"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use the node name (eg. ngraph_cluster_251) instead of this "Enc_" + to_string(m_ngraph_cluster)" ? |
||
OP_REQUIRES( | ||
ctx, fdef != nullptr, | ||
errors::Internal("Did not find graphdef for encapsulate ", | ||
m_ngraph_cluster, | ||
" in NGraphClusterManager or function library")); | ||
// TODO: how to convert from functiondef to graphdef. Anything easier? | ||
FunctionBody* fnbody; | ||
const auto get_func_sig = [&flib](const string& op, const OpDef** sig) { | ||
return flib.LookUpOpDef(op, sig); | ||
}; | ||
FunctionDefToBodyHelper(*fdef, {}, &flib, get_func_sig, &fnbody); | ||
CopyGraph(*fnbody->graph, &m_graph); | ||
} else { | ||
GraphConstructorOptions opts; | ||
opts.allow_internal_ops = true; | ||
OP_REQUIRES_OK(ctx, ConvertGraphDefToGraph(opts, *graph_def, &m_graph)); | ||
} | ||
OP_REQUIRES_OK(ctx, ctx->GetAttr("ngraph_graph_id", &m_graph_id)); | ||
// | ||
// Initialize the "m_input_is_static" vector as follows: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the or condition in the error message.