Skip to content
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

Synchronization between Cycles scene and primitives #89

Open
dedoardo opened this issue Mar 12, 2021 · 1 comment · May be fixed by #161
Open

Synchronization between Cycles scene and primitives #89

dedoardo opened this issue Mar 12, 2021 · 1 comment · May be fixed by #161
Assignees
Labels
enhancement New feature or request in discussion Still requires a discussion

Comments

@dedoardo
Copy link
Contributor

dedoardo commented Mar 12, 2021

Currently, each primitive locks the scene mutex during the Sync method to write new values, making primitive syncing pretty much sequential. I can think of two ways to optimize it:

  1. Minimize the time spent in the lock for each primitive. Instead of reading, processing and writing the primitive data inside the lock, we could separate the reading/processing to be thread free and lock only when updating the Cycles geometry buffers.
  2. Provide further synchronization mechanism to guarantee that committing resources to the device has finished before new primitives are being synced.

The former seems to most reasonable solution, there are lots of edge cases for 2., especially when running on top of "opaque" execution engine.

To provide evidence of the problem... Scrolling quickly through the usdview timeline without scene locks for each primitive Sync can result in the previous frame still committing resources (as it runs in a separate session thread) while new primitives are being synced causing data races and exceptions during Session::update_scene .

It's not something of the highest priority, but we should probably look to start the discussion.

@dedoardo dedoardo added the in discussion Still requires a discussion label Mar 12, 2021
@dedoardo dedoardo changed the title Synchronization between Cycles scenes and primitives Synchronization between Cycles scene and primitives Mar 12, 2021
@bareya bareya added this to High priority in HdCycles Development Mar 23, 2021
@bareya bareya self-assigned this Mar 23, 2021
@bareya bareya added the enhancement New feature or request label Mar 23, 2021
@bareya bareya moved this from High priority to In Progress in HdCycles Development Mar 23, 2021
@bareya bareya added this to the 0.9.2 milestone Mar 23, 2021
@bareya
Copy link
Collaborator

bareya commented Apr 19, 2021

Some of the work I made for #135 is to move us closer to solve synchronization issues. In that #135 PR we have a resource registry that should be a centralized place to commit all necessary resources to Cycles.

@bareya bareya moved this from In Progress to High priority in HdCycles Development Apr 28, 2021
@bareya bareya removed this from High priority in HdCycles Development May 3, 2021
@bareya bareya added this to Needs triage in HdBlackbird Development via automation May 3, 2021
This was linked to pull requests May 3, 2021
@bareya bareya moved this from Needs triage to In Progress in HdBlackbird Development May 4, 2021
@bareya bareya removed this from the 0.9.2 milestone May 4, 2021
@bareya bareya removed a link to a pull request May 4, 2021
@bareya bareya linked a pull request May 4, 2021 that will close this issue
@bareya bareya removed a link to a pull request May 5, 2021
@bareya bareya moved this from In Progress to Waiting For Feedback in HdBlackbird Development May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in discussion Still requires a discussion
Projects
HdBlackbird Development
Waiting For Feedback
Development

Successfully merging a pull request may close this issue.

2 participants