Skip to content

Commit b40bd29

Browse files
Use clang-format tool(default llvm style)
1 parent 26d1473 commit b40bd29

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

sycl/source/backend.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ static const PluginPtr &getPlugin(backend Backend) {
3838
case backend::ext_oneapi_cuda:
3939
return pi::getPlugin<backend::ext_oneapi_cuda>();
4040
default:
41-
throw sycl::exception(sycl::errc::runtime, "getPlugin: Unsupported backend");
41+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
42+
"getPlugin: Unsupported backend");
4243
}
4344
}
4445

@@ -195,15 +196,17 @@ make_kernel_bundle(pi_native_handle NativeHandle, const context &TargetContext,
195196
case (PI_PROGRAM_BINARY_TYPE_COMPILED_OBJECT):
196197
case (PI_PROGRAM_BINARY_TYPE_LIBRARY):
197198
if (State == bundle_state::input)
198-
throw sycl::exception(sycl::errc::runtime, "Program and kernel_bundle state mismatch");
199+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
200+
"Program and kernel_bundle state mismatch");
199201
if (State == bundle_state::executable)
200202
Plugin->call<errc::build, PiApiKind::piProgramLink>(
201203
ContextImpl->getHandleRef(), 1, &Dev, nullptr, 1, &PiProgram,
202204
nullptr, nullptr, &PiProgram);
203205
break;
204206
case (PI_PROGRAM_BINARY_TYPE_EXECUTABLE):
205207
if (State == bundle_state::input || State == bundle_state::object)
206-
throw sycl::exception(sycl::errc::runtime, "Program and kernel_bundle state mismatch");
208+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
209+
"Program and kernel_bundle state mismatch");
207210
break;
208211
}
209212
}
@@ -257,7 +260,9 @@ kernel make_kernel(const context &TargetContext,
257260
pi::PiProgram PiProgram = nullptr;
258261
if (Backend == backend::ext_oneapi_level_zero) {
259262
if (KernelBundleImpl->size() != 1)
260-
throw sycl::exception(sycl::errc::runtime, "make_kernel: kernel_bundle must have single program image");
263+
throw sycl::exception(
264+
sycl::make_error_code(sycl::errc::runtime),
265+
"make_kernel: kernel_bundle must have single program image");
261266

262267
const device_image<bundle_state::executable> &DeviceImage =
263268
*KernelBundle.begin();

sycl/source/detail/allowlist.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
7272
const char DelimiterBtwDeviceDescs = '|';
7373

7474
if (AllowListRaw.find(DelimiterBtwKeyAndValue, KeyStart) == std::string::npos)
75-
throw sycl::exception(sycl::errc::runtime,
75+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
7676
"SYCL_DEVICE_ALLOWLIST has incorrect format. For "
7777
"details, please refer to "
7878
"https://github.com/intel/llvm/blob/sycl/sycl/"
@@ -95,7 +95,8 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
9595
if (std::find(SupportedAllowListKeyNames.begin(),
9696
SupportedAllowListKeyNames.end(),
9797
Key) == SupportedAllowListKeyNames.end()) {
98-
throw sycl::exception(sycl::errc::runtime,
98+
throw sycl::exception(
99+
sycl::make_error_code(sycl::errc::runtime),
99100
"Unrecognized key in SYCL_DEVICE_ALLOWLIST. For details, please "
100101
"refer to "
101102
"https://github.com/intel/llvm/blob/sycl/sycl/doc/"
@@ -148,7 +149,8 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
148149
break;
149150
}
150151
if (!ValueIsValid)
151-
throw sycl::exception( sycl::errc::runtime,
152+
throw sycl::exception(
153+
sycl::make_error_code(sycl::errc::runtime),
152154
"Value " + Value + " for key " + Key +
153155
" is not valid in "
154156
"SYCL_DEVICE_ALLOWLIST. For details, please refer to "
@@ -167,7 +169,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
167169
// DeviceVendorId should have hex format
168170
if (!std::regex_match(Value, std::regex("0[xX][0-9a-fA-F]+"))) {
169171
throw sycl::exception(
170-
sycl::errc::runtime,
172+
sycl::make_error_code(sycl::errc::runtime),
171173
"Value " + Value + " for key " + Key +
172174
" is not valid in "
173175
"SYCL_DEVICE_ALLOWLIST. It should have the hex format. For "
@@ -185,7 +187,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
185187
// TODO: can be changed to string_view::starts_with after switching
186188
// DPC++ RT to C++20
187189
if (Prefix != AllowListRaw.substr(ValueStart, Prefix.length())) {
188-
throw sycl::exception(sycl::errc::runtime,
190+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
189191
"Key " + Key +
190192
" of SYCL_DEVICE_ALLOWLIST should have "
191193
"value which starts with " +
@@ -203,7 +205,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
203205
// if it is the last iteration and next 2 symbols are not a postfix,
204206
// throw exception
205207
if (ValueEnd == AllowListRaw.length() - Postfix.length())
206-
throw sycl::exception(sycl::errc::runtime,
208+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
207209
"Key " + Key +
208210
" of SYCL_DEVICE_ALLOWLIST should have "
209211
"value which ends with " +
@@ -217,7 +219,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
217219
DelimiterBtwItemsInDeviceDesc) &&
218220
(AllowListRaw[NextExpectedDelimiterPos] != DelimiterBtwDeviceDescs))
219221
throw sycl::exception(
220-
sycl::errc::runtime,
222+
sycl::make_error_code(sycl::errc::runtime),
221223
"Unexpected symbol on position " +
222224
std::to_string(NextExpectedDelimiterPos) + ": " +
223225
AllowListRaw[NextExpectedDelimiterPos] +
@@ -238,7 +240,7 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw) {
238240
// add key and value to the map
239241
DeviceDescMap.emplace(Key, Value);
240242
} else
241-
throw sycl::exception(sycl::errc::runtime, "Re-definition of key " + Key +
243+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime), "Re-definition of key " + Key +
242244
" is not allowed in "
243245
"SYCL_DEVICE_ALLOWLIST");
244246

sycl/source/detail/event_impl.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,25 @@ event_impl::event_impl(RT::PiEvent Event, const context &SyclContext)
127127
MIsFlushed(true), MState(HES_Complete) {
128128

129129
if (MContext->is_host()) {
130-
throw sycl::exception(sycl::errc::invalid, "The syclContext must match the OpenCL context associated with the clEvent.");
130+
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
131+
"The syclContext must match the OpenCL context "
132+
"associated with the clEvent.");
131133
}
132134

133135
RT::PiContext TempContext;
134136
getPlugin()->call<PiApiKind::piEventGetInfo>(MEvent, PI_EVENT_INFO_CONTEXT,
135137
sizeof(RT::PiContext),
136138
&TempContext, nullptr);
137139
if (MContext->getHandleRef() != TempContext) {
138-
throw sycl::exception(sycl::errc::invalid, "The syclContext must match the OpenCL context associated with the clEvent.");
140+
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
141+
"The syclContext must match the OpenCL context "
142+
"associated with the clEvent.");
139143
}
140144
}
141145

142146
event_impl::event_impl(const QueueImplPtr &Queue)
143-
: MQueue{Queue},
144-
MIsProfilingEnabled{Queue->is_host() || Queue->MIsProfilingEnabled},
147+
: MQueue{Queue}, MIsProfilingEnabled{Queue->is_host() ||
148+
Queue->MIsProfilingEnabled},
145149
MLimitedProfiling{MIsProfilingEnabled && Queue->isProfilingLimited()} {
146150
this->setContextImpl(Queue->getContextImplPtr());
147151

@@ -151,7 +155,7 @@ event_impl::event_impl(const QueueImplPtr &Queue)
151155
if (Queue->has_property<property::queue::enable_profiling>()) {
152156
MHostProfilingInfo.reset(new HostProfilingInfo());
153157
if (!MHostProfilingInfo)
154-
throw sycl::exception(sycl::errc::runtime, "Out of host memory");
158+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime), "Out of host memory");
155159
}
156160
return;
157161
}
@@ -281,7 +285,8 @@ event_impl::get_profiling_info<info::event_profiling::command_start>() {
281285
return 0;
282286
}
283287
if (!MHostProfilingInfo)
284-
throw sycl::exception(0,sycl::errc::invalid, "Profiling info is not available.");
288+
throw sycl::exception(0, sycl::errc::invalid,
289+
"Profiling info is not available.");
285290
return MHostProfilingInfo->getStartTime();
286291
}
287292

@@ -295,7 +300,8 @@ uint64_t event_impl::get_profiling_info<info::event_profiling::command_end>() {
295300
return 0;
296301
}
297302
if (!MHostProfilingInfo)
298-
throw sycl::exception(sycl::errc::invalid, "Profiling info is not available.");
303+
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
304+
"Profiling info is not available.");
299305
return MHostProfilingInfo->getEndTime();
300306
}
301307

sycl/source/detail/scheduler/commands.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,8 @@ AllocaCommandBase *ExecCGCommand::getAllocaForReq(Requirement *Req) {
15261526
if (Dep.MDepRequirement == Req)
15271527
return Dep.MAllocaCmd;
15281528
}
1529-
throw sycl::exception(sycl::errc::runtime,"Alloca for command not found");
1529+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
1530+
"Alloca for command not found");
15301531
}
15311532

