Cleanup: fix outdated comment and use of atomics

This is only used by a single device, not need for thread safety.
This commit is contained in:
Brecht Van Lommel
2021-10-18 18:19:01 +02:00
parent fc4b1fede3
commit a184d0dd02

View File

@@ -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;
}