@@ -1296,19 +1296,20 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
12961296 // If the user specified --offload-arch, deduce the offloading
12971297 // target triple(s) from the set of architecture(s).
12981298 // Create a toolchain for each valid triple.
1299+ // We do not support SYCL offloading if any of the inputs is a
1300+ // .cu (for CUDA type) or .hip (for HIP type) file.
12991301 else if (HasValidSYCLRuntime &&
13001302 C.getInputArgs ().hasArg (options::OPT_offload_arch_EQ) && !IsHIP &&
13011303 !IsCuda) {
1302- // SYCL offloading to AOT Targets with ``--offload-arch``
1303- // is currently enabled only with ``--offload-new-driver`` option.
1304- // Emit a diagnostic if ``--offload-arch`` is invoked without
1305- // ``--offload-new driver`` option.
1306- if (!C.getInputArgs ().hasFlag (options::OPT_offload_new_driver,
1307- options::OPT_no_offload_new_driver,
1308- false )) {
1309- Diag (clang::diag::err_drv_sycl_offload_arch_new_driver);
1310- return ;
1311- }
1304+ // SYCL offloading to AOT Targets with ``--offload-arch``
1305+ // is currently enabled only with ``--offload-new-driver`` option.
1306+ // Emit a diagnostic if ``--offload-arch`` is invoked without
1307+ // ``--offload-new driver`` option.
1308+ if (!C.getInputArgs ().hasFlag (options::OPT_offload_new_driver,
1309+ options::OPT_no_offload_new_driver, false )) {
1310+ Diag (clang::diag::err_drv_sycl_offload_arch_new_driver);
1311+ return ;
1312+ }
13121313 const ToolChain *HostTC = C.getSingleOffloadToolChain <Action::OFK_Host>();
13131314 auto AMDTriple = getHIPOffloadTargetTriple (*this , C.getInputArgs ());
13141315 auto NVPTXTriple = getNVIDIAOffloadTargetTriple (*this , C.getInputArgs (),
@@ -1350,6 +1351,12 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
13501351 Arch);
13511352 } else if (IsSYCLSupportedIntelGPUArch (StringToOffloadArchSYCL (Arch))) {
13521353 StringRef IntelGPUArch;
1354+ // For Intel Graphics AOT target, valid values for ``--offload-arch``
1355+ // are mapped to valid device names accepted by OCLOC (the Intel GPU AOT
1356+ // compiler) via the ``-device`` option. The mapIntelGPUArchName
1357+ // function maps the accepted values for `--offload-arch` to enable SYCL
1358+ // offloading to Intel GPUs and the corresponding `-device` value passed
1359+ // to OCLOC.
13531360 IntelGPUArch = mapIntelGPUArchName (Arch).data ();
13541361 DerivedArchs[MakeSYCLDeviceTriple (" spir64_gen" ).getTriple ()].insert (
13551362 IntelGPUArch);
@@ -1358,9 +1365,10 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
13581365 return ;
13591366 }
13601367 }
1361- // If the set is empty then we failed to find a native architecture.
1368+ // Emit an error if architecture value is not provided
1369+ // to --offload-arch.
13621370 if (Archs.empty ()) {
1363- Diag (clang::diag::err_drv_invalid_sycl_target) << " native " ;
1371+ Diag (clang::diag::err_drv_sycl_offload_arch_missing_value) ;
13641372 return ;
13651373 }
13661374
0 commit comments