15321533
std::vector<std::shared_ptr<const void>>
@@ -2230,7 +2231,7 @@ static pi_result SetKernelParamsAndLaunch(
22302231
case kernel_param_kind_t::kind_specialization_constants_buffer: {
22312232
if (Queue->is_host()) {
22322233
throw sycl::exception(
2233-
sycl::errc::feature_not_supported,
2234+
sycl::make_error_code(sycl::errc::feature_not_supported),
22342235
"SYCL2020 specialization constants are not yet supported on host "
22352236
"device");
22362237
}
@@ -2244,7 +2245,8 @@ static pi_result SetKernelParamsAndLaunch(
22442245
break;
22452246
}
22462247
case kernel_param_kind_t::kind_invalid:
2247-
throw sycl::exception(sycl::errc::runtime, "Invalid kernel param kind");
2248+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2249+
"Invalid kernel param kind");
22482250
break;
22492251
}
22502252
};
@@ -2491,7 +2493,7 @@ pi_int32 ExecCGCommand::enqueueImp() {
24912493
switch (MCommandGroup->getType()) {
24922494

24932495
case CG::CGTYPE::UpdateHost: {
2494-
throw sycl::exception(sycl::errc::runtime,
2496+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
24952497
"Update host should be handled by the Scheduler.");
24962498
}
24972499
case CG::CGTYPE::CopyAccToPtr: {
@@ -2630,12 +2632,12 @@ pi_int32 ExecCGCommand::enqueueImp() {
26302632

26312633
switch (Error) {
26322634
case PI_ERROR_INVALID_OPERATION:
2633-
throw sycl::exception(sycl::errc::runtime,
2634-
"Device doesn't support run_on_host_intel tasks.");
2635+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2636+
"Device doesn't support run_on_host_intel tasks.");
26352637
case PI_SUCCESS:
26362638
return Error;
26372639
default:
2638-
throw sycl::exception(sycl::errc::runtime,
2640+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
26392641
"Enqueueing run_on_host_intel task has failed.");
26402642
}
26412643
}
@@ -2794,7 +2796,8 @@ pi_int32 ExecCGCommand::enqueueImp() {
27942796
break;
27952797
}
27962798
default:
2797-
throw sycl::exception(sycl::errc::runtime, "Unsupported arg type");
2799+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2800+
"Unsupported arg type");
27982801
}
27992802
}
28002803

