diff --git a/sycl/source/detail/error_handling/enqueue_kernel.cpp b/sycl/source/detail/error_handling/enqueue_kernel.cpp index ab846466161ca..a0fddcae908e0 100644 --- a/sycl/source/detail/error_handling/enqueue_kernel.cpp +++ b/sycl/source/detail/error_handling/enqueue_kernel.cpp @@ -83,8 +83,14 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel, NDRDesc.LocalSize[1] != CompileWGSize[1] || NDRDesc.LocalSize[2] != CompileWGSize[2]) throw sycl::nd_range_error( - "Specified local size doesn't match the required work-group size " - "specified in the program source", + "The specified local size {" + std::to_string(NDRDesc.LocalSize[0]) + + ", " + std::to_string(NDRDesc.LocalSize[1]) + ", " + + std::to_string(NDRDesc.LocalSize[2]) + + "} doesn't match the required work-group size specified " + "in the program source {" + + std::to_string(CompileWGSize[0]) + ", " + + std::to_string(CompileWGSize[1]) + ", " + + std::to_string(CompileWGSize[2]) + "}", PI_INVALID_WORK_GROUP_SIZE); } if (IsOpenCL) { @@ -185,11 +191,22 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel, Opts.find("-cl-std=CL2.0") != string_class::npos; const bool RequiresUniformWGSize = Opts.find("-cl-uniform-work-group-size") != string_class::npos; + std::string LocalWGSize = std::to_string(NDRDesc.LocalSize[0]) + + ", " + + std::to_string(NDRDesc.LocalSize[1]) + + ", " + std::to_string(NDRDesc.LocalSize[2]); + std::string GlobalWGSize = + std::to_string(NDRDesc.GlobalSize[0]) + ", " + + std::to_string(NDRDesc.GlobalSize[1]) + ", " + + std::to_string(NDRDesc.GlobalSize[2]); std::string message = LocalExceedsGlobal - ? "Local workgroup size greater than global range size. " - : "Global_work_size not evenly divisible by " - "local_work_size. "; + ? "Local work-group size {" + LocalWGSize + + "} is greater than global range size {" + GlobalWGSize + + "}. " + : "Global work size {" + GlobalWGSize + + "} is not evenly divisible by local work-group size {" + + LocalWGSize + "}. "; if (!HasStd20) throw sycl::nd_range_error( message.append( diff --git a/sycl/test/on-device/basic_tests/parallel_for_range.cpp b/sycl/test/on-device/basic_tests/parallel_for_range.cpp index c03c30ba28f2c..eee2e2ddf61a5 100644 --- a/sycl/test/on-device/basic_tests/parallel_for_range.cpp +++ b/sycl/test/on-device/basic_tests/parallel_for_range.cpp @@ -57,10 +57,10 @@ int main() { "thrown\n"; return 1; // We shouldn't be here, exception is expected } catch (nd_range_error &E) { - if (string_class(E.what()).find("Specified local size doesn't match " - "the required work-group size " - "specified in the program source") == - string_class::npos) { + if (string_class(E.what()).find("The specified local size {8, 8, 8} " + "doesn't match the required work-group " + "size specified in the program source " + "{4, 4, 4}") == string_class::npos) { std::cerr << "Test case ReqdWGSizeNegativeA failed: unexpected exception: " << E.what() << std::endl; @@ -670,7 +670,8 @@ int main() { } } catch (nd_range_error &E) { if (string_class(E.what()).find( - "Global_work_size not evenly divisible by local_work_size. " + "Global work size {100, 1, 1} is not evenly divisible " + "by local work-group size {3, 1, 1}. " "Non-uniform work-groups are not allowed by when " "-cl-uniform-work-group-size flag is used. Underlying " "OpenCL 2.x implementation supports this feature, but it is " @@ -720,7 +721,8 @@ int main() { } } catch (nd_range_error &E) { if (string_class(E.what()).find( - "Global_work_size not evenly divisible by local_work_size. " + "Global work size {16, 33, 100} is not evenly divisible by " + "local work-group size {5, 3, 2}. " "Non-uniform work-groups are not allowed by when " "-cl-uniform-work-group-size flag is used. Underlying " "OpenCL 2.x implementation supports this feature, but it is " @@ -773,7 +775,8 @@ int main() { } } catch (nd_range_error &E) { if (string_class(E.what()).find( - "Local workgroup size greater than global range size. " + "Local work-group size {17, 1, 1} is greater than global range " + "size {16, 1, 1}. " "Non-uniform work-groups are not allowed by when " "-cl-uniform-work-group-size flag is used. Underlying " "OpenCL 2.x implementation supports this feature, but it is " @@ -824,7 +827,8 @@ int main() { } } catch (nd_range_error &E) { if (string_class(E.what()).find( - "Local workgroup size greater than global range size. " + "Local work-group size {7, 2, 2} is greater than global range " + "size {6, 6, 6}. " "Non-uniform work-groups are not allowed by when " "-cl-uniform-work-group-size flag is used. Underlying " "OpenCL 2.x implementation supports this feature, but it is " diff --git a/sycl/test/on-device/basic_tests/reqd_work_group_size.cpp b/sycl/test/on-device/basic_tests/reqd_work_group_size.cpp index a447b2f078c9e..b904fe2ba616c 100644 --- a/sycl/test/on-device/basic_tests/reqd_work_group_size.cpp +++ b/sycl/test/on-device/basic_tests/reqd_work_group_size.cpp @@ -99,8 +99,9 @@ int main() { return 1; // We shouldn't be here, exception is expected } catch (nd_range_error &E) { if (string_class(E.what()).find( - "Specified local size doesn't match the required work-group size " - "specified in the program source") == string_class::npos) { + "The specified local size {8, 8, 8} doesn't match the required " + "work-group size specified in the program source {4, 4, 4}") == + string_class::npos) { std::cerr << "Test case ReqdWGSizeNegativeA failed: unexpected nd_range_error " "exception: "