[Bf-blender-cvs] [a184d0dd023] master: Cleanup: fix outdated comment and use of atomics

Brecht Van Lommel noreply at git.blender.org
Mon Oct 18 19:03:54 CEST 2021


Commit: a184d0dd023cc0b6fee5e02510addb91d66f8e01
Author: Brecht Van Lommel
Date:   Mon Oct 18 18:19:01 2021 +0200
Branches: master
https://developer.blender.org/rBa184d0dd023cc0b6fee5e02510addb91d66f8e01

Cleanup: fix outdated comment and use of atomics

This is only used by a single device, not need for thread safety.

===================================================================

M	intern/cycles/integrator/work_tile_scheduler.cpp

===================================================================

diff --git a/intern/cycles/integrator/work_tile_scheduler.cpp b/intern/cycles/integrator/work_tile_scheduler.cpp
index e6ada2f46ee..234b1fae915 100644
--- a/intern/cycles/integrator/work_tile_scheduler.cpp
+++ b/intern/cycles/integrator/work_tile_scheduler.cpp
@@ -88,7 +88,7 @@ bool WorkTileScheduler::get_work(KernelWorkTile *work_tile_, const int max_work_
 
   DCHECK_NE(max_num_path_states_, 0);
 
-  const int work_index = atomic_fetch_and_add_int32(&next_work_index_, 1);
+  const int work_index = next_work_index_++;
   if (work_index >= total_work_size_) {
     return false;
   }
@@ -121,12 +121,8 @@ bool WorkTileScheduler::get_work(KernelWorkTile *work_tile_, const int max_work_
 
   if (max_work_size && tile_work_size > max_work_size) {
     /* The work did not fit into the requested limit of the work size. Unschedule the tile,
-     * allowing others (or ourselves later one) to pick it up.
-     *
-     * TODO: Such temporary decrement is not ideal, since it might lead to situation when another
-     * device sees there is nothing to be done, finishing its work and leaving all work to be
-     * done by us. */
-    atomic_fetch_and_add_int32(&next_work_index_, -1);
+     * so it can be picked up again later. */
+    next_work_index_--;
     return false;
   }



More information about the Bf-blender-cvs mailing list