[Driver][SYCL] Compile source file for integration header generation
When compiler for preprocessing only, the preprocessing step that occurs does not generate the integration header/footer information that is used during the host compilation step. To generate the integration information in this case, the driver inserts an additional compilation step that creates the files to be consumed at the host step.
The compilation step to produce the integration information is using the generated preprocessed file. For cases where there are build warnings that are emitted during this step, use of -Werror will cause the compilation to fail. These diagnostics are typically suppressed when not performing preprocess only compilations, but due to the fact that the build step against the preprocessed file does not know to suppress the diagnostics from system headers, compilation behaviors are at a disconnect.
To fix this, the behavior when creating a preprocessed file (i.e. when we are using -E and stopping compilation), the driver will now compile the original source file instead of the preprocessed file.
@intel/dpcpp-clang-driver-reviewers, please take a look
When compiler for preprocessing only, the preprocessing step that occurs does not generate the integration header/footer information that is used during the host compilation step. To generate the integration information in this case, the driver inserts an additional compilation step that creates the files to be consumed at the host step.
The compilation step to produce the integration information is using the generated preprocessed file. For cases where there are build warnings that are emitted during this step, use of -Werror will cause the compilation to fail. These diagnostics are typically suppressed when not performing preprocess only compilations, but due to the fact that the build step against the preprocessed file does not know to suppress the diagnostics from system headers, compilation behaviors are at a disconnect.
To fix this, the behavior when creating a preprocessed file (i.e. when we are using -E and stopping compilation), the driver will now compile the original source file instead of the preprocessed file.
Just to confirm I understood correctly,
when we invoke clang to perform only the preprocessing step using
clang -E <sycl-source-file.cpp> , the -fsycl-int-header.h and -fsycl-int-footer integration header/footer header files do not get generated.
In order to generate the header/footer files, an additional compilation step is introduced to use the original source file and not the pre-processed code.
Question: Device code compilation step typically generates the header/footer files. ie "clang -cc1 -fsycl-is-device .."
Is this newly introduced compilation step the device code compilation step?
Just to confirm I understood correctly, when we invoke
clangto perform only the preprocessing step usingclang -E <sycl-source-file.cpp>, the-fsycl-int-header.hand-fsycl-int-footerintegration header/footer header files do not get generated. In order to generate the header/footer files, an additional compilation step is introduced to use the original source file and not the pre-processed code. Question: Device code compilation step typically generates the header/footer files. ie"clang -cc1 -fsycl-is-device .."Is this newly introduced compilation step the device code compilation step?
yes, the new compilation step is the device compilation step. There isn't really a new compilation step being introduced, it has always been there when doing preprocessing only. The difference is just the input file being the source file instead of the preprocessed file.
When compiler for preprocessing only, the preprocessing step that occurs does not generate the integration header/footer information that is used during the host compilation step. To generate the integration information in this case, the driver inserts an additional compilation step that creates the files to be consumed at the host step.
The compilation step to produce the integration information is using the generated preprocessed file. For cases where there are build warnings that are emitted during this step, use of -Werror will cause the compilation to fail. These diagnostics are typically suppressed when not performing preprocess only compilations, but due to the fact that the build step against the preprocessed file does not know to suppress the diagnostics from system headers, compilation behaviors are at a disconnect.
To fix this, the behavior when creating a preprocessed file (i.e. when we are using -E and stopping compilation), the driver will now compile the original source file instead of the preprocessed file
Can you share why compilation against the preprocessed file does not have the context to suppress these diagnostics from the system headers?
Can you share why compilation against the preprocessed file does not have the context to suppress these diagnostics from the system headers?
As discussed offline, the issue deals with how the generated preprocessed file does not have the informational tags that contain information about the file/header that was pulled into the preprocessed source.
not have the informational tags that contain information about the file/header that was pulled into the preprocessed source
Thanks for following up on this offline.
@intel/llvm-gatekeepers, this is ready for merge - thanks!