[libomptarget][nfc] Make interface.h target independent
Move interface.h under a top level include directory.
Remove #includes to avoid the interface depending on the implementation.
Differential D68615
[libomptarget][nfc] Make interface.h target independent JonChesterfield on Oct 7 2019, 5:51 PM. Authored by
Details [libomptarget][nfc] Make interface.h target independent Move interface.h under a top level include directory.
Diff Detail
Event Timeline
Comment Actions I like that we start to extract common code out of .../nvptx but I'm confused about the how. As I mention below, I expected "all generic code" to include target_impl.h in order to avoid target specific code (here the __device__ stuff) under guards. Maybe I miss something so please let me know what you think. I was expecting something like:
Comment Actions I'm expecting most code moved under common to need #include "target_impl.h", located as you describe. loop.cu etc fit that category, a couple of files may not need any target stuff at all. The library API is a flat description of everything the user (well, mostly the compiler) can find within the compiled library. It's currently called interface.h (I'd prefer libomptarget/deviceRTLs/deviceRTL.h). Including options.h or target_impl.h in the interface (as we have now) pulls in a bunch of macros and symbols that happen to be nearby. Equivalent to this change would be creating a file nvptx/src/target_interface.h (or maybe nvptx_interface.h) containing the #define and typedef, then changing interface.h to: #ifdef __CUDACC__ #include "../nvptx/src/target_interface.h" #endif Or s$src$include$, and optionally replace the relative include with more cmake. I'd like to be able to #include "deviceRTL/interface.h" from test code and have no idea which instantiation it runs against, but it's not a disaster if the interface.h also needs a bunch of cmake wiring to locate the rest of said interface. My main goal here is to get the implementation symbols out of the library interface. Comment Actions Sketch two. Thanks for the feedback - I like the separate file more. It provides an obvious place to put architecture specific extensions to the API. Avoided relative includes by dropping the include dir. |
__CUDACC__ seems the preferred way of spelling this constraint. The amdgcn instantiation would add an equivalent few lines to this header and otherwise leave it unchanged: