[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Michael Toguchi via cfe-commits


@@ -1046,30 +1046,35 @@ defm offload_uniform_block : 
BoolFOption<"offload-uniform-block",
   NegFlag,
   BothFlags<[], [ClangOption], " that kernels are launched with uniform block 
sizes (default true for CUDA/HIP and false otherwise)">>;
 
-def fcx_limited_range : Joined<["-"], "fcx-limited-range">,
+def fcomplex_arithmetic_EQ : Joined<["-"], "fcomplex-arithmetic=">, 
Group,
+  Visibility<[ClangOption, CC1Option]>,
+  Values<"full,improved,promoted,basic">, NormalizedValuesScope<"LangOptions">,
+  NormalizedValues<["CX_Full", "CX_Improved", "CX_Promoted", "CX_Basic"]>;
+
+def complex_range_EQ : Joined<["-"], "complex-range=">, Group,
+  Visibility<[CC1Option]>,
+  Values<"full,improved,promoted,basic">, NormalizedValuesScope<"LangOptions">,
+  NormalizedValues<["CX_Full", "CX_Improved", "CX_Promoted", "CX_Basic"]>,
+  MarshallingInfoEnum, "CX_Full">;
+
+def fcx_limited_range : Flag<["-"], "fcx-limited-range">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Basic algebraic expansions of complex arithmetic operations "
"involving are enabled.">;
 
-def fno_cx_limited_range : Joined<["-"], "fno-cx-limited-range">,
+def fno_cx_limited_range : Flag<["-"], "fno-cx-limited-range">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Basic algebraic expansions of complex arithmetic operations "
"involving are disabled.">;
 
-def fcx_fortran_rules : Joined<["-"], "fcx-fortran-rules">,
+def fcx_fortran_rules : Flag<["-"], "fcx-fortran-rules">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Range reduction is enabled for complex arithmetic operations.">;
 
-def fno_cx_fortran_rules : Joined<["-"], "fno-cx-fortran-rules">,
+def fno_cx_fortran_rules : Flag<["-"], "fno-cx-fortran-rules">,

mdtoguchi wrote:

for `fcx_limited_range/fno_cx_limited_range`, 
`fcx_fortran_rules/fno_cx_fortran_rules` additions, these look like good 
candidates to use `BoolOptionWithoutMarshalling` to simplify the representation.

https://github.com/llvm/llvm-project/pull/81514
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Michael Toguchi via cfe-commits


@@ -1046,30 +1046,35 @@ defm offload_uniform_block : 
BoolFOption<"offload-uniform-block",
   NegFlag,
   BothFlags<[], [ClangOption], " that kernels are launched with uniform block 
sizes (default true for CUDA/HIP and false otherwise)">>;
 
-def fcx_limited_range : Joined<["-"], "fcx-limited-range">,
+def fcomplex_arithmetic_EQ : Joined<["-"], "fcomplex-arithmetic=">, 
Group,
+  Visibility<[ClangOption, CC1Option]>,
+  Values<"full,improved,promoted,basic">, NormalizedValuesScope<"LangOptions">,
+  NormalizedValues<["CX_Full", "CX_Improved", "CX_Promoted", "CX_Basic"]>;
+
+def complex_range_EQ : Joined<["-"], "complex-range=">, Group,
+  Visibility<[CC1Option]>,
+  Values<"full,improved,promoted,basic">, NormalizedValuesScope<"LangOptions">,
+  NormalizedValues<["CX_Full", "CX_Improved", "CX_Promoted", "CX_Basic"]>,
+  MarshallingInfoEnum, "CX_Full">;
+
+def fcx_limited_range : Flag<["-"], "fcx-limited-range">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Basic algebraic expansions of complex arithmetic operations "
"involving are enabled.">;
 
-def fno_cx_limited_range : Joined<["-"], "fno-cx-limited-range">,
+def fno_cx_limited_range : Flag<["-"], "fno-cx-limited-range">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Basic algebraic expansions of complex arithmetic operations "
"involving are disabled.">;
 
-def fcx_fortran_rules : Joined<["-"], "fcx-fortran-rules">,
+def fcx_fortran_rules : Flag<["-"], "fcx-fortran-rules">,
   Group, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Range reduction is enabled for complex arithmetic operations.">;
 
-def fno_cx_fortran_rules : Joined<["-"], "fno-cx-fortran-rules">,
+def fno_cx_fortran_rules : Flag<["-"], "fno-cx-fortran-rules">,

mdtoguchi wrote:

Yes, just set the needed `Visibilty` values in your `PosFlag` and `NegFlag` 
entries.

https://github.com/llvm/llvm-project/pull/81514
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-18 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi approved this pull request.


https://github.com/llvm/llvm-project/pull/81514
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix warning message when using negative complex range options. (PR #84567)

2024-03-11 Thread Michael Toguchi via cfe-commits


@@ -50,3 +61,5 @@
 // CHECK-NOT: -complex-range=fortran
 // WARN1: warning: overriding '-fcx-limited-range' option with 
'-fcx-fortran-rules' [-Woverriding-option]
 // WARN2: warning: overriding '-fcx-fortran-rules' option with 
'-fcx-limited-range' [-Woverriding-option]
+// WARN3: warning: overriding '-fcx-fortran-rules' option with 
'fno-cx-limited-range' [-Woverriding-option]
+// WARN4: warning: overriding '-fcx-limited-range' option with 
'fno-cx-fortran-rules' [-Woverriding-option]

mdtoguchi wrote:

You have mixed usage of options with and without the option specifier, please 
add the specifier to the latter option here

https://github.com/llvm/llvm-project/pull/84567
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix warning message when using negative complex range options. (PR #84567)

2024-03-11 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi approved this pull request.


https://github.com/llvm/llvm-project/pull/84567
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-05 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi created 
https://github.com/llvm/llvm-project/pull/107493

Introduces the SYCL based toolchain and initial toolchain construction when 
using the '-fsycl' option.  This option will enable SYCL based offloading, 
creating a SPIR-V based IR file packaged into the compiled host object.

This includes early support for creating the host/device object using the new 
offloading model.  The device object is created using the 
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH] [Driver][SYCL] Add initial SYCL offload compilation support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  

[clang] Remove FiniteMathOnly and use only NoHonorINFs and NoHonorNANs. (PR #97342)

2024-07-12 Thread Michael Toguchi via cfe-commits


@@ -3295,7 +3295,17 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   }
 
   // Handle __FINITE_MATH_ONLY__ similarly.
-  if (!HonorINFs && !HonorNaNs)
+  bool InfValues, NanValues = true;
+  auto processArg = [&](const auto *Arg) {
+if (StringRef(Arg->getValue()) == "-menable-no-nans")
+  NanValues = false;
+if (StringRef(Arg->getValue()) == "-menable-no-infs")
+  InfValues = false;
+  };
+  for (auto *Arg : Args.filtered(options::OPT_Xclang)) {
+processArg(Arg);
+  }

mdtoguchi wrote:

```suggestion
  for (auto *Arg : Args.filtered(options::OPT_Xclang))
processArg(Arg);
```

https://github.com/llvm/llvm-project/pull/97342
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Remove FiniteMathOnly and use only NoHonorINFs and NoHonorNANs. (PR #97342)

2024-07-12 Thread Michael Toguchi via cfe-commits


@@ -3295,7 +3295,17 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   }
 
   // Handle __FINITE_MATH_ONLY__ similarly.
-  if (!HonorINFs && !HonorNaNs)
+  bool InfValues, NanValues = true;

mdtoguchi wrote:

`InfValues` isn't initialized here

https://github.com/llvm/llvm-project/pull/97342
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Remove FiniteMathOnly and use only NoHonorINFs and NoHonorNANs. (PR #97342)

2024-07-15 Thread Michael Toguchi via cfe-commits


@@ -3298,7 +3298,18 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   }
 
   // Handle __FINITE_MATH_ONLY__ similarly.
-  if (!HonorINFs && !HonorNaNs)
+  bool InfValues = true;
+  bool NanValues = true;
+  auto processArg = [&](const auto *Arg) {
+if (StringRef(Arg->getValue()) == "-menable-no-nans")
+  NanValues = false;
+if (StringRef(Arg->getValue()) == "-menable-no-infs")
+  InfValues = false;
+  };
+  for (auto *Arg : Args.filtered(options::OPT_Xclang))
+processArg(Arg);

mdtoguchi wrote:

No strong preference - singular addition of `-ffinite-math-only` is easier to 
maintain.

https://github.com/llvm/llvm-project/pull/97342
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-15 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Ping

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-11 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Hello - any additional feedback on this?

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-22 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

@bader, thanks for adding the SYCL label, can you also take a look at this PR?

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-04 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/9] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-05 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/9] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-01 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,184 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(const Driver &D)
+: D(D), InstallationCandidates() {

mdtoguchi wrote:

Thanks @AaronBallman, updates provided.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-01 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/8] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-23 Thread Michael Toguchi via cfe-commits


@@ -5116,15 +5123,39 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
   if (const Arg *PF = Args.getLastArg(options::OPT_mprintf_kind_EQ))
 PF->claim();
 
-  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false)) {
+  Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
+
+  if (IsSYCLDevice) {
+// Host triple is needed when doing SYCL device compilations.
+llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
+std::string NormalizedTriple = AuxT.normalize();
+CmdArgs.push_back("-aux-triple");
+CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
+
+// We want to compile sycl kernels.
 CmdArgs.push_back("-fsycl-is-device");
 
-if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
-  A->render(Args, CmdArgs);
+// Set O2 optimization level by default
+if (!Args.getLastArg(options::OPT_O_Group))
+  CmdArgs.push_back("-O2");
+  }
+
+  if (IsSYCL) {
+// Set options for both host and device
+if (SYCLStdArg) {
+  SYCLStdArg->render(Args, CmdArgs);
 } else {
   // Ensure the default version in SYCL mode is 2020.
   CmdArgs.push_back("-sycl-std=2020");
 }
+
+// Add any options that are needed specific to SYCL offload while
+// performing the host side compilation.
+if (!IsSYCLDevice) {
+  // Let the front-end host compilation flow know about SYCL offload
+  // compilation.
+  CmdArgs.push_back("-fsycl-is-host");
+}

mdtoguchi wrote:

Being in an `else` for `IsSYCLDevice` will pass `-fsycl-is-host` to all 
non-SYCL device compilations, even when offloading isn't enabled.  Maybe this 
can be structured to all be in an `IsSYCL` condition.  I will look into that.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-23 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/4] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-23 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/3] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-18 Thread Michael Toguchi via cfe-commits


@@ -5116,15 +5123,39 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
   if (const Arg *PF = Args.getLastArg(options::OPT_mprintf_kind_EQ))
 PF->claim();
 
