Skip to content

Commit

Permalink
Merge conflicts; address CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
premanandrao committed Sep 11, 2024
1 parent ed7b026 commit fa6ae5d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
8 changes: 8 additions & 0 deletions clang/include/clang/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,14 @@ class Driver {
llvm::opt::ArgStringList getDeviceTraitsMacrosArgs() const {
return SYCLDeviceTraitsMacrosArgs;
}
/// getSYCLDefaultUseBuiltins - Return false, when the default mechanism
/// for communication between the device and host compilations
/// is integration headers. Return true, when it is via builtins.
bool getSYCLDefaultUseBuiltins() const {
// Currently, unless -fsycl-use-builtins is explicitly specified,
// integration headers are used for device-host communucations.
return false;
}
};

/// \return True if the last defined optimization level is -Ofast.
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -7002,8 +7002,8 @@ defm sycl_use_integration_headers : BoolFOption<"sycl-use-integration-headers",
PosFlag<SetTrue, [], [ClangOption, CLOption], "Specify">,
NegFlag<SetFalse, [], [ClangOption, CLOption], "Do not specify">,
BothFlags<[HelpHidden], [ClangOption, CLOption, CC1Option],
" that integration headers be used for "
"communication between the host and the device compilations. SYCL Only">>;
" that integration headers be used for communication"
" between the host and the device compilations. SYCL Only">>;
} // let Group = sycl_Group

// FIXME: -fsycl-explicit-simd is deprecated. remove it when support is dropped.
Expand Down
21 changes: 13 additions & 8 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,11 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
bool HasSYCL = C.getInputArgs().hasFlag(options::OPT_fsycl,
options::OPT_fno_sycl, false);
bool HasValidSYCLRuntime =
HasSYCL || C.getInputArgs().hasArg(options::OPT_fsycl_device_only);
HasSYCL || hasSYCLDeviceOnly(C.getInputArgs());
bool UseSYCLIntegrationHeaders =
C.getInputArgs().hasFlag(options::OPT_fsycl_use_integration_headers,
options::OPT_fno_sycl_use_integration_headers,
!getSYCLDefaultUseBuiltins());

Arg *SYCLfpga = C.getInputArgs().getLastArg(options::OPT_fintelfpga);

Expand Down Expand Up @@ -1135,13 +1139,14 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
if (!HasSYCL && !SYCLfpga)
Diag(clang::diag::err_drv_sycl_opt_requires_opt)
<< "-f[no-]sycl-use-integration-headers";
// -fno-sycl-use-integration-headers cannot be used with
// -fsycl-host-compiler.
if (SYCLHostCompiler && SYCLUIHArg->getOption().matches(
options::OPT_fno_sycl_use_integration_headers))
Diag(clang::diag::err_drv_option_conflict)
<< SYCLHostCompiler->getSpelling().split('=').first
<< "-fno-sycl-use-integration-headers";
}

// -fno-sycl-use-integration-headers cannot be used with
// -fsycl-host-compiler.
if (SYCLHostCompiler && !UseSYCLIntegrationHeaders) {
Diag(clang::diag::err_drv_option_conflict)
<< SYCLHostCompiler->getSpelling().split('=').first
<< "-fno-sycl-use-integration-headers";
}

auto argSYCLIncompatible = [&](OptSpecifier OptId) {
Expand Down
9 changes: 6 additions & 3 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5039,7 +5039,8 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
assert(HostCompilerDefArg && "Expected host compiler designation.");
bool UIH =
TCArgs.hasFlag(options::OPT_fsycl_use_integration_headers,
options::OPT_fno_sycl_use_integration_headers, true);
options::OPT_fno_sycl_use_integration_headers,
!TC.getDriver().getSYCLDefaultUseBuiltins());
bool OutputAdded = false;
StringRef CompilerName =
llvm::sys::path::stem(HostCompilerDefArg->getValue());
Expand Down Expand Up @@ -5486,7 +5487,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,

Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
bool UIH = Args.hasFlag(options::OPT_fsycl_use_integration_headers,
options::OPT_fno_sycl_use_integration_headers, true);
options::OPT_fno_sycl_use_integration_headers,
!D.getSYCLDefaultUseBuiltins());

if (IsSYCLDevice) {
if (Triple.isNVPTX()) {
Expand Down Expand Up @@ -5784,7 +5786,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}

if (Args.hasFlag(options::OPT_fsycl_use_integration_headers,
options::OPT_fno_sycl_use_integration_headers, true)) {
options::OPT_fno_sycl_use_integration_headers,
!D.getSYCLDefaultUseBuiltins())) {
CmdArgs.push_back("-fsycl-use-integration-headers");
CmdArgs.push_back("-D__INTEL_SYCL_USE_INTEGRATION_HEADERS");
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// RUN: | FileCheck -check-prefix PREPROC_ONLY2 %s
// RUN: %clang_cl -fsycl --offload-new-driver -fno-sycl-use-integration-headers -P -Fi%t_output.ii %s -### 2>&1 \
// RUN: | FileCheck -check-prefix PREPROC_ONLY2 %s
// PREPROC_ONLY2-NOT: "-fsycl-int-header="
// PREPROC_ONLY2-NOT: "-fsycl-int-header="
// PREPROC_ONLY2-NOT: "-fsycl-int-footer="
// PREPROC_ONLY2-NOT: "-include-footer"

Expand Down

0 comments on commit fa6ae5d

Please sign in to comment.