Polygeist
Polygeist copied to clipboard
Advice on getting libstdc++ headers?
First up, just wanted to say this is a really interesting project, I've got some curiosity about using it to do embedded DSL's in C++ through MLIR. If I'm barking up the wrong tree there, feel free to let me know.
But I'm testing this out on a small app
#include<Kokkos_Core.hpp>
int main(int argc, char* argv[]){
Kokkos::initialize();
Kokkos::finalize();
}
I can point mlir-clang at the Kokkos_Core header, but that includes -I /home/projects/x86-64/gcc/11.1/include/c++/11.1.0/. Which bumps me into various versions of
/home/projects/x86-64/gcc/11.1/include/c++/11.1.0/bits/stringfwd.h:70:1: error: unknown type name '_GLIBCXX_BEGIN_NAMESPACE_CXX11'
_GLIBCXX_BEGIN_NAMESPACE_CXX11
Pretty much just "everything about _GLIBCXX doesn't exist." Any thoughts on a path forward here? Should I build libc++ and use that? Am I missing something obvious? Am I trying to do something the project isn't yet trying to support?
In any case, very cool idea, really looking forward to what you're doing here
Yup you're right on that one of the big advantages here is making it easy to embed a DSL (see RFC here: https://github.com/wsmoses/Polygeist/issues/52).
We're actually presently undergoing a major cleanup so if your use case isn't time sensitive I might recommend waiting a few days and looping back once that goes through. Specifically, having finally landed most of the underlying IR changes necessary (e.g. memref
If it's helpful until the cleanup finishes, I usually find that building libcxx within clang is a good way to reduce most libcxx issues. Also what OS/system are you using?
Hi @wsmoses : I'm using something weird built on top of RHEL7, in a place where I don't have root. But I'll wait until the next iteration, probably smarter to debug on that arch. I'm looking forward to that!
Just wanted to provide a quick update here, at least on my branch / system this compiles happily.
Almost all the LLVM upstream commits we need have landed, still waiting on the following three:
- https://reviews.llvm.org/D105058
- https://reviews.llvm.org/D105041
- https://reviews.llvm.org/D104960
Very cool. Should I wait for the listed commits to land, or is there a dummy's guide I could look at to help me take this for a spin?
Ok everything is now landed on the main branch and should be good to try out (apologies on the delay).
We haven't written a guide yet but taking a look at the build.yml should describe how to build the project (https://github.com/wsmoses/Polygeist/blob/main/.github/workflows/build.yml).
From there you should be able to build the code above by also including the kokkos includes and the include of the headers produced by the clang installation (see below)
wmoses@beast:~/git/Polygeist/proj/kokkos (master) $ ~/git/Polygeist/build/mlir-clang/mlir-clang test.cpp -I ./core/src/ -I ./build/ -I ~/git/Polygeist/mlir-build/lib/clang/13.0.0/include/