-  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false)) {
+  Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
+
+  if (IsSYCLDevice) {
+// Host triple is needed when doing SYCL device compilations.
+llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
+std::string NormalizedTriple = AuxT.normalize();
+CmdArgs.push_back("-aux-triple");
+CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
+
+// We want to compile sycl kernels.
 CmdArgs.push_back("-fsycl-is-device");
 
-if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
-  A->render(Args, CmdArgs);
+// Set O2 optimization level by default
+if (!Args.getLastArg(options::OPT_O_Group))
+  CmdArgs.push_back("-O2");

mdtoguchi wrote:

The original implementation was based off of defaults that were applied for 
OpenCL:  
https://github.com/llvm/llvm-project/blob/main/clang/lib/Frontend/CompilerInvocation.cpp#L697-L700

Had a short interaction with @bader and he stated optimizations by default are 
critical for SYCL, as it adds a bit of C++ code like template instantiations to 
user's code.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-20 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,77 @@
+///
+/// Perform several driver tests for SYCL offloading for JIT
+///
+
+/// Check the phases graph with -fsycl. Use of -fsycl enables offload
+// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu \
+// RUN:   -fsycl %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHK-PHASES %s
+// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl \
+// RUN:   %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHK-PHASES %s

mdtoguchi wrote:

Good catch, will clean up.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-20 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,82 @@
+//===--- SYCL.h - SYCL ToolChain Implementations *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SYCL_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SYCL_H
+
+#include "clang/Driver/Tool.h"
+#include "clang/Driver/ToolChain.h"
+
+namespace clang {
+namespace driver {
+
+class SYCLInstallationDetector {
+public:
+  SYCLInstallationDetector(const Driver &D);
+  void AddSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+  llvm::opt::ArgStringList &CC1Args) const;
+  void print(llvm::raw_ostream &OS) const;
+
+private:
+  const Driver &D;
+  llvm::SmallVector, 4> InstallationCandidates;
+};
+
+namespace toolchains {
+
+class LLVM_LIBRARY_VISIBILITY SYCLToolChain : public ToolChain {
+public:
+  SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
+const ToolChain &HostTC, const llvm::opt::ArgList &Args);
+
+  const llvm::Triple *getAuxTriple() const override {
+return &HostTC.getTriple();
+  }
+
+  llvm::opt::DerivedArgList *
+  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
+Action::OffloadKind DeviceOffloadKind) const override;
+  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args,
+ Action::OffloadKind DeviceOffloadKind) const override;
+
+  bool useIntegratedAs() const override { return true; }
+  bool isPICDefault() const override { return false; }
+  llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override 
{
+if (this->HostTC.getTriple().isWindowsMSVCEnvironment())
+  return this->HostTC.getDefaultDebugFormat();
+return ToolChain::getDefaultDebugFormat();

mdtoguchi wrote:

Good point, this can probably be cleaned up.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-09-18 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,202 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Action.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include 
+#include 
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(const Driver &D)
+: D(D), InstallationCandidates() {
+  InstallationCandidates.emplace_back(D.Dir + "/..");
+}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl
+  //   ../include/sycl/stl_wrappers
+  //   ../include

mdtoguchi wrote:

The current location used for the SYCL based headers is not a standard 
location.  Scanning through some existing code, simple inclusion of the headers 
is something to the effect of `#include `.  So, this allows for 
capturing of the headers as needed.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-07 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Ping

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-25 Thread Michael Toguchi via cfe-commits


@@ -767,6 +768,27 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const 
ArgList &Args) const {
   return RT;
 }
 
+static const char *getDefaultSYCLArch(Compilation &C) {
+  // If -fsycl is supplied we will assume SPIR-V
+  if (C.getDefaultToolChain().getTriple().getArch() == llvm::Triple::x86)

mdtoguchi wrote:

Yup, that's right.  I've updated to use your suggestion.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-25 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/6] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-25 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/107493

>From 411203429a789330f044d6d7b2c0216cf21d816b Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Thu, 29 Aug 2024 16:39:42 -0700
Subject: [PATCH 1/7] [Driver][SYCL] Add initial SYCL offload compilation
 support

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option.  This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model.  The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference: https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Driver.h |   4 +
 clang/include/clang/Driver/Options.td   |  15 +-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 109 -
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  45 +-
 clang/lib/Driver/ToolChains/Gnu.cpp |   3 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   2 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 202 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 ++
 clang/test/Driver/sycl-offload-jit.cpp  |  77 +
 llvm/include/llvm/TargetParser/Triple.h |   7 +
 20 files changed, 565 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..ddadefaa079dd5 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -582,6 +582,10 @@ class Driver {
   /// @name Helper Methods
   /// @{
 
+  /// MakeSYCLDeviceTriple - Returns the SYCL device triple for the
+  /// specified ArchType.
+  llvm::Triple MakeSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
+
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 83cf753e824845..bd632f9270f382 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6691,12 +6692,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enables SYCL kernels compilation for device">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disables SYCL kernels compilation for device">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL kernels for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL kernels for host only">;
+} // let Group = sycl_Group
 
 // OS-specific options
 let Flags = [TargetSpecific] in {
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..0bc2a28bceb923 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -762,6 +76

[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-10-25 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Thanks for the review @bader, I have made updates and hope to have addressed 
your concerns.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-19 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,183 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(const Driver &D) : D(D) {
+  InstallationCandidates.emplace_back(D.Dir + "/..");
+}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl/stl_wrappers
+  //   ../include
+  SmallString<128> IncludePath(D.Dir);
+  llvm::sys::path::append(IncludePath, "..");
+  llvm::sys::path::append(IncludePath, "include");
+  // This is used to provide our wrappers around STL headers that provide
+  // additional functions/template specializations when the user includes those
+  // STL headers in their programs (e.g., ).
+  SmallString<128> STLWrappersPath(IncludePath);
+  llvm::sys::path::append(STLWrappersPath, "sycl");
+  llvm::sys::path::append(STLWrappersPath, "stl_wrappers");
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(STLWrappersPath));
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
+}
+
+void SYCLInstallationDetector::print(llvm::raw_ostream &OS) const {
+  if (!InstallationCandidates.size())
+return;
+  OS << "SYCL Installation Candidates: \n";
+  for (const auto &IC : InstallationCandidates) {
+OS << IC << "\n";
+  }
+}
+
+// Unsupported options for SYCL device compilation.
+static std::vector getUnsupportedOpts() {
+  std::vector UnsupportedOpts = {
+  options::OPT_fsanitize_EQ,  // -fsanitize
+  options::OPT_fcf_protection_EQ, // -fcf-protection
+  options::OPT_fprofile_generate,
+  options::OPT_fprofile_generate_EQ,
+  options::OPT_fno_profile_generate, // -f[no-]profile-generate
+  options::OPT_ftest_coverage,
+  options::OPT_fno_test_coverage, // -f[no-]test-coverage
+  options::OPT_fcoverage_mapping,
+  options::OPT_fno_coverage_mapping, // -f[no-]coverage-mapping
+  options::OPT_coverage, // --coverage
+  options::OPT_fprofile_instr_generate,
+  options::OPT_fprofile_instr_generate_EQ,
+  options::OPT_fno_profile_instr_generate, // -f[no-]profile-instr-generate
+  options::OPT_fprofile_arcs,
+  options::OPT_fno_profile_arcs, // -f[no-]profile-arcs
+  options::OPT_fcreate_profile,  // -fcreate-profile
+  options::OPT_fprofile_instr_use,
+  options::OPT_fprofile_instr_use_EQ,   // -fprofile-instr-use
+  options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
+  options::OPT_fcs_profile_generate,// -fcs-profile-generate
+  options::OPT_fcs_profile_generate_EQ};

mdtoguchi wrote:

@tahonermann, the `InstallationDetector` model was used mimicking the Cuda 
detectors.  There isn't really an installation to detect here, as everything 
should be part of the compiler build.  Perhaps the naming is not ideal maybe 
something more in the lines of `SYCLLocation` or just `SYCLInstallation`?  I'll 
clean out the `InstallationCandidates` as it is not pertinent.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-19 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,183 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(const Driver &D) : D(D) {
+  InstallationCandidates.emplace_back(D.Dir + "/..");
+}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl/stl_wrappers
+  //   ../include
+  SmallString<128> IncludePath(D.Dir);
+  llvm::sys::path::append(IncludePath, "..");
+  llvm::sys::path::append(IncludePath, "include");
+  // This is used to provide our wrappers around STL headers that provide
+  // additional functions/template specializations when the user includes those
+  // STL headers in their programs (e.g., ).
+  SmallString<128> STLWrappersPath(IncludePath);
+  llvm::sys::path::append(STLWrappersPath, "sycl");
+  llvm::sys::path::append(STLWrappersPath, "stl_wrappers");
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(STLWrappersPath));
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));

