@@ -165,9 +165,9 @@ static bool selectBfloatLibs(const llvm::Triple &Triple, const Compilation &C,
165165
166166 // spir64 target is actually JIT compilation, so we defer selection of
167167 // bfloat16 libraries to runtime. For AOT we need libraries, but skip
168- // for Nvidia.
169- NeedLibs =
170- Triple.getSubArch () != llvm::Triple::NoSubArch && !Triple.isNVPTX ();
168+ // for Nvidia and AMD .
169+ NeedLibs = Triple. getSubArch () != llvm::Triple::NoSubArch &&
170+ ! Triple.isNVPTX () && !Triple.isAMDGCN ();
171171 UseNative = false ;
172172 if (NeedLibs && Triple.getSubArch () == llvm::Triple::SPIRSubArch_gen &&
173173 C.hasOffloadToolChain <Action::OFK_SYCL>()) {
@@ -212,9 +212,9 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
212212 SmallVector<std::string, 8 > LibraryList;
213213 const llvm::opt::ArgList &Args = C.getArgs ();
214214
215- // For NVPTX we only use one single bitcode library and ignore
215+ // For NVPTX and AMDGCN we only use one single bitcode library and ignore
216216 // manually specified SYCL device libraries.
217- bool IgnoreSingleLibs = TargetTriple.isNVPTX ();
217+ bool IgnoreSingleLibs = TargetTriple.isNVPTX () || TargetTriple. isAMDGCN () ;
218218
219219 struct DeviceLibOptInfo {
220220 StringRef DeviceLibName;
@@ -278,6 +278,9 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
278278 if (TargetTriple.isNVPTX () && IgnoreSingleLibs)
279279 LibraryList.push_back (Args.MakeArgString (" devicelib--cuda.bc" ));
280280
281+ if (TargetTriple.isAMDGCN () && IgnoreSingleLibs)
282+ LibraryList.push_back (Args.MakeArgString (" devicelib--amd.bc" ));
283+
281284 if (IgnoreSingleLibs)
282285 return LibraryList;
283286
@@ -1812,22 +1815,18 @@ void SYCLToolChain::AddSYCLIncludeArgs(const clang::driver::Driver &Driver,
18121815 const ArgList &DriverArgs,
18131816 ArgStringList &CC1Args) {
18141817 // Add the SYCL header search locations in the specified order.
1815- // ../include/sycl
18161818 // ../include/sycl/stl_wrappers
18171819 // ../include
18181820 SmallString<128 > IncludePath (Driver.Dir );
18191821 llvm::sys::path::append (IncludePath, " .." );
18201822 llvm::sys::path::append (IncludePath, " include" );
1821- SmallString<128 > SYCLPath (IncludePath);
1822- llvm::sys::path::append (SYCLPath, " sycl" );
18231823 // This is used to provide our wrappers around STL headers that provide
18241824 // additional functions/template specializations when the user includes those
18251825 // STL headers in their programs (e.g., <complex>).
1826- SmallString<128 > STLWrappersPath (SYCLPath);
1826+ SmallString<128 > STLWrappersPath (IncludePath);
1827+ llvm::sys::path::append (STLWrappersPath, " sycl" );
18271828 llvm::sys::path::append (STLWrappersPath, " stl_wrappers" );
18281829 CC1Args.push_back (" -internal-isystem" );
1829- CC1Args.push_back (DriverArgs.MakeArgString (SYCLPath));
1830- CC1Args.push_back (" -internal-isystem" );
18311830 CC1Args.push_back (DriverArgs.MakeArgString (STLWrappersPath));
18321831 CC1Args.push_back (" -internal-isystem" );
18331832 CC1Args.push_back (DriverArgs.MakeArgString (IncludePath));
0 commit comments