comaniac opened a new pull request #7145:
URL: https://github.com/apache/tvm/pull/7145


   The previous implementation of task serialization mechanism has a potential 
problem, which is a bit tricky so I didn't notice that before.
   
   Previously, I defined a set of attributes in the Python object (e.g., 
`hardware_params`) and use them to be the state when serializing a task object 
in Python. However, in the case that users don't provide `hardware_params`, the 
SearchTask constructor in C++ invokes `GetDefaultHardwareParams` to get the 
default hardware parameters. These default hardware parameters aren't exposed 
to the Python object because of the same name attribute.
   
   It wouldn't be a bit deal because when a task is deserialized, we follow the 
same process to get the default hardware parameters. However, since 
`GetDefaultHardwareParams` may access hardware context (e.g., CUDA context), 
this prevents tasks from being deserialized in parallel (with multiprocessing).
   
   This PR removes all attributes in `SearchTask` Python object to make sure we 
access the up-to-date C++ object attributes when serializing a task. The only 
exception is `self.dag` because we need it to reconstruct a ComputeDAG.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to