Skip to content

Implement RFC #1: FIFO spawns#615

Merged
bors[bot] merged 14 commits into
rayon-rs:masterfrom
cuviper:rfc1
Feb 2, 2019
Merged

Implement RFC #1: FIFO spawns#615
bors[bot] merged 14 commits into
rayon-rs:masterfrom
cuviper:rfc1

Conversation

@cuviper

@cuviper cuviper commented Dec 12, 2018

Copy link
Copy Markdown
Member

This implements rayon-rs/rfcs#1, adding spawn_fifo, scope_fifo, and ScopeFifo, and deprecating the breadth_first flag.

Fixes #590.
Closes #601.

@cuviper cuviper requested a review from nikomatsakis December 12, 2018 02:28
@cuviper

cuviper commented Dec 12, 2018

Copy link
Copy Markdown
Member Author

"WIP" only because I still need to add documentation.

Comment thread rayon-core/src/thread_pool/mod.rs Outdated

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo lack of documentation, this seems quite nice.

Comment thread rayon-core/src/scope/mod.rs Outdated
@cuviper cuviper mentioned this pull request Dec 14, 2018

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see docs are still missing -- I didn't read the rebased code closely yet, just leaving these markers so I remember status.

Comment thread rayon-core/src/scope/mod.rs Outdated
Comment thread rayon-core/src/scope/mod.rs Outdated
Comment thread rayon-core/src/spawn/mod.rs Outdated
Comment thread rayon-core/src/thread_pool/mod.rs Outdated
@ghost

ghost commented Jan 11, 2019

Copy link
Copy Markdown

Just an informative "by the way" comment that might be interesting to think about, but doesn't affect this PR much.

Here's a quick comparison of TBB's and Rayon's approach to task scheduling:
https://www.threadingbuildingblocks.org/docs/help/reference/task_scheduler/scheduling_algorithm.html

TBB offers two ways to spawn a task:

  • task.execute() - similar to rayon::spawn() (push into the local LIFO queue)
  • task.enqueue() - similar to rayon::spawn_fifo() (push into the global FIFO queue)

There's also a notion of task arenas, which I suppose is similar to Rayon's scopes.

Another interesting difference is how task stealing works. TBB first attempts to steal from the global FIFO queue and then steals from other workers' LIFO queues. Rayon uses the reverse order. I have a feeling that in this case TBB's strategy might be slightly better.

@cuviper cuviper changed the title [WIP] Implement RFC #1: FIFO spawns Implement RFC #1: FIFO spawns Jan 30, 2019
@cuviper

cuviper commented Jan 30, 2019

Copy link
Copy Markdown
Member Author

Docs are ready for review!

Comment thread rayon-core/src/scope/mod.rs
Comment thread rayon-core/src/scope/mod.rs Outdated
@nikomatsakis

nikomatsakis commented Jan 31, 2019

Copy link
Copy Markdown
Member

r=me with nits fixed

@cuviper

cuviper commented Feb 2, 2019

Copy link
Copy Markdown
Member Author

bors r=nikomatsakis

bors Bot added a commit that referenced this pull request Feb 2, 2019
615: Implement RFC #1: FIFO spawns r=nikomatsakis a=cuviper

This implements rayon-rs/rfcs#1, adding `spawn_fifo`, `scope_fifo`, and `ScopeFifo`, and deprecating the `breadth_first` flag.

Fixes #590.
Closes #601.

Co-authored-by: Josh Stone <cuviper@gmail.com>
@bors

bors Bot commented Feb 2, 2019

Copy link
Copy Markdown
Contributor

@bors bors Bot merged commit 88d6a4e into rayon-rs:master Feb 2, 2019
@cuviper cuviper mentioned this pull request Mar 3, 2019
@cuviper cuviper deleted the rfc1 branch March 11, 2020 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants