Skip to content

Commit a8ce719

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents b8d0906 + fed32a8 commit a8ce719

34 files changed

+517
-248
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10643,7 +10643,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1064310643

1064410644
// Add any SYCL offloading specific options to the clang-linker-wrapper
1064510645
if (C.hasOffloadToolChain<Action::OFK_SYCL>()) {
10646-
// --sycl-device-libraries=<comma separated list> contains all of the SYCL
10646+
// -sycl-device-libraries=<comma separated list> contains all of the SYCL
1064710647
// device specific libraries that are needed. This provides the list of
1064810648
// files file only.
1064910649
// TODO: This generic list will be populated with only device binaries
@@ -10671,14 +10671,14 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1067110671
LibList += ",";
1067210672
LibList += AddLib;
1067310673
}
10674-
// --sycl-device-libraries=<libs> provides a comma separate list of
10674+
// -sycl-device-libraries=<libs> provides a comma separate list of
1067510675
// libraries to add to the device linking step.
1067610676
// SYCL device libraries can be found.
1067710677
if (LibList.size())
1067810678
CmdArgs.push_back(
10679-
Args.MakeArgString(Twine("--sycl-device-libraries=") + LibList));
10679+
Args.MakeArgString(Twine("-sycl-device-libraries=") + LibList));
1068010680

10681-
// --sycl-device-library-location=<dir> provides the location in which the
10681+
// -sycl-device-library-location=<dir> provides the location in which the
1068210682
// SYCL device libraries can be found.
1068310683
SmallString<128> DeviceLibDir(D.Dir);
1068410684
llvm::sys::path::append(DeviceLibDir, "..", "lib");
@@ -10700,7 +10700,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1070010700
}
1070110701
}
1070210702
CmdArgs.push_back(Args.MakeArgString(
10703-
Twine("--sycl-device-library-location=") + DeviceLibDir));
10703+
Twine("-sycl-device-library-location=") + DeviceLibDir));
1070410704
}
1070510705

