-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[BugFix][Target] Added null check to fix segfault at ->defined() in cpu.cc DetectSystemTriple() #16766
Conversation
I just tried to compile the I'll look into adding a test here |
Hi @OttoWRas, did you get chance to look at adding a test? I should have some time to take a look in the next couple of days if not |
Hi @lhutton1, I just fixed the test, it actually seemed to already fail with out LLVM, but i just wasn't good enough at using the test system to realize. I added an But looking back on this issue, it seems to me like, I hope this was what you meant, otherwise feel free to make your own changes. |
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.
Thanks for persisting with this fix @OttoWRas! Overall your changes make sense to me - apologies for introducing the issues in the first place!
I had a closer look at the changes and left some comments which should help get it to pass CI. Let me know if they don't make sense, I'm happy to expand further on them.
Co-authored-by: Luke Hutton <[email protected]>
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.
Thanks @OttoWRas, LGTM!
Thanks for being indulgent @lhutton1, even though it got a bit messy. I think it's all there now |
Thanks @OttoWRas! |
I ran into a problem running a very simple ONNX compile, i would get a segfault at a FoldConstantExpr() call from TVMC. This only happens if the compile flag
set(USE_LLVM OFF)
is OFF.I had compiled TVM Using GCC:
This was caused by a call to defined() from DetectSystemTriple() in cpu.cc that was added in #16513. When the previous call
would fail, and return null. The consecutive call to defined() would segfault after trying to dereference the null value. This commit adds a check to see if the function pointer is null. This might not be the best solution, but it worked for me, so it might also help someone else struggling with this. Please suggest a better solution, if you know one.