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

Parallel calls to Jitify #10

Closed
DavidPoliakoff opened this issue Mar 7, 2018 · 1 comment
Closed

Parallel calls to Jitify #10

DavidPoliakoff opened this issue Mar 7, 2018 · 1 comment

Comments

@DavidPoliakoff
Copy link

Hey folks,

Really appreciate the consistent support. I'm continuing down the train I started in #9 , and am back in a state where I get problems. In that issue, we solved the problem of "I want to use Jitify from one other thread," and it's working well.

Today I'm finding myself needing to use Jitify concurrently on different threads, and it's segfaulting. I've verified that the source I'm passing to Jitify is valid. If I don't synchronize between threads, I get an error in the compile

---------------------------------------------------
--- JIT compile log for header ---
---------------------------------------------------
Command-line error: cannot open source file "jitify_preinclude.h"

The error comes from here.

Note that the compilation doesn't seem to crash my program, I actually crash when I try to configure my KernelInstantiation (I think it's trying to configure something that's invalid). If after each invocation of Jitify I do a synchronization, I get no such error.

A valid reproducer would be something along the lines of

std::program_strings* program_string_set = {/** insert valid program strings*/}
for(int iter =0 ;iter<5;iter++){
  std::thread([=](){
    //invoke jitify on program_string_set[iter]
  }).detach()
}

Anyway, this isn't game-breaking, I can always serialize my calls to Jitify, but I'd love to be able to do them in parallel.

Thanks as always!

benbarsdell added a commit that referenced this issue Mar 8, 2018
- Adds mutex locks to allow multiple threads to safely use a single
  JitCache object.
- Fixes #10
@benbarsdell
Copy link
Member

I reproduced something similar to what you describe. Do you still see the problem with #11?

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

No branches or pull requests

2 participants