1070610706
auto appendOption = [](SmallString<128> &OptString, StringRef AddOpt) {

clang/test/Driver/sycl-offload-new-driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
// RUN: --sysroot=%S/Inputs/SYCL -### %s 2>&1 \
3939
// RUN: | FileCheck -check-prefix WRAPPER_OPTIONS %s
4040
// WRAPPER_OPTIONS: clang-linker-wrapper{{.*}} "--triple=spir64"
41-
// WRAPPER_OPTIONS-SAME: "--sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42-
// WRAPPER_OPTIONS-SAME: "--sycl-device-library-location={{.*}}/lib"
41+
// WRAPPER_OPTIONS-SAME: "-sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42+
// WRAPPER_OPTIONS-SAME: "-sycl-device-library-location={{.*}}/lib"
4343

4444
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
4545
// RUN: -Xspirv-translator -translator-opt -### %s 2>&1 \

opencl/opencl-aot/source/main.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ int main(int Argc, char *Argv[]) {
593593
break;
594594
}
595595

596-
std::string CompilerBuildLog;
596+
std::string CompilerBuildLog, CompilerBuildLogMessage;
597597
std::tie(CompilerBuildLog, ErrorMessage, std::ignore) =
598598
getCompilerBuildLog(ProgramUPtr, DeviceId);
599599

@@ -604,18 +604,20 @@ int main(int Argc, char *Argv[]) {
604604
}
605605

606606
if (!CompilerBuildLog.empty()) {
607-
std::string CompilerBuildLogMessage = "\n" +
608-
CmdToCmdInfoMap[OptCommand].first +
609-
" log:\n" + CompilerBuildLog + '\n';
610-
if (!ErrorMessage.empty())
611-
std::cerr << CompilerBuildLogMessage;
612-
else
613-
logs() << CompilerBuildLogMessage;
607+
// According to the return value of getCompilerBuildLog(), ErrorMessage is
608+
// always empty if CompilerBuildLog is not empty.
609+
CompilerBuildLogMessage = "\n" + CmdToCmdInfoMap[OptCommand].first +
610+
" log:\n" + CompilerBuildLog + '\n';
611+
logs() << CompilerBuildLogMessage;
614612
}
615613

616614
if (clFailed(CLErr)) {
617615
std::string ErrMsg =
618616
"Failed to " + CmdToCmdInfoMap[OptCommand].first + ": ";
617+
// will print CompilerBuildLogMessage when build failed in case verbose is
618+
// false, in order to provide a friendlier compile error for users.
619+
if (!verbose)
620+
std::cerr << CompilerBuildLogMessage;
619621
std::cerr << formatCLError(ErrMsg, CLErr) << '\n';
620622
return CLErr;
621623
}

sycl/include/sycl/ext/intel/esimd/detail/half_type_traits.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ template <>
121121
struct is_esimd_arithmetic_type<half_raw_type, void> : std::true_type {};
122122
#endif // __SYCL_DEVICE_ONLY__
123123

124+
template <>
125+
struct is_esimd_arithmetic_type<sycl::half, void> : std::true_type {};
126+
124127
// Misc
125128
inline std::ostream &operator<<(std::ostream &O, sycl::half const &rhs) {
126129
O << static_cast<float>(rhs);

sycl/source/backend/level_zero.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ __SYCL_EXPORT context make_context(const std::vector<device> &DeviceList,
5555
NativeHandle, DeviceHandles.size(), DeviceHandles.data(), !KeepOwnership,
5656
&PiContext);
5757
// Construct the SYCL context from PI context.
58-
return detail::createSyclObjFromImpl<context>(std::make_shared<context_impl>(
59-
PiContext, detail::defaultAsyncHandler, Plugin, !KeepOwnership));
58+
return detail::createSyclObjFromImpl<context>(
59+
std::make_shared<context_impl>(PiContext, detail::defaultAsyncHandler,
60+
Plugin, DeviceList, !KeepOwnership));
6061
}
6162

6263
//----------------------------------------------------------------------------

sycl/source/detail/context_impl.cpp

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,36 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
7171

7272
context_impl::context_impl(sycl::detail::pi::PiContext PiContext,
7373
async_handler AsyncHandler, const PluginPtr &Plugin,
74+
const std::vector<sycl::device> &DeviceList,
7475
bool OwnedByRuntime)
75-
: MOwnedByRuntime(OwnedByRuntime), MAsyncHandler(AsyncHandler), MDevices(),
76-
MContext(PiContext), MPlatform(), MHostContext(false),
77-
MSupportBufferLocationByDevices(NotChecked) {
78-
79-
std::vector<sycl::detail::pi::PiDevice> DeviceIds;
80-
uint32_t DevicesNum = 0;
81-
// TODO catch an exception and put it to list of asynchronous exceptions
82-
Plugin->call<PiApiKind::piContextGetInfo>(
83-
MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
84-
nullptr);
85-
DeviceIds.resize(DevicesNum);
86-
// TODO catch an exception and put it to list of asynchronous exceptions
87-
Plugin->call<PiApiKind::piContextGetInfo>(
88-
MContext, PI_CONTEXT_INFO_DEVICES,
89-
sizeof(sycl::detail::pi::PiDevice) * DevicesNum, &DeviceIds[0], nullptr);
90-
91-
if (!DeviceIds.empty()) {
92-
std::shared_ptr<detail::platform_impl> Platform =
93-
platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin);
94-
for (sycl::detail::pi::PiDevice Dev : DeviceIds) {
95-
MDevices.emplace_back(createSyclObjFromImpl<device>(
96-
Platform->getOrMakeDeviceImpl(Dev, Platform)));
76+
: MOwnedByRuntime(OwnedByRuntime), MAsyncHandler(AsyncHandler),
77+
MDevices(DeviceList), MContext(PiContext), MPlatform(),
78+
MHostContext(false), MSupportBufferLocationByDevices(NotChecked) {
79+
if (!MDevices.empty()) {
80+
MPlatform = detail::getSyclObjImpl(MDevices[0].get_platform());
81+
} else {
82+
std::vector<sycl::detail::pi::PiDevice> DeviceIds;
83+
uint32_t DevicesNum = 0;
84+
// TODO catch an exception and put it to list of asynchronous exceptions
85+
Plugin->call<PiApiKind::piContextGetInfo>(
86+
MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
87+
nullptr);
88+
DeviceIds.resize(DevicesNum);
89+
// TODO catch an exception and put it to list of asynchronous exceptions
90+
Plugin->call<PiApiKind::piContextGetInfo>(
91+
MContext, PI_CONTEXT_INFO_DEVICES,
92+
sizeof(sycl::detail::pi::PiDevice) * DevicesNum, &DeviceIds[0],
93+
nullptr);
94+
95+
if (!DeviceIds.empty()) {
96+
std::shared_ptr<detail::platform_impl> Platform =
97+
platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin);
98+
for (sycl::detail::pi::PiDevice Dev : DeviceIds) {
99+
MDevices.emplace_back(createSyclObjFromImpl<device>(
100+
Platform->getOrMakeDeviceImpl(Dev, Platform)));
101+
}
102+
MPlatform = Platform;
97103
}
98-
MPlatform = Platform;
99104
}
100105
// TODO catch an exception and put it to list of asynchronous exceptions
101106
// getPlugin() will be the same as the Plugin passed. This should be taken

sycl/source/detail/context_impl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class context_impl {
7171
/// transferred to runtime
7272
context_impl(sycl::detail::pi::PiContext PiContext,
7373
async_handler AsyncHandler, const PluginPtr &Plugin,
74+
const std::vector<sycl::device> &DeviceList = {},
7475
bool OwnedByRuntime = true);
7576

7677
~context_impl();

sycl/source/detail/graph_impl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,6 @@ void exec_graph_impl::createCommandBuffers(
724724
}
725725

726726
exec_graph_impl::~exec_graph_impl() {
727-
WriteLock LockImpl(MGraphImpl->MMutex);
728-
729-
// clear all recording queue if not done before (no call to end_recording)
730-
MGraphImpl->clearQueues();
731-
732727
const sycl::detail::PluginPtr &Plugin =
733728
sycl::detail::getSyclObjImpl(MContext)->getPlugin();
734729
MSchedule.clear();

sycl/source/detail/scheduler/commands.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,8 +2488,9 @@ pi_int32 enqueueImpCommandBufferKernel(
24882488
}
24892489

24902490
if (Res != pi_result::PI_SUCCESS) {
2491-
throw sycl::exception(errc::invalid,
2492-
"Failed to add kernel to PI command-buffer");
2491+
const device_impl &DeviceImplem = *(DeviceImpl);
2492+
detail::enqueue_kernel_launch::handleErrorOrWarning(Res, DeviceImplem,
2493+
PiKernel, NDRDesc);
24932494
}
24942495

24952496
return Res;

sycl/test-e2e/Basic/float_division_precise.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %{build} -ffp-model=precise -o %t.out
1+
// DEFINE: %{preciseflag} = %if cl_options %{/fp:precise%} %else %{-ffp-model=precise%}
2+
3+
// RUN: %{build} %{preciseflag} -o %t.out
24
// RUN: %{run} %t.out
35

46
// Tests that -ffp-model=precise causes floating point division to be the same

0 commit comments

Comments
 (0)