mdtoguchi wrote:

Makes sense to do so, I'll make those adjustments.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-15 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Thanks @AaronBallman.  I'll look into it.

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

2024-11-14 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Ping

https://github.com/llvm/llvm-project/pull/107493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-12-03 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Ping

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Driver][SYCL] Address sanitizer and test issue (PR #121822)

2025-01-06 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/121822

>From 92796278b87c5713a0cf16119009c07f87568df5 Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Mon, 6 Jan 2025 11:42:12 -0800
Subject: [PATCH 1/2] Driver][SYCL] Address sanitizer and test issue

The following commit:
https://github.com/llvm/llvm-project/commit/d00f65c6acd9f0e1ddae83391f55eb9d232d2f9e

Caused sanitizer build issues and also a test issue when using
%clang_cl.  Address these problems.

 - Use local static array
 - Use '--' for clang_cl calls
---
 clang/lib/Driver/ToolChains/SYCL.cpp   | 6 +++---
 clang/lib/Driver/ToolChains/SYCL.h | 3 ---
 clang/test/Driver/sycl-offload-jit.cpp | 4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp 
b/clang/lib/Driver/ToolChains/SYCL.cpp
index e42b65cc07deea..8c39d1b5b2299f 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -17,8 +17,7 @@ using namespace llvm::opt;
 
 SYCLInstallationDetector::SYCLInstallationDetector(
 const Driver &D, const llvm::Triple &HostTriple,
-const llvm::opt::ArgList &Args)
-: D(D) {}
+const llvm::opt::ArgList &Args) {}
 
 void SYCLInstallationDetector::addSYCLIncludeArgs(
 const ArgList &DriverArgs, ArgStringList &CC1Args) const {
@@ -32,7 +31,7 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
 
 // Unsupported options for SYCL device compilation.
 static ArrayRef getUnsupportedOpts() {
-  return {
+  static std::vector UnsupportedOpts = {
   options::OPT_fsanitize_EQ,  // -fsanitize
   options::OPT_fcf_protection_EQ, // -fcf-protection
   options::OPT_fprofile_generate,
@@ -54,6 +53,7 @@ static ArrayRef getUnsupportedOpts() {
   options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
   options::OPT_fcs_profile_generate,// -fcs-profile-generate
   options::OPT_fcs_profile_generate_EQ};
+  return UnsupportedOpts;
 }
 
 SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
diff --git a/clang/lib/Driver/ToolChains/SYCL.h 
b/clang/lib/Driver/ToolChains/SYCL.h
index 9af2fd0c45c5ed..2a8b4eca9e9f82 100644
--- a/clang/lib/Driver/ToolChains/SYCL.h
+++ b/clang/lib/Driver/ToolChains/SYCL.h
@@ -22,9 +22,6 @@ class SYCLInstallationDetector {
 
   void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const;
-
-private:
-  const Driver &D;
 };
 
 namespace toolchains {
diff --git a/clang/test/Driver/sycl-offload-jit.cpp 
b/clang/test/Driver/sycl-offload-jit.cpp
index d7ab630084098e..ff7e973c6078f5 100644
--- a/clang/test/Driver/sycl-offload-jit.cpp
+++ b/clang/test/Driver/sycl-offload-jit.cpp
@@ -3,7 +3,7 @@
 /// Check the phases graph with -fsycl. Use of -fsycl enables offload
 // RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 
2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
-// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl %s 
2>&1 \
+// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- 
%s 2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
 // CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
 // CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
@@ -36,7 +36,7 @@
 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
 // RUN: %clang_cl -### -fsycl -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
+// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST -- 
%s
 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s
 // CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc"

>From 79c4b729190d8c5b45d8231e05a1a4adc71f8e21 Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Mon, 6 Jan 2025 11:50:53 -0800
Subject: [PATCH 2/2] Fix test, put -- on wrong line

---
 clang/test/Driver/sycl-offload-jit.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Driver/sycl-offload-jit.cpp 
b/clang/test/Driver/sycl-offload-jit.cpp
index ff7e973c6078f5..eb192e08a3bc0c 100644
--- a/clang/test/Driver/sycl-offload-jit.cpp
+++ b/clang/test/Driver/sycl-offload-jit.cpp
@@ -35,8 +35,8 @@
 // RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
-// RUN: %clang_cl -### -fsycl -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST -- 
%s
+// RUN: %clang_cl -### -fsycl -c -- %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s
 // 

[clang] Driver][SYCL] Address sanitizer and test issue (PR #121822)

2025-01-06 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi created 
https://github.com/llvm/llvm-project/pull/121822

The following commit:
https://github.com/llvm/llvm-project/commit/d00f65c6acd9f0e1ddae83391f55eb9d232d2f9e

Caused sanitizer build issues and also a test issue when using %clang_cl.  
Address these problems.

 - Use local static array
 - Use '--' for clang_cl calls

>From 92796278b87c5713a0cf16119009c07f87568df5 Mon Sep 17 00:00:00 2001
From: Michael D Toguchi 
Date: Mon, 6 Jan 2025 11:42:12 -0800
Subject: [PATCH] Driver][SYCL] Address sanitizer and test issue

The following commit:
https://github.com/llvm/llvm-project/commit/d00f65c6acd9f0e1ddae83391f55eb9d232d2f9e

Caused sanitizer build issues and also a test issue when using
%clang_cl.  Address these problems.

 - Use local static array
 - Use '--' for clang_cl calls
---
 clang/lib/Driver/ToolChains/SYCL.cpp   | 6 +++---
 clang/lib/Driver/ToolChains/SYCL.h | 3 ---
 clang/test/Driver/sycl-offload-jit.cpp | 4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp 
b/clang/lib/Driver/ToolChains/SYCL.cpp
index e42b65cc07deea..8c39d1b5b2299f 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -17,8 +17,7 @@ using namespace llvm::opt;
 
 SYCLInstallationDetector::SYCLInstallationDetector(
 const Driver &D, const llvm::Triple &HostTriple,
-const llvm::opt::ArgList &Args)
-: D(D) {}
+const llvm::opt::ArgList &Args) {}
 
 void SYCLInstallationDetector::addSYCLIncludeArgs(
 const ArgList &DriverArgs, ArgStringList &CC1Args) const {
@@ -32,7 +31,7 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
 
 // Unsupported options for SYCL device compilation.
 static ArrayRef getUnsupportedOpts() {
-  return {
+  static std::vector UnsupportedOpts = {
   options::OPT_fsanitize_EQ,  // -fsanitize
   options::OPT_fcf_protection_EQ, // -fcf-protection
   options::OPT_fprofile_generate,
@@ -54,6 +53,7 @@ static ArrayRef getUnsupportedOpts() {
   options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
   options::OPT_fcs_profile_generate,// -fcs-profile-generate
   options::OPT_fcs_profile_generate_EQ};
+  return UnsupportedOpts;
 }
 
 SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
diff --git a/clang/lib/Driver/ToolChains/SYCL.h 
b/clang/lib/Driver/ToolChains/SYCL.h
index 9af2fd0c45c5ed..2a8b4eca9e9f82 100644
--- a/clang/lib/Driver/ToolChains/SYCL.h
+++ b/clang/lib/Driver/ToolChains/SYCL.h
@@ -22,9 +22,6 @@ class SYCLInstallationDetector {
 
   void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const;
-
-private:
-  const Driver &D;
 };
 
 namespace toolchains {
diff --git a/clang/test/Driver/sycl-offload-jit.cpp 
b/clang/test/Driver/sycl-offload-jit.cpp
index d7ab630084098e..ff7e973c6078f5 100644
--- a/clang/test/Driver/sycl-offload-jit.cpp
+++ b/clang/test/Driver/sycl-offload-jit.cpp
@@ -3,7 +3,7 @@
 /// Check the phases graph with -fsycl. Use of -fsycl enables offload
 // RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 
2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
-// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl %s 
2>&1 \
+// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- 
%s 2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
 // CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
 // CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
@@ -36,7 +36,7 @@
 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
 // RUN: %clang_cl -### -fsycl -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
+// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST -- 
%s
 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s
 // CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc"

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-06 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

I have posted a fix to address the sanitizer builds and build warning:  
https://github.com/llvm/llvm-project/pull/121822

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver][SYCL] Address sanitizer and test issue (PR #121822)

2025-01-06 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Thanks @vitalybuka, makes sense to use the literal type here.

https://github.com/llvm/llvm-project/pull/121822
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver][SYCL] Address sanitizer and test issue (PR #121822)

2025-01-06 Thread Michael Toguchi via cfe-commits


@@ -17,8 +17,7 @@ using namespace llvm::opt;
 
 SYCLInstallationDetector::SYCLInstallationDetector(
 const Driver &D, const llvm::Triple &HostTriple,
-const llvm::opt::ArgList &Args)
-: D(D) {}
+const llvm::opt::ArgList &Args) {}

mdtoguchi wrote:

It's not currently being used, the sanitizer builds flagged it.

https://github.com/llvm/llvm-project/pull/121822
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-03 Thread Michael Toguchi via cfe-commits


@@ -630,6 +630,11 @@ void toolchains::MinGW::AddHIPIncludeArgs(const ArgList 
&DriverArgs,
   RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
 }
 
+void toolchains::MinGW::addSYCLIncludeArgs(const ArgList &DriverArgs,
+   ArgStringList &CC1Args) const {
+  SYCLInstallation->addSYCLIncludeArgs(DriverArgs, CC1Args);

mdtoguchi wrote:

Initial testing found the need for this due to the general check for the 
updated header search locations.  As reviews progressed with @tahonermann, it 
was suggested to not add the explicit header search locations as it was not 
determined yet (SYCL specific headers and libraries not yet part of the build) 
so now there is nothing being tested here for this target.  This can be cleaned 
up and added again later when the headers are actually searched.

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-02 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi edited 
https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-02 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

@MaskRay - thank you for the review.  I have made the updates as suggested, 
please have another look when time permits.

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2025-01-02 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/117268

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH 1/7] Reland - [Driver][SYCL] Add initial SYCL offload
 compilation support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+
 // OS-specific options
 let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..4efef49346fa4d 100644
--- a/clang/incl

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2025-01-02 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi edited 
https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-02 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi edited 
https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-03 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/117268

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH 01/10] Reland - [Driver][SYCL] Add initial SYCL offload
 compilation support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+
 // OS-specific options
 let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..4efef49346fa4d 100644
--- a/clang/in

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-12-09 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/117268

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH 1/4] Reland - [Driver][SYCL] Add initial SYCL offload
 compilation support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+
 // OS-specific options
 let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..4efef49346fa4d 100644
--- a/clang/incl

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-12-09 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,179 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(
+const Driver &D, const llvm::Triple &HostTriple,
+const llvm::opt::ArgList &Args)
+: D(D) {}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nobuiltininc))
+return;
+
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl/stl_wrappers
+  //   ../include
+  SmallString<128> IncludePath(D.Dir);
+  llvm::sys::path::append(IncludePath, "..");
+  llvm::sys::path::append(IncludePath, "include");

mdtoguchi wrote:

Updates made to remove the header inclusions - `FIXME` in it's place until this 
is resolved with the library folks.

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-12-09 Thread Michael Toguchi via cfe-commits


@@ -6591,6 +6681,18 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
HostTC, Args);
   break;
 }
