echuraev commented on pull request #9032:
URL: https://github.com/apache/tvm/pull/9032#issuecomment-921032101


   > `args` was added because some workloads like sparse require predefined 
inputs that shouldn’t be randomly generated. These inputs are looked up from a 
global dictionary that won’t be propagated to popen workers. Therefore we get 
these predefined arguments from main process and passed it through the workers. 
Is the hang related to this global dictionary? With this PR I’m afraid this 
lookup won’t work because it is called from the worker side.
   
   Yes, the hang related to the global dictionary. In this case I have another 
workaround how to fix the hang. In the `_rpc_run` and `_timed_eval_func` we can 
create a copy of global arguments and work with them. In this case it will 
work, I already did it. I mean to do something like this:
   ```diff
               assert len(args) == len(build_res.args)
   +          import copy
   +          loc_args = copy.deepcopy(args)
               # pylint: disable=consider-using-enumerate
   -            for idx in range(len(args)):
   -                if args[idx] is None:
   +            for idx in range(len(loc_args)):
   +                if loc_args[idx] is None:
                       build_res_arg = build_res.args[idx]
                       empty_array = ndarray.empty(
                           get_const_tuple(build_res_arg.shape), 
build_res_arg.dtype, dev
                       )
                       random_fill(empty_array)
   -                    args[idx] = empty_array
   +                    loc_args[idx] = empty_array
                   else:
   -                    args[idx] = ndarray.array(args[idx], dev)
   +                    args[idx] = ndarray.array(args[idx], dev)
   ```
   
   I don't need this workaround due to it is necessary to do a deep copy of 
arguments. What do you think about it?


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