plaidml / tpp-mlir

TPP experimentation on MLIR for linear algebra
https://arxiv.org/abs/2404.15204
Other
111 stars 29 forks source link

Handle OpenMP libraries in portable way (issue #959) #960

Open dbabokin opened 1 month ago

dbabokin commented 1 month ago

Closes #959

See the issue for detailed problem description.

adam-smnk commented 1 month ago

Looks like gcc has trouble with these changes.

dbabokin commented 1 month ago

I can reproduce it. The problem is that with gcc it pulls in gcc's libgomp.so.1 instead of llvm's libomp.so.5. 🤔

dbabokin commented 1 month ago

I see no way to specify for find_package(OpenMP) that it needs llvm version. Not sure how to fix that properly.

rengolin commented 4 weeks ago

The way we were doing it was not portable "for a reason": we don't want to use Gomp because the performance isn't good.

I'm not saying it was done in the right way, clearly not. But the reason is still important.

So, my tip for this PR is to find a way to make it portable, but still require LLVM's OpenMP library and not the compiler's own.

CMake find_package can be fiddled with HINTs and other flags, maybe this helps?

dbabokin commented 4 weeks ago

The way we were doing it was not portable "for a reason": we don't want to use Gomp because the performance isn't good.

Yeah, totally understand. Showing up of gomp when gcc was used was absolutely unexpected. The definition of "portable" that seems acceptable in this case is that it works on macOS and Ubuntu 24.04 - all with llvm's omp.

I'm not saying it was done in the right way, clearly not. But the reason is still important.

So, my tip for this PR is to find a way to make it portable, but still require LLVM's OpenMP library and not the compiler's own.

CMake find_package can be fiddled with HINTs and other flags, maybe this helps?

HINT is a Windows thing, PATH probably may help, I'll give it a try. I'll also file an issue for CMake to get it fixed in the long run.

dbabokin commented 4 weeks ago

I file CMake issue for that: https://gitlab.kitware.com/cmake/cmake/-/issues/26263