Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2357d7b
Initial commit with partial changes from #12556
srividya-sundaram Jul 30, 2025
00205b8
Add code for fsycl-targets flow.
srividya-sundaram Aug 5, 2025
4d48f67
Add all changes from 12556 except tests.
srividya-sundaram Aug 5, 2025
3a9d8dd
Add common code for offload-targets.
srividya-sundaram Aug 5, 2025
4713a40
Address review comments.
srividya-sundaram Aug 6, 2025
985a9ec
Fix getAlias() errors.
srividya-sundaram Aug 7, 2025
78fb529
Fix test.
srividya-sundaram Aug 7, 2025
67efbeb
Fix openmp-offload.c
srividya-sundaram Aug 8, 2025
d92f33b
Fix tests.
srividya-sundaram Aug 8, 2025
0a45c51
Add tests from 125556
srividya-sundaram Aug 8, 2025
979b4e0
Fix -fsycl-fp64-conv-emu warning.
srividya-sundaram Aug 8, 2025
c9d1264
Fix warning.
srividya-sundaram Aug 8, 2025
8ceb24f
Fix warning.
srividya-sundaram Aug 8, 2025
61a2ea1
Fix warning.
srividya-sundaram Aug 8, 2025
239df02
Fix warning.
srividya-sundaram Aug 8, 2025
9f5d757
Add remaining tests from #12556 and fix failing tests.
srividya-sundaram Aug 11, 2025
f69c1df
Merge branch 'sycl-web' into add-12556
srividya-sundaram Aug 11, 2025
1dcc783
Apply patch for duplicate SYCL target triple strings,
srividya-sundaram Aug 13, 2025
f577a4a
Add Intel GPU check for OpenMP offload.
srividya-sundaram Aug 13, 2025
0813db2
Add follow-up changes to #125556.
srividya-sundaram Aug 14, 2025
1e7be61
Remove extra semi-colon
srividya-sundaram Aug 14, 2025
37e7019
Merge remote-tracking branch 'origin/sycl-web' into add-12556
srividya-sundaram Aug 14, 2025
7c4fbb8
Remove redundant option and extra line.
srividya-sundaram Aug 14, 2025
06b65fd
Extra WS removal.
srividya-sundaram Aug 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def warn_flag_no_sycl_libspirv
InGroup<UnsafeLibspirvNotLinked>;
def err_drv_mix_cuda_hip : Error<
"mixed CUDA and HIP compilation is not supported">;
def err_drv_mix_offload
: Error<"mixed %0 and %1 offloading compilation is not supported">;
def err_drv_bad_target_id : Error<
"invalid target ID '%0'; format is a processor name followed by an optional "
"colon-delimited list of features followed by an enable/disable sign (e.g., "
Expand Down Expand Up @@ -415,9 +417,11 @@ def err_drv_sycl_offload_arch_new_driver: Error<
"'--offload-arch' is supported when '-fsycl' is set with '--offload-new-driver'">;
def err_drv_sycl_offload_arch_missing_value : Error<
"must pass in an explicit cpu or gpu architecture to '--offload-arch'">;
def warn_drv_sycl_offload_target_duplicate : Warning<
"SYCL offloading target '%0' is similar to target '%1' already specified; "
"will be ignored">, InGroup<SyclTarget>;
def warn_drv_offload_target_duplicate
: Warning<
"offloading target '%0' is similar to target '%1' already specified; "
"will be ignored">,
InGroup<OffloadTarget>;
def warn_drv_sycl_target_missing : Warning<
"linked binaries do not contain expected '%0' target; found targets: '%1'">,
InGroup<SyclTarget>;
Expand Down Expand Up @@ -445,11 +449,8 @@ def err_drv_omp_offload_target_missingbcruntime : Error<
"; use '--libomptarget-%1-bc-path' to specify %1 bitcode library">;
def err_drv_omp_offload_target_bcruntime_not_found : Error<
"bitcode library '%0' does not exist">;
def err_drv_omp_offload_target_cuda_version_not_support : Error<
"NVPTX target requires CUDA 9.2 or above; CUDA %0 detected">;
def warn_drv_omp_offload_target_duplicate : Warning<
"OpenMP offloading target '%0' is similar to target '%1' already specified; "
"will be ignored">, InGroup<OpenMPTarget>;
def err_drv_omp_offload_target_cuda_version_not_support
: Error<"NVPTX target requires CUDA 9.2 or above; CUDA %0 detected">;
def err_drv_unsupported_embed_bitcode
: Error<"%0 is not supported with -fembed-bitcode">;
def err_drv_bitcode_unsupported_on_toolchain : Error<
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,9 @@ def SyclAspectMismatch : DiagGroup<"sycl-aspect-mismatch">;
def SyclNativeCPUTargets: DiagGroup<"sycl-native-cpu-targets">;
def SyclPrivateAllocaPositiveSize : DiagGroup<"sycl-private-alloca-positive-size">;

