Skip to content

Reclaim register in for_each #40

Description

@jaredhoberock

We require an extra register in for_each because we maintain both the current agent index, i, as well as the parameter, first.

Each agent increments first by its index to find its iterator. That means if parallel agents happen to be implemented in sequence, then over the course of the sequential loop, we have to remember the value of the first parameter even though the next agent that gets scheduled in sequence could have gotten its value of first from the previous agent.

We could reclaim the register by explicitly targeting a par(seq) nesting instead of flat par. The idea would be for each parallel agent to find its index and then call for_each(seq, first + offset, last, f). offset would be something like i * grainsize.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions