Skip to content
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

[AutoScheduler] Register workload when deserializing tasks #6927

Merged
merged 6 commits into from Nov 20, 2020

Conversation

comaniac
Copy link
Contributor

@comaniac comaniac commented Nov 17, 2020

One issue of the current auto_scheduler task serialization is that the workload won't be registered when deserializing a task so users have to manually call register_workload_tensors after deserialization. However, register_workload_tensors always uses compute DAG hash as the workload key. This could cause workload key mismatching if the task was from a TE function that uses function name as the workload key. This PR makes the following changes to make sure WORKLOAD_FUNC_REGISTRY is consist after deserializing a task.

  • Simplify register_workload_tensors by moving the ComputeDAG out.
  • Register the workload using the stored workload key when deserializing a task.

cc @merrymercy @jcf94

func_name = json.loads(self.workload_key)[0]
except Exception: # pylint: disable=broad-except
raise RuntimeError("Invalid workload key %s" % self.workload_key)
register_workload_tensors(func_name, self.dag.tensors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do more checks here.
There are two kinds of workloads.
You can find the note here
https://github.com/apache/incubator-tvm/blob/51d81fb71781eb606f4b563ec28290dbd8d04faf/python/tvm/auto_scheduler/workload_registry.py#L42-L52

We have to handle two cases correctly without incorrect overwriting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the logic accordingly. Now we only register workloads extracted from Relay programs.

@merrymercy merrymercy merged commit 56e226a into apache:main Nov 20, 2020
@comaniac comaniac deleted the ansor_fix_deserial branch November 23, 2020 19:48
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
* [AutoScheduler] Register workload when deserializing tasks

* fix name

* format

* merge

* fix test

* more checks
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
* [AutoScheduler] Register workload when deserializing tasks

* fix name

* format

* merge

* fix test

* more checks
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
* [AutoScheduler] Register workload when deserializing tasks

* fix name

* format

* merge

* fix test

* more checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants