wrongtest-intellif opened a new pull request, #17321:
URL: https://github.com/apache/tvm/pull/17321
The change propose to use structural equality on comparing `Target` and
`TargetKind` instances.
Currently, most of the usages use object pointer equal `==` to compare the
instances. This may misjudge the target identity sometimes.
We encounter the issue when we try to establish distributed tools to
accelerate the lowering. Though `TargetKind` are generally singleton instances
for each registered kind, the workload serialization would also create new
`Target` and `TargetKind` instances (which mostly lay in `kTarget` func attr).
One simple test workflow is like below:
```python
target = Target("llvm")
mod = tvm.IRModule({"main": func})
# in practice, module dict is collected from many lowerred workloads, with
target deserialized.
target2 = tvm.ir.load_json(tvm.ir.save_json(target))
lib = tvm.build({target2: mod}, target_host=target)
lib["func"]() # oops, no "func" found in the host module.
```
We search the codebase by link errors if override non-implementated `==` and
`!=` operators. And replace these places with `TargetEqual` and
`TargetKindEqual` functions.
--
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]