19447, "vasslitvinov", "Semantics of errors thrown in tasks and nested tasks", "2022-03-14T23:40:18Z"
Background: According to the spec and #7046, errors thrown by individual tasks of a forall/coforall/... are collated into a single TaskErrors
error. If there are nested TaskErrors errors, their contents are flattened into the parent.
This issue asks what happens when multiple tasks of the same forall or task-parallel construct throw errors. For example:
(all) All tasks that need to generate an error do so. Throwing an error in one task does not affect the other tasks. For example, if none of these tasks generate TaskErrors, the number of elements in the TaskErrors error generated by the forall/task-parallel construct equals the number of its tasks.
(some) Out of all tasks that need to generate an error, the TaskErrors error of the enclosing forall/task-parallel construct contains at least one and at most all such errors.
Consider the following two programs:
// a simple version
proc main throws {
coforall x in 1..2 do
coforall z in 1..3 do
throw new Error("hi");
}
// the same task structure created with parallel iterators
proc main throws {
forall idx in outerIter() do
throw new Error("hi");
}
iter outerIter(param tag) { // standalone iterator
coforall x in 1..2 do
forall y in innerIter() do
yield 0;
}
iter innerIter(param tag) { // standalone iterator
coforall z in 1..3 do
yield 0;
}
iter outerIter() { yield 0; } // unused serial iterator
iter innerIter() { yield 0; } // unused serial iterator
(all): both programs produce exactly 6 "hi" errors in the TaskErrors error that gets thrown out of main.
(some): each program can produce anywhere from 1 to 6 "hi" errors.