// Common warnings for SYCL and OpenMP offloading
def OffloadTarget : DiagGroup<"offload-target">;

// OpenACC warnings.
def SourceUsesOpenACC : DiagGroup<"source-uses-openacc">;
def OpenACC : DiagGroup<"openacc", [SourceUsesOpenACC]>;
Expand Down
5 changes: 3 additions & 2 deletions clang/include/clang/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ class Driver {
// handleArguments.
phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
llvm::opt::Arg **FinalPhaseArg = nullptr) const;
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
executeProgram(llvm::ArrayRef<llvm::StringRef> Args) const;

private:
/// Certain options suppress the 'no input files' warning.
Expand Down Expand Up @@ -549,8 +551,7 @@ class Driver {
/// empty string.
llvm::SmallVector<StringRef>
getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
Action::OffloadKind Kind, const ToolChain *TC,
bool SpecificToolchain = true) const;
Action::OffloadKind Kind, const ToolChain &TC) const;

/// Check that the file referenced by Value exists. If it doesn't,
/// issue a diagnostic and return false.
Expand Down
29 changes: 19 additions & 10 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,12 @@ def offload_arch_EQ : CommaJoined<["--"], "offload-arch=">,
"If 'native' is used the compiler will detect locally installed architectures. "
"For HIP offloading, the device architecture can be followed by target ID features "
"delimited by a colon (e.g. gfx908:xnack+:sramecc-). May be specified more than once.">;
def no_offload_arch_EQ : Joined<["--"], "no-offload-arch=">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. "
"'all' resets the list to its default value.">;
def no_offload_arch_EQ
: CommaJoined<["--"], "no-offload-arch=">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Remove CUDA/HIP offloading device architecture (e.g. sm_35, "
"gfx906) from the list of devices to compile for. "
"'all' resets the list to its default value.">;

def offload_new_driver : Flag<["--"], "offload-new-driver">,
Visibility<[ClangOption, CC1Option]>, Group<f_Group>,
Expand Down Expand Up @@ -1732,8 +1734,11 @@ defm auto_import : BoolFOption<"auto-import",
// In the future this option will be supported by other offloading
// languages and accept other values such as CPU/GPU architectures,
// offload kinds and target aliases.
def offload_EQ : CommaJoined<["--"], "offload=">, Flags<[NoXarchOption]>,
HelpText<"Specify comma-separated list of offloading target triples (CUDA and HIP only)">;
def offload_EQ : CommaJoined<["--"], "offload=">,
Flags<[NoXarchOption]>,
Alias<offload_targets_EQ>,
HelpText<"Specify comma-separated list of offloading target "
"triples (CUDA and HIP only)">;

// C++ Coroutines
defm coroutines : BoolFOption<"coroutines",
Expand Down Expand Up @@ -7267,10 +7272,14 @@ defm sycl_rtc_mode: BoolFOption<"sycl-rtc-mode",
def fno_sycl_esimd_build_host_code : Flag<["-"], "fno-sycl-esimd-build-host-code">,
Visibility<[ClangOption, CLOption, CC1Option]>, Flags<[HelpHidden]>,
HelpText<"Do not build the host implementation of ESIMD functions.">;
def fsycl_targets_EQ : CommaJoined<["-"], "fsycl-targets=">,
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, CC1Option]>,
HelpText<"Specify comma-separated list of triples SYCL offloading targets "
"to be supported">;
def fsycl_targets_EQ
: CommaJoined<["-"], "fsycl-targets=">,
Alias<offload_targets_EQ>,
Flags<[NoXarchOption]>,
Visibility<[ClangOption, CLOption, CC1Option]>,
HelpText<
"Specify comma-separated list of triples SYCL offloading targets "
"to be supported">;
def fsycl_force_target_EQ : Joined<["-"], "fsycl-force-target=">,
Flags<[NoXarchOption]>,
HelpText<"Force the usage of the given triple when extracting device code "
Expand Down
4 changes: 0 additions & 4 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ class ToolChain {
ToolChain(const Driver &D, const llvm::Triple &T,
const llvm::opt::ArgList &Args);

/// Executes the given \p Executable and returns the stdout.
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
executeToolChainProgram(StringRef Executable) const;

void setTripleEnvironment(llvm::Triple::EnvironmentType Env);

virtual Tool *buildAssembler() const;
Expand Down
Loading