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

[Target] Refine equality check on TargetKind instances #17321

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

wrongtest-intellif
Copy link
Contributor

@wrongtest-intellif wrongtest-intellif commented Aug 30, 2024

The change propose to ensure the TargetKind instances to be singleton on serialization.

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 TargetKind instances (which mostly lay in kTarget func attr).

One simple test workflow is like below:

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.

@wrongtest-intellif wrongtest-intellif marked this pull request as draft August 30, 2024 11:53
@wrongtest-intellif wrongtest-intellif changed the title [Target] Refine equality check on Target and TargetKind instances [Target] Refine equality check on TargetKind instances Aug 31, 2024
@wrongtest-intellif wrongtest-intellif marked this pull request as ready for review September 1, 2024 04:51
@wrongtest-intellif
Copy link
Contributor Author

@tqchen Hi, could you kindly take a look at the change? CI / Windows (pull_request) seems to be broken but I can't find why.

@tqchen tqchen merged commit 42bffc3 into apache:main Sep 3, 2024
21 of 24 checks passed
@tqchen
Copy link
Member

tqchen commented Sep 3, 2024

thank you @wrongtest-intellif !

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.

2 participants