diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index aa349c90a6f33..e39e83d1892d0 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -543,6 +543,9 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind, int SizeInBytes = LAcc->MElemSize; for (int I = 0; I < Dims; ++I) SizeInBytes *= Size[I]; + // Some backends do not accept zero-sized local memory arguments, so we + // make it a minimum allocation of 1 byte. + SizeInBytes = std::max(SizeInBytes, 1); MArgs.emplace_back(kernel_param_kind_t::kind_std_layout, nullptr, SizeInBytes, Index + IndexShift); if (!IsKernelCreatedFromSource) {