[Bf-blender-cvs] [3a1eac013bf] cycles-x: Cycles X: Tweak max number of states seen by tile scheduler
Sergey Sharybin
noreply at git.blender.org
Thu Jul 15 17:15:01 CEST 2021
Commit: 3a1eac013bf8e1bf9ec5dffa2ba3fe8f95bb0fb1
Author: Sergey Sharybin
Date: Thu Jul 15 10:51:13 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB3a1eac013bf8e1bf9ec5dffa2ba3fe8f95bb0fb1
Cycles X: Tweak max number of states seen by tile scheduler
This is required for shadow catchers to make it so the tile scheduler
gives work which can fir into the number of allowed camera rays. Use
a smaller value from the maximum number of states to prepare code for
state compaction of re-scheduling for the shadow catcher.
Interestingly, this has positive effect on regular rendering here with
RTX 5000:
```
new cycles-x
bmw27.blend 12.445 12.2104
classroom.blend 24.4949 24.4508
pabellon.blend 11.3019 11.4407
monster.blend 13.409 13.4491
barbershop_interior.blend 18.6601 18.8364
junkshop.blend 26.3212 27.051
pvt_flat.blend 22.7389 22.9345
```
For the future development we might try to make it so tile scheduler
gives smaller tiles with smaller number of samples, rely on the path
work GPU to request as many tiles as fit into the path states. Need
to be careful though, because there are downsides in terms of memory
bandwidth to pass works tiles to the init_from kernels.
===================================================================
M intern/cycles/integrator/path_trace_work_gpu.cpp
M intern/cycles/integrator/work_tile_scheduler.cpp
M intern/cycles/integrator/work_tile_scheduler.h
===================================================================
diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp
index 66518172f47..e9aacb58dd8 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -166,9 +166,7 @@ void PathTraceWorkGPU::init_execution()
void PathTraceWorkGPU::render_samples(int start_sample, int samples_num)
{
- /* Update number of available states based on the updated content of the scene (shadow catcher
- * object might have been added or removed). */
- work_tile_scheduler_.set_max_num_path_states(get_max_num_camera_paths());
+ work_tile_scheduler_.set_max_num_path_states(max_num_paths_ / 8);
work_tile_scheduler_.reset(effective_buffer_params_, start_sample, samples_num);
diff --git a/intern/cycles/integrator/work_tile_scheduler.cpp b/intern/cycles/integrator/work_tile_scheduler.cpp
index 4d5eeb9da20..3fc99d5b74d 100644
--- a/intern/cycles/integrator/work_tile_scheduler.cpp
+++ b/intern/cycles/integrator/work_tile_scheduler.cpp
@@ -80,8 +80,13 @@ void WorkTileScheduler::reset_scheduler_state()
bool WorkTileScheduler::get_work(KernelWorkTile *work_tile_, const int max_work_size)
{
+ /* Note that the `max_work_size` can be higher than the `max_num_path_states_`: this is because
+ * the path trace work can decice to use smaller tile sizes and greedily schedule multiple tiles,
+ * improving overall device occupancy.
+ * So the `max_num_path_states_` is a "scheduling unit", and the `max_work_size` is a "scheduling
+ * limit". */
+
DCHECK_NE(max_num_path_states_, 0);
- DCHECK_LE(max_work_size, max_num_path_states_);
const int work_index = atomic_fetch_and_add_int32(&next_work_index_, 1);
if (work_index >= total_work_size_) {
diff --git a/intern/cycles/integrator/work_tile_scheduler.h b/intern/cycles/integrator/work_tile_scheduler.h
index 1c70f4554bc..e4c8f701259 100644
--- a/intern/cycles/integrator/work_tile_scheduler.h
+++ b/intern/cycles/integrator/work_tile_scheduler.h
@@ -31,10 +31,10 @@ class WorkTileScheduler {
public:
WorkTileScheduler();
- /* MAximum path states which are allowed to be used by the scheduled work.
+ /* MAximum path states which are allowed to be used by a single scheduled work tile.
*
- * Affects the scheduled work size: the work size will
- * be as big as possible, but will not exceed this number of states to be performed. */
+ * Affects the scheduled work size: the work size will be as big as possible, but will not exceed
+ * this number of states. */
void set_max_num_path_states(int max_num_path_states);
/* Scheduling will happen for pixels within a big tile denotes by its parameters. */
More information about the Bf-blender-cvs
mailing list