Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions runtime/kernel/thread_parallel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ inline bool parallel_for_no_threadpool(
begin,
end);
ET_CHECK_OR_RETURN_FALSE(grain_size > 0, "grain_size = %" PRId64, grain_size);
// An empty range runs no work items, so the callback is not invoked. Checked
// here rather than only in the release branch below: the debug branch skips
// it as a side effect of iterating an empty range, and relying on that made
// the two branches disagree.
if (begin == end) {
return true;
}
#ifndef NDEBUG
// Go backwards through the range elementwise to catch code that
// assumes parallel_for is in order like a regular for loop.
Expand Down
Loading