+case Action::OFK_SYCL:
+  switch (Target.getArch()) {
+  case llvm::Triple::spir:
+  case llvm::Triple::spir64:
+  case llvm::Triple::spirv32:
+  case llvm::Triple::spirv64:
+TC = std::make_unique(*this, Target, HostTC,
+ Args);
+break;
+  default:
+break;
+  }
 default:
   break;

mdtoguchi wrote:

Thanks for that, I have made updates here: 
https://github.com/llvm/llvm-project/pull/117268/commits/df928e839dc3350419066ec2b85a365cdf1d9502

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-22 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/117268

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH 1/2] Reland - [Driver][SYCL] Add initial SYCL offload
 compilation support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+
 // OS-specific options
 let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..4efef49346fa4d 100644
--- a/clang/incl

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-22 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,179 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(
+const Driver &D, const llvm::Triple &HostTriple,
+const llvm::opt::ArgList &Args)
+: D(D) {}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nobuiltininc))
+return;
+
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl/stl_wrappers
+  //   ../include
+  SmallString<128> IncludePath(D.Dir);
+  llvm::sys::path::append(IncludePath, "..");
+  llvm::sys::path::append(IncludePath, "include");
+  // This is used to provide our wrappers around STL headers that provide
+  // additional functions/template specializations when the user includes those
+  // STL headers in their programs (e.g., ).
+  SmallString<128> STLWrappersPath(IncludePath);
+  llvm::sys::path::append(STLWrappersPath, "sycl");
+  llvm::sys::path::append(STLWrappersPath, "stl_wrappers");
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(STLWrappersPath));
+  CC1Args.push_back("-internal-isystem");
+  CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
+}
+
+// Unsupported options for SYCL device compilation.
+static std::vector getUnsupportedOpts() {
+  std::vector UnsupportedOpts = {
+  options::OPT_fsanitize_EQ,  // -fsanitize
+  options::OPT_fcf_protection_EQ, // -fcf-protection
+  options::OPT_fprofile_generate,
+  options::OPT_fprofile_generate_EQ,
+  options::OPT_fno_profile_generate, // -f[no-]profile-generate
+  options::OPT_ftest_coverage,
+  options::OPT_fno_test_coverage, // -f[no-]test-coverage
+  options::OPT_fcoverage_mapping,
+  options::OPT_fno_coverage_mapping, // -f[no-]coverage-mapping
+  options::OPT_coverage, // --coverage
+  options::OPT_fprofile_instr_generate,
+  options::OPT_fprofile_instr_generate_EQ,
+  options::OPT_fno_profile_instr_generate, // -f[no-]profile-instr-generate
+  options::OPT_fprofile_arcs,
+  options::OPT_fno_profile_arcs, // -f[no-]profile-arcs
+  options::OPT_fcreate_profile,  // -fcreate-profile
+  options::OPT_fprofile_instr_use,
+  options::OPT_fprofile_instr_use_EQ,   // -fprofile-instr-use
+  options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
+  options::OPT_fcs_profile_generate,// -fcs-profile-generate
+  options::OPT_fcs_profile_generate_EQ};
+  return UnsupportedOpts;
+}
+
+SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
+ const ToolChain &HostTC, const ArgList &Args)
+: ToolChain(D, Triple, Args), HostTC(HostTC),
+  SYCLInstallation(D, Triple, Args) {
+  // Lookup binaries into the driver directory, this is used to discover any
+  // dependent SYCL offload compilation tools.
+  getProgramPaths().push_back(getDriver().Dir);
+
+  // Diagnose unsupported options only once.
+  for (OptSpecifier Opt : getUnsupportedOpts()) {
+if (const Arg *A = Args.getLastArg(Opt)) {
+  // All sanitizer options are not currently supported, except
+  // AddressSanitizer.

mdtoguchi wrote:

Right - I will remove this special casing until the support is upstreamed.

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-21 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi created 
https://github.com/llvm/llvm-project/pull/117268

…(#107493)

Introduces the SYCL based toolchain and initial toolchain construction when 
using the '-fsycl' option. This option will enable SYCL based offloading, 
creating a SPIR-V based IR file packaged into the compiled host object.

This includes early support for creating the host/device object using the new 
offloading model. The device object is created using the spir64-unknown-unknown 
target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull in the 
SYCL header dependencies to other toolchains.

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH] Reland - [Driver][SYCL] Add initial SYCL offload compilation
 support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsy

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-22 Thread Michael Toguchi via cfe-commits


@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+

mdtoguchi wrote:

I think this can be left to future work.

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-22 Thread Michael Toguchi via cfe-commits


@@ -6591,6 +6681,18 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
HostTC, Args);
   break;
 }
+case Action::OFK_SYCL:
+  switch (Target.getArch()) {
+  case llvm::Triple::spir:
+  case llvm::Triple::spir64:
+  case llvm::Triple::spirv32:
+  case llvm::Triple::spirv64:
+TC = std::make_unique(*this, Target, HostTC,
+ Args);
+break;
+  default:
+break;
+  }
 default:
   break;

mdtoguchi wrote:

I followed the `OFK_HIP` usage here and added an assert if `TC` isn't 
populated. 
https://github.com/llvm/llvm-project/blob/3fdc74687dbf6da831a1c27995d9d7fef3a2a51f/clang/lib/Driver/Driver.cpp#L1063

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-11-22 Thread Michael Toguchi via cfe-commits


@@ -0,0 +1,179 @@
+//===--- SYCL.cpp - SYCL Tool and ToolChain Implementations -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#include "SYCL.h"
+#include "CommonArgs.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namespace clang::driver::tools;
+using namespace clang;
+using namespace llvm::opt;
+
+SYCLInstallationDetector::SYCLInstallationDetector(
+const Driver &D, const llvm::Triple &HostTriple,
+const llvm::opt::ArgList &Args)
+: D(D) {}
+
+void SYCLInstallationDetector::AddSYCLIncludeArgs(
+const ArgList &DriverArgs, ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nobuiltininc))
+return;
+
+  // Add the SYCL header search locations in the specified order.
+  //   ../include/sycl/stl_wrappers
+  //   ../include
+  SmallString<128> IncludePath(D.Dir);
+  llvm::sys::path::append(IncludePath, "..");
+  llvm::sys::path::append(IncludePath, "include");

