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

[Runtime][LLVM] Fix errors during loading of target tags #16808

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

cbalint13
Copy link
Contributor

@cbalint13 cbalint13 commented Mar 28, 2024

This PR fixes TVM loading errors when lower LLVM version does not support TVM predefined target tags.

Report and related discussions are here: #16425 (comment)


Rationale:

  • During tvm load/initialization list_tags() checks all src/target/tag.cc target definitions
  • The target tags should be protected against improper LLVM versions at their declaration time

Other fixes:

  • Enforce the mcpu=generic fallback assignment, so LLVM will not noise us with improper invocation
  • Minor compilation fix for LLVM version ranges: 10 11 < llvm < 16 13 (introduced by SVE support)
  • Add a clear hint with LLVM_VERSION_STRING to the error message for the user

Cc @Lunderberg , @lhutton1

@cbalint13 cbalint13 force-pushed the tag-parse branch 2 times, most recently from 8f1b5bc to 7eabc04 Compare March 28, 2024 09:43
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look at this and the quick fix @cbalint13! I had a question about the SVE fix, but otherwise looks good to me

src/target/llvm/codegen_llvm.cc Show resolved Hide resolved
@cbalint13 cbalint13 changed the title Fix errors during loading of target tags [Runtime][LLVM] Fix errors during loading of target tags Mar 28, 2024
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

LGTM, I'll defer merging to @Lunderberg

@Lunderberg
Copy link
Contributor

Thank you for the fix, and I can confirm that it avoids having the error-on-import. I took a brief look as well, but couldn't find an easy way to query whether a given mcpu argument would be valid for a known target-triple without triggering the internal LLVM error message.

@Lunderberg Lunderberg merged commit d109573 into apache:main Mar 29, 2024
25 checks passed
thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
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.

3 participants