NVIDIA/jitify

Parallel calls to Jitify

DavidPoliakoff opened this issue · 1 comments

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!

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