mdtoguchi wrote:

I would guess this depends on how ultimately the `include/sycl` headers are 
installed and how we should point to them.  As the headers are not currently 
part of the build, this is basically just  a location in which to try and find 
the SYCL specific headers (this is what we are doing in intel/llvm).

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-08 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

> also:
> 
> ```
> clang/lib/Driver/ToolChains/SYCL.h:27:17: warning: private field 'D' is not 
> used [-Wunused-private-field]
> ```

@jroelofs, these should be addressed with 
https://github.com/llvm/llvm-project/pull/121822

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #117268)

2025-01-03 Thread Michael Toguchi via cfe-commits

https://github.com/mdtoguchi updated 
https://github.com/llvm/llvm-project/pull/117268

>From 3fdc74687dbf6da831a1c27995d9d7fef3a2a51f Mon Sep 17 00:00:00 2001
From: Michael Toguchi 
Date: Fri, 15 Nov 2024 05:14:21 -0700
Subject: [PATCH 1/9] Reland - [Driver][SYCL] Add initial SYCL offload
 compilation support (#107493)

Introduces the SYCL based toolchain and initial toolchain construction
when using the '-fsycl' option. This option will enable SYCL based
offloading, creating a SPIR-V based IR file packaged into the compiled
host object.

This includes early support for creating the host/device object using
the new offloading model. The device object is created using the
spir64-unknown-unknown target triple.

New/Updated Options:
 -fsycl  Enables SYCL offloading for host and device
 -fsycl-device-only
 Enables device only compilation for SYCL
 -fsycl-host-only
 Enables host only compilation for SYCL

RFC Reference:
https://discourse.llvm.org/t/rfc-sycl-driver-enhancements/74092

Was reverted due to buildbot issues.  Contains additional fixes to pull
in the SYCL header dependencies to other toolchains.
---
 clang/include/clang/Driver/Action.h |   1 +
 clang/include/clang/Driver/Options.td   |  20 ++-
 clang/include/clang/Driver/ToolChain.h  |   4 +
 clang/lib/Driver/Action.cpp |   8 +-
 clang/lib/Driver/CMakeLists.txt |   1 +
 clang/lib/Driver/Compilation.cpp|   9 +-
 clang/lib/Driver/Driver.cpp | 104 +-
 clang/lib/Driver/ToolChain.cpp  |   3 +
 clang/lib/Driver/ToolChains/Clang.cpp   |  58 ++--
 clang/lib/Driver/ToolChains/Darwin.cpp  |   8 +-
 clang/lib/Driver/ToolChains/Darwin.h|   4 +
 clang/lib/Driver/ToolChains/Gnu.cpp |   8 +-
 clang/lib/Driver/ToolChains/Gnu.h   |   5 +
 clang/lib/Driver/ToolChains/Linux.cpp   |   5 +
 clang/lib/Driver/ToolChains/Linux.h |   2 +
 clang/lib/Driver/ToolChains/MSVC.cpp|   7 +-
 clang/lib/Driver/ToolChains/MSVC.h  |   5 +
 clang/lib/Driver/ToolChains/MinGW.cpp   |   7 +-
 clang/lib/Driver/ToolChains/MinGW.h |   4 +
 clang/lib/Driver/ToolChains/SYCL.cpp| 179 
 clang/lib/Driver/ToolChains/SYCL.h  |  82 +++
 clang/test/Driver/sycl-offload-jit.cpp  |  80 +++
 llvm/include/llvm/TargetParser/Triple.h |   3 +
 23 files changed, 579 insertions(+), 28 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SYCL.h
 create mode 100644 clang/test/Driver/sycl-offload-jit.cpp

diff --git a/clang/include/clang/Driver/Action.h 
b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..feeabae89d6b1c 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -94,6 +94,7 @@ class Action {
 OFK_Cuda = 0x02,
 OFK_OpenMP = 0x04,
 OFK_HIP = 0x08,
+OFK_SYCL = 0x10,
   };
 
   static const char *getClassName(ActionClass AC);
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5167c3c39e315a..1da3c9a1118ca8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -182,7 +182,8 @@ def opencl_Group : OptionGroup<"">, 
Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
- DocName<"SYCL options">;
+ DocName<"SYCL options">,
+ Visibility<[ClangOption, CLOption]>;
 
 def cuda_Group : OptionGroup<"">, Group,
DocName<"CUDA options">,
@@ -6782,16 +6783,21 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
 defm : FlangIgnoredDiagOpt<"target-lifetime">;
 
 // C++ SYCL options
+let Group = sycl_Group in {
 def fsycl : Flag<["-"], "fsycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Enables SYCL kernels compilation for device">;
+  HelpText<"Enable SYCL C++ extensions">;
 def fno_sycl : Flag<["-"], "fno-sycl">,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Disables SYCL kernels compilation for device">;
+  HelpText<"Disable SYCL C++ extensions">;
+def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
+  Alias, HelpText<"Compile SYCL code for device only">;
+def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
+  Alias, HelpText<"Compile SYCL code for host only. Has no "
+  "effect on non-SYCL compilations">;
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
-  Visibility<[ClangOption, CLOption]>,
-  Group, HelpText<"Perform link through clang-sycl-linker via the 
target "
+  HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+} // let Group = sycl_Group
+
 // OS-specific options
 let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
diff --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..4efef49346fa4d 100644
--- a/clang/incl

[clang] [llvm] Reland - [Driver][SYCL] Add initial SYCL offload compilation support … (PR #117268)

2024-12-24 Thread Michael Toguchi via cfe-commits

mdtoguchi wrote:

Ping

https://github.com/llvm/llvm-project/pull/117268
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits