Skip to content

Commit ff11594

Browse files
committed
[SYCL] Make the nd_range error message a bit more informative
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent f2a91b3 commit ff11594

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

sycl/source/detail/error_handling/enqueue_kernel.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,15 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
8383
NDRDesc.LocalSize[1] != CompileWGSize[1] ||
8484
NDRDesc.LocalSize[2] != CompileWGSize[2])
8585
throw sycl::nd_range_error(
86-
"Specified local size doesn't match the required work-group size "
87-
"specified in the program source",
86+
"The specified local size {" +
87+
std::to_string(NDRDesc.LocalSize[0]) + ", " +
88+
std::to_string(NDRDesc.LocalSize[1]) + ", " +
89+
std::to_string(NDRDesc.LocalSize[2]) +
90+
"} doesn't match the required work-group size specified "
91+
"in the program source {" +
92+
std::to_string(CompileWGSize[0]) + ", " +
93+
std::to_string(CompileWGSize[1]) + ", " +
94+
std::to_string(CompileWGSize[2]) + "}",
8895
PI_INVALID_WORK_GROUP_SIZE);
8996
}
9097
if (IsOpenCL) {
@@ -185,11 +192,21 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
185192
Opts.find("-cl-std=CL2.0") != string_class::npos;
186193
const bool RequiresUniformWGSize =
187194
Opts.find("-cl-uniform-work-group-size") != string_class::npos;
195+
std::string LocalWGSize =
196+
std::to_string(NDRDesc.LocalSize[0]) + ", " +
197+
std::to_string(NDRDesc.LocalSize[1]) + ", " +
198+
std::to_string(NDRDesc.LocalSize[2]);
199+
std::string GlobalWGSize =
200+
std::to_string(NDRDesc.GlobalSize[0]) + ", " +
201+
std::to_string(NDRDesc.GlobalSize[1]) + ", " +
202+
std::to_string(NDRDesc.GlobalSize[2]);
188203
std::string message =
189204
LocalExceedsGlobal
190-
? "Local workgroup size greater than global range size. "
191-
: "Global_work_size not evenly divisible by "
192-
"local_work_size. ";
205+
? "Local workgroup size {" + LocalWGSize +
206+
"} is greater than global range size {" + GlobalWGSize + "}"
207+
: "Global work size {" + GlobalWGSize +
208+
"} is not evenly divisible by localgroup size {" +
209+
LocalWGSize + "}";
193210
if (!HasStd20)
194211
throw sycl::nd_range_error(
195212
message.append(

0 commit comments

Comments
 (0)