-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Adding RuntimeTypes.h #2161
Conversation
include/glow/Runtime/RuntimeTypes.h
Outdated
/// Mapping of Module * to a vector of it's dependancies. | ||
std::unordered_map<Module *, std::vector<Module *>> dependencies; | ||
/// Mapping of Module * to a vector of networks that depend on it. | ||
std::unordered_map<Module *, std::vector<Module *>> dependents; |
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.
Is this a revert DAG ?
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.
yes, after talking with @SplitInfinity we decided it would be helpful to have both directions. If it turns out this can be removed we can pull it later.
/// Mapping of Module * to a vector of output placeholder names for the | ||
/// network. | ||
std::unordered_map<Module *, std::vector<std::string>> outputs; | ||
}; |
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.
Each module contains its placeholder and constants. So what the input
and output
for?
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.
They are for runtime, at runtime the modules are no longer around but the executor will need to know how to pass inputs and outputs when executing the network.
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.
Removed from DependencyDAG, they will by generated by the HM and added to the executionDAG.
/// Total useable memory on device in MB | ||
double maximumUsableMemory; | ||
}; | ||
|
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.
For Partitioner, we need the DeviceInfo contains: memory, number of devices, later the communication constraints.
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.
Would the communication contraints be at a system level or device level? The thought here is the Partitioner would be given a vector of these DeviceInfo objects, one per device. Number of devices would be the length of the vector.
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.
"Would the communication contraints be at a system level or device level?"
-- device level. Should be device specific.
It is OK to put it here, but for Partitioner, I don't think we need "double availableMemory;". Please correct me if I miss anything.
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.
You are correct, we don't need availableMemory right now for Partitioner, but it could be used for provisioner and potentially later in Partitioner.
include/glow/Runtime/RuntimeTypes.h
Outdated
|
||
/// Data structure containing the output from the Partitioner. It is consumed by | ||
/// the Provisioner and used to generate an executionDAG. | ||
struct DependancyDAG { |
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.
I prefer the spelling "dependency", but Wiktionary informs me that "dependancy" is an acceptable if archaic form. So thou mayest leave the spelling alone if thou whilst :-D
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.
Good catch I prefer dependency myself, consider it changed.
include/glow/Runtime/RuntimeTypes.h
Outdated
|
||
struct DeviceMemoryInfo { | ||
/// Available memory on device in MB | ||
double availableMemory; |
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.
I'd use size_t
for memory, since it's not really a floating-point quantity. I also have a slight preference for bytes (rather than a bigger unit like MB), but I also know it's kind of annoying to look at quantities like 536,870,912 instead of "512", so your discretion there.
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.
Actually, size_t
might be a little awkward since it's based on the host's address space. In practice I don't think it would ever matter, but maybe a uint64_t
would be better?
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.
changed to uint64_t.
include/glow/Runtime/RuntimeTypes.h
Outdated
namespace glow { | ||
namespace runtime { | ||
|
||
using NetworkID = size_t; |
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.
This is not the device id. It is the device id type. Please call it NetworkIDTy
include/glow/Runtime/RuntimeTypes.h
Outdated
/// and runtime. | ||
enum ResultCode { READY, EXECUTED, FAILED, CANCELLED }; | ||
|
||
struct DeviceMemoryInfo { |
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.
oxygen.
e1637c3
to
a7bfe84
Compare
/// Individual Node in the DAG for a given network. This contains all the | ||
/// information needed to run the sub-network at inference time. | ||
struct DAGNode { | ||
/// The children of this node, these are nodes that depend on the current |
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.
So, after graph partitioning, each function should have a DAGNode, right? Please correct me if I misunderstand something... If so, we should have some field in this struct to point the function ? or the "name" in DAGNode is the function name?
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.
You are correct, name in the DAGNode is the function name.
Looks like ci failed due to the head file is not used by any other file... Anyway to avoid this failure? |
@@ -30,6 +30,10 @@ struct RuntimeSymbolInfo { | |||
size_t offset; | |||
/// Type of symbol. | |||
Type type; | |||
/// Is the symbol an input for the function. |
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.
please run "format.sh fix"
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.
Format.sh fix didn't change anything? Is it the indentation?
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.
Yes, I would like the indentation should be the consistent with the rest of file.
/// Pointers to the parents of this node. This is used by the executor for | ||
/// determining if a given node has all dependencies met. | ||
std::vector<DAGNode *> parents; | ||
/// ID of the deviceManager that this network is assigned to. |
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.
The "children" is with the type of "std::vector" and "parents" is with the type of "std::vector<DAGNode*>". Actually, this would cause some complexity when creating the DAGNode. For each DAGNode of each sub-function, if we declare it as a local var, we have no idea how to push_back its pointer to its children's "parents" filed. If we new a DAGNode for each function, the "children" field is improper. After discussed with @gcatron , can we use "std::vector<DAGNode*> children;" instead of "std::vector children;", and add an Destructor of DAGNode? @nickgg
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
This PR has been automatically closed due to being stale for 5 days. Thank you for your contributions and feel free to reopen it in case of further progress. |
Description: Adds RuntimeTypes.h which contains data structures common to the Runtime Components.
Testing: Not yet
Documentation: NA
Related to #2045