Baunsgaard commented on PR #1628:
URL: https://github.com/apache/systemds/pull/1628#issuecomment-1150415515

   (Just because i regret deleting it -- i wrote this while you commented 
Matthias)
   
    I suggest that you make the methods inside CP and SP instructions part of  
a interface that allows any instruction to change to FED, and then make the 
footprint of these functions as small as possible inside each of the CP and SP 
instructions. All of these instructions should call into the fitting 
FEDInstructions class that then handle the logic of converting the instructions 
to FEDInstructions though static constructors that can return null.
      With this we simply try to call this interface function on the 
instructions to change them into FEDInstructions when they can before 
execution. In the static construction it is easy to change the SP instructions 
(or GPU etc) to CP if possible, otherwise the static constructor would 
construct SP type.
     
      This design addresses all 3 points with (i think) the least amount of 
code.
     
   -- Comment to Matthias's point
   
   We are missing one step where we can avoid the whole FEDInstructionUtils 
code with casting that Kevin i think correctly is addressing in some of in his 
changes, where we can remove the entire if else tree if we add a interface 
method that simply map to the static constructors in your step 1. 
   If we set default for all methods to return null for this interface 
"toFedInstruction" then we can just overwrite all instances of instructions 
that can change into FEDInstructions and get much cleaner code from it, --- 
with the downside of having small overloaded functions that map to the static 
constructors for FEDInstructions in each CP and SP instruction---
   
   
   
   
   
      
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to