-
Notifications
You must be signed in to change notification settings - Fork 301
handle deadlocks/blocked tasks in parallel reconstruction #7800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unstable
Are you sure you want to change the base?
Conversation
beacon_chain/nimbus_beacon_node.nim
Outdated
| if true: | ||
| return | ||
| # # Currently, this logic is broken | ||
| # if true: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just remove this if entirely, rather than commenting it out.
| localIndices[j] = idxArr[j] | ||
| localCells[j] = cellsArr[j] | ||
| # use the task wrapper which maps string errors to void | ||
| recoverCellsAndKzgProofsTask(localIndices, localCells) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need for this seq as far as I can tell - just change the argument type of ...Task to openArray, then use idxArr.toOpenArray(0, columnCount - 1)
|
|
||
| var | ||
| pendingFuts: seq[Flowvar[Result[CellsAndProofs, void]]] | ||
| pendingFuts: seq[Flowvar[Result[CellsAndProofs, void]]] = @[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The = @[] doesn't do anything here.
| pendingFuts: seq[Flowvar[Result[CellsAndProofs, void]]] = @[] | ||
| # Store actual data sequences instead of C pointers | ||
| pendingIndices: seq[seq[CellIndex]] = @[] | ||
| pendingCells: seq[seq[Cell]] = @[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise either of these places. https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement
Variables are always initialized with a default value if there is no initializing expression. The default
value depends on the type and is always a zero in binary.
where for a sequence, this default is documented to be @[].
| # pre-size sequences so we can index-assign without reallocs | ||
| pendingFuts.setLen(blobCount) | ||
| pendingIndices.setLen(blobCount) | ||
| pendingCells.setLen(blobCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are going to be setLen'd immediately, why not newSeq[Flowvar[Result[CellsAndProofs, void]]](blobCount) (respectively, each seq type) them to begin with?
|
|
||
| for i in 0 ..< dataColumns.len: | ||
| cellIndices[i] = dataColumns[i][].index | ||
| indices[i] = dataColumns[i][].index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The redundant/indirect assignment/copying via indices and cells is fairly expensive. Can directly ensure that pendingIndices[spawned] and pendingCells[spawned] are the right side, the have this loop assign into pendingIndices[spawned] item by item directly (respectively, pendingCells[spawned])
Can also use addr pendingIndices[spawned]/addr pendingCells[spawned] can avoid dataColumns.len lookups/bound checks/etc and allow only dereferencing two pointers each loop iteration to do so, basically caching the address of each seq item.
No description provided.