|
9 | 9 | #ifndef LLVM_CLANG_DRIVER_SYCLINSTALLATIONDETECTOR_H |
10 | 10 | #define LLVM_CLANG_DRIVER_SYCLINSTALLATIONDETECTOR_H |
11 | 11 |
|
12 | | -#include "clang/Basic/Cuda.h" |
13 | 12 | #include "clang/Driver/Driver.h" |
14 | | -#include "clang/Driver/Options.h" |
15 | | -#include "clang/Driver/Tool.h" |
16 | 13 |
|
17 | 14 | namespace clang { |
18 | 15 | namespace driver { |
19 | 16 |
|
20 | | -// This is a mapping between the user provided --offload-arch value for Intel |
21 | | -// GPU targets and the spir64_gen device name accepted by OCLOC (the Intel GPU |
22 | | -// AOT compiler). |
23 | | -StringRef mapIntelGPUArchName(StringRef ArchName); |
24 | | - |
25 | 17 | class SYCLInstallationDetector { |
26 | 18 | public: |
27 | 19 | SYCLInstallationDetector(const Driver &D); |
@@ -51,110 +43,6 @@ class SYCLInstallationDetector { |
51 | 43 | llvm::SmallVector<llvm::SmallString<128>, 4> InstallationCandidates; |
52 | 44 | }; |
53 | 45 |
|
54 | | - |
55 | | -class Command; |
56 | | - |
57 | | -namespace tools { |
58 | | -namespace SYCL { |
59 | | - |
60 | | -void constructLLVMForeachCommand(Compilation &C, const JobAction &JA, |
61 | | - std::unique_ptr<Command> InputCommand, |
62 | | - const InputInfoList &InputFiles, |
63 | | - const InputInfo &Output, const Tool *T, |
64 | | - StringRef Increment, StringRef Ext = "out", |
65 | | - StringRef ParallelJobs = ""); |
66 | | - |
67 | | -// Provides a vector of device library names that are associated with the |
68 | | -// given triple and AOT information. |
69 | | -SmallVector<std::string, 8> getDeviceLibraries(const Compilation &C, |
70 | | - const llvm::Triple &TargetTriple, |
71 | | - bool IsSpirvAOT); |
72 | | - |
73 | | -// Populates the SYCL device traits macros. |
74 | | -void populateSYCLDeviceTraitsMacrosArgs( |
75 | | - Compilation &C, const llvm::opt::ArgList &Args, |
76 | | - const SmallVectorImpl<std::pair<const ToolChain *, StringRef>> &Targets); |
77 | | - |
78 | | -bool shouldDoPerObjectFileLinking(const Compilation &C); |
79 | | -// Runs llvm-spirv to convert spirv to bc, llvm-link, which links multiple LLVM |
80 | | -// bitcode. Converts generated bc back to spirv using llvm-spirv, wraps with |
81 | | -// offloading information. Finally compiles to object using llc |
82 | | -class LLVM_LIBRARY_VISIBILITY Linker : public Tool { |
83 | | -public: |
84 | | - Linker(const ToolChain &TC) : Tool("SYCL::Linker", "sycl-link", TC) {} |
85 | | - |
86 | | - bool hasIntegratedCPP() const override { return false; } |
87 | | - |
88 | | - void ConstructJob(Compilation &C, const JobAction &JA, |
89 | | - const InputInfo &Output, const InputInfoList &Inputs, |
90 | | - const llvm::opt::ArgList &TCArgs, |
91 | | - const char *LinkingOutput) const override; |
92 | | - |
93 | | -private: |
94 | | - /// \return llvm-link output file name. |
95 | | - const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA, |
96 | | - const InputInfo &Output, |
97 | | - const llvm::opt::ArgList &Args, |
98 | | - llvm::StringRef SubArchName, |
99 | | - llvm::StringRef OutputFilePrefix, |
100 | | - const InputInfoList &InputFiles) const; |
101 | | -}; |
102 | | - |
103 | | -namespace gen { |
104 | | - |
105 | | -class LLVM_LIBRARY_VISIBILITY BackendCompiler : public Tool { |
106 | | -public: |
107 | | - BackendCompiler(const ToolChain &TC) |
108 | | - : Tool("gen::BackendCompiler", "gen compiler", TC) {} |
109 | | - |
110 | | - bool hasIntegratedCPP() const override { return false; } |
111 | | - |
112 | | - void ConstructJob(Compilation &C, const JobAction &JA, |
113 | | - const InputInfo &Output, const InputInfoList &Inputs, |
114 | | - const llvm::opt::ArgList &TCArgs, |
115 | | - const char *LinkingOutput) const override; |
116 | | -}; |
117 | | - |
118 | | -StringRef resolveGenDevice(StringRef DeviceName); |
119 | | -SmallString<64> getGenDeviceMacro(StringRef DeviceName); |
120 | | -StringRef getGenGRFFlag(StringRef GRFMode); |
121 | | - |
122 | | -// Prefix for GPU specific targets used for -fsycl-targets |
123 | | -constexpr char IntelGPU[] = "intel_gpu_"; |
124 | | -constexpr char NvidiaGPU[] = "nvidia_gpu_"; |
125 | | -constexpr char AmdGPU[] = "amd_gpu_"; |
126 | | - |
127 | | -template <auto GPUArh> std::optional<StringRef> isGPUTarget(StringRef Target) { |
128 | | - // Handle target specifications that resemble '(intel, nvidia, amd)_gpu_*' |
129 | | - // here. |
130 | | - if (Target.starts_with(GPUArh)) { |
131 | | - return resolveGenDevice(Target); |
132 | | - } |
133 | | - return std::nullopt; |
134 | | -} |
135 | | - |
136 | | -} // end namespace gen |
137 | | - |
138 | | -namespace x86_64 { |
139 | | - |
140 | | -class LLVM_LIBRARY_VISIBILITY BackendCompiler : public Tool { |
141 | | -public: |
142 | | - BackendCompiler(const ToolChain &TC) |
143 | | - : Tool("x86_64::BackendCompiler", "x86_64 compiler", TC) {} |
144 | | - |
145 | | - bool hasIntegratedCPP() const override { return false; } |
146 | | - |
147 | | - void ConstructJob(Compilation &C, const JobAction &JA, |
148 | | - const InputInfo &Output, const InputInfoList &Inputs, |
149 | | - const llvm::opt::ArgList &TCArgs, |
150 | | - const char *LinkingOutput) const override; |
151 | | -}; |
152 | | - |
153 | | -} // end namespace x86_64 |
154 | | - |
155 | | -} // end namespace SYCL |
156 | | -} // end namespace tools |
157 | | - |
158 | 46 | } // namespace driver |
159 | 47 | } // namespace clang |
160 | 48 |
|
|
0 commit comments