-
Notifications
You must be signed in to change notification settings - Fork 64
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
Explicitly look for program name to allow reusing program_sources #82
Conversation
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 the PR! This is an interesting use-case; I'm glad it's working for you with only this small change required.
Just a couple of formatting issues, otherwise LGTM.
Co-authored-by: Ben Barsdell <benbarsdell@gmail.com>
Thanks a lot for your quick review, @benbarsdell! The requested changes are made. btw for formatting, do you follow any style guide or use any linter? In Python we have the PEP-8 guide and tools like flake8 and autopep8, but I know literally nothing in the C++ world 😅 |
I just noticed that this causes a couple of test failures (when running Regarding auto-formatting, we use |
Interesting, thanks for double checking for me, @benbarsdell! I should have run Before applying your suggestion, I had 4 failing tests:
but now I still have 1 test failing (
Thanks! |
Aha, I think I know why you're having problems now: because your Thrust library is installed in edit: fixed the directory name. |
Oh cool. It makes sense. Glad to know. Unfortunately I don't have root access to my test machines, so I may have to spin off a docker and build from there. But it sounds like specific to my environment, so if all of the tests pass for you locally, I suppose all is good? |
Thanks!! 🙏 |
Hello it's me again. My PR to support Jitify in CuPy (cupy/cupy#4228) just went in. But, when working on that I notice suboptimal performance in Jitify's compile-fail-search loop (implemented in
jitify::detail::load_program
, which is the only Jitify function we use, as we already did the rest of Jitify functionalities ourselves). The reason, from our perspective, is that the mapprogram_sources
cannot be reused, as the current implementation assumes that the program name is looked up right after the first item is inserted to the map, and if the map is already populated the lookup would fetch a wrong name.To work around this limitation, we currently cache all headers searched by Jitify, and pass them to
load_program
's 2nd argument (headers
, a vector of string). But the drawback is a newprogram_sources
map still needs to be constructed every time the search loop is launched. The compilation time is just slower than using a subprocess to callnvcc
(what we did before introducing Jitify): cupy/cupy#4228 (comment).The program-name lookup limitation is lifted in this PR by explicitly passing in a string pointer. If it's not null then we record the name, otherwise do nothing. This is an internal (and small) change that would not have any impact to Jitify's existing functionality at all, but is very important for us to reuse the existing resource to the maximal extent. I hope this is an easy PR to review. 🙂
Thank you!