-
Notifications
You must be signed in to change notification settings - Fork 538
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
Prevent undefined behavior when passing handle from Treelite to cuML FIL #5849
Conversation
Co-authored-by: jakirkham <jakirkham@gmail.com>
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 Philip! 🙏
Think we might be able to type these as well. Though please double check the types in case I missed something
Co-authored-by: jakirkham <jakirkham@gmail.com>
I will need to make the same fix for the experimental FIL. |
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 Philip! 🙏
Think the error message could be formatted a bit nicer. Made a few minor suggestions related to this. Not a big deal either way, but maybe this is helpful
Co-authored-by: jakirkham <jakirkham@gmail.com>
Todo. Check for possible memory leak. |
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 this fix @hcho3!
/merge |
Problem. FIL unit tests have been failing when run with the pip wheel:
In the meanwhile, the same tests were passing when run with the Conda package.
Diagnosis. When a Treelite model object is passed from the
treelite
Python package into thecuml
Python package,std::string
fields get corrupted. This is likely caused by C++ ABI incompatibilities, as different C++ compiler toolchain/version etc are used when building cuML pip wheel and Treelite pip wheel. More precisely, libtreelite incuml
is incompatible with libtreelite intreelite
, and it's unsafe to directly pass a handle from one to another.Solution. Have the
treelite
Python package export a serialized byte sequence, and have cuML re-construct the Treelite model from the bytes. TL2cgen uses this technique to enable loose coupling between itself and Treelite.