@@ -2803,7 +2806,8 @@ pi_int32 ExecCGCommand::enqueueImp() {
28032806
if (HostTask->MHostTask->isInteropTask()) {
28042807
// Extract the Mem Objects for all Requirements, to ensure they are
28052808
// available if a user asks for them inside the interop task scope
2806-
const std::vector<Requirement *> &HandlerReq = HostTask->getRequirements();
2809+
const std::vector<Requirement *> &HandlerReq =
2810+
HostTask->getRequirements();
28072811
auto ReqToMemConv = [&ReqToMem, HostTask](Requirement *Req) {
28082812
const std::vector<AllocaCommandBase *> &AllocaCmds =
28092813
Req->MSYCLMemObj->MRecord->MAllocaCommands;
@@ -2822,7 +2826,7 @@ pi_int32 ExecCGCommand::enqueueImp() {
28222826
"Can't get memory object due to no allocation available");
28232827

28242828
throw sycl::exception(
2825-
sycl::errc::runtime,
2829+
sycl::make_error_code(sycl::errc::runtime),
28262830
"Can't get memory object due to no allocation available");
28272831
};
28282832
std::for_each(std::begin(HandlerReq), std::end(HandlerReq), ReqToMemConv);
@@ -2901,7 +2905,8 @@ pi_int32 ExecCGCommand::enqueueImp() {
29012905
typeSize, RawEvents, Event, read);
29022906
}
29032907
case CG::CGTYPE::None:
2904-
throw sycl::exception(sycl::errc::runtime, "CG type not implemented.");
2908+
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2909+
"CG type not implemented.");
29052910
}
29062911
return PI_ERROR_INVALID_OPERATION;
29072912
}

0 commit comments

Comments
 (0)