DickJC123 edited a comment on issue #13598: More fine-grained operator 
implementation dispatch & memory planning flow 
URL: 
https://github.com/apache/incubator-mxnet/issues/13598#issuecomment-447988119
 
 
   Again, one goal of this is to not tie all operator implementations together. 
 It's hard for one committer to have the knowledge and energy to modify and 
create tests for all implementations.  Now, trying for the simplest solution, 
suppose we just segment the cpu implementations from the gpu ones?  Right now, 
this is already done with FCompute.  The corresponding new code might be:
   ```
   .set_attr<FInplaceOption>("FInplaceOption<gpu>", [] (const NodeAttrs& attrs) 
{ return {0,0}; })
   .set_attr<FInplaceOption>("FInplaceOption<cpu>", [] (const NodeAttrs& attrs) 
{ return {}; })
   ```
   
   Alternatively, since AssignContext() is run before  g = nnvm::ApplyPass(g, 
"PlanMemory"), we could additionally divide up and attach the dev_mask 
information that is currently an attribute of the entire graph to each node.  
Code then would be:
   ```
   .set_attr<FInplaceOption>("FInplaceOption", [] (const NodeAttrs& attrs) {
       bool is_gpu = attrs.dict["dev_mask"] == mshadow::gpu::kDevMask;
       return is_gpu ? {0,0} : {};
   })
   ```
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to