-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Target][Codegen] Use target class in all codegens #6347
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][Codegen] Use target class in all codegens #6347
Conversation
comaniac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zhiics
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
comaniac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thanks @junrushao1994 @comaniac |
|
The ROCm default detection seems to have been mangled to confuse ROCm version (software) with compute arch (hardware, e.g. gfx). I'll try to fix it. |
|
@t-vi Yes, the detection logic used previously in amdgpu codegen is here: https://github.com/apache/incubator-tvm/blob/e5b793f39fd5b4f84b0aedf06aa376ebe45cf2bc/src/target/llvm/codegen_amdgpu.cc#L194. Then I moved the logic to the target constructor to reveal it at earliest stage. |
|
@t-vi I see. We should change this line: https://github.com/apache/incubator-tvm/blob/master/src/target/target_kind.cc#L176, from |
|
I'll just send a PR in a minute or so. |
* [Target][Codegen] Make all code generator use Target class instead of target string * Remove dep to TargetNode::str() in LLVM module * Allow for llvm nvptx codegen * ... * Address comments from Cody * Rename UpdateTargetConfig => UpdateTargetConfigKeyValueEntry
* [Target][Codegen] Make all code generator use Target class instead of target string * Remove dep to TargetNode::str() in LLVM module * Allow for llvm nvptx codegen * ... * Address comments from Cody * Rename UpdateTargetConfig => UpdateTargetConfigKeyValueEntry
* [Target][Codegen] Make all code generator use Target class instead of target string * Remove dep to TargetNode::str() in LLVM module * Allow for llvm nvptx codegen * ... * Address comments from Cody * Rename UpdateTargetConfig => UpdateTargetConfigKeyValueEntry
This PR uses target class to replace almost all the raw target strings in all the codegen modules. It further helps with us migration towards a robost JSON-like targets configuration, per [RFC] TVM Target Specification.
The only place that uses raw string is what is stored in tvm_target in LLVM module's metadata. In this case, we know that we only care about "mtriple", "mattr", "mcpu", "mfloat-abi", so we only store those attributes in the metadata.
CC: @comaniac @jwfromm @jroesch @tqchen