From bd2e3bb7bd06bcbb2134e4853a72ab28f5f332b9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 18 Nov 2021 00:41:04 +0100 Subject: Fix T93045: Cycles HIP not rendering OpenVDB volumes Build HIP kernels with NanoVDB, and patch NanoVDB to work with HIP. This is a header only library so no rebuild is needed. The changes are being submitted upstream to openvdb, so this patch should be temporary. Thanks Thomas for help testing this. --- intern/cycles/kernel/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'intern') diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 29ff69df864..1a254f5eddc 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -565,6 +565,12 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP) set(name ${name}_experimental) endif() + if(WITH_NANOVDB) + set(hip_flags ${hip_flags} + -D WITH_NANOVDB + -I "${NANOVDB_INCLUDE_DIR}") + endif() + if(WITH_CYCLES_DEBUG) set(hip_flags ${hip_flags} -D __KERNEL_DEBUG__) endif() -- cgit v1.2.3 From 3ad2bf1327cac5f036d763e1cc690b1b2da8e1c4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 18 Nov 2021 11:25:39 +0100 Subject: Cycles: Fix command line render overshooting time limit The calculation based on preserving device occupancy was conflicting with the fact that time limit needs to render less samples at the last round of render work. For example, rendering BMW27 for 30sec on i9-11900k was actually rendering for almost a minute. Now the render time limit is respected much more close. Differential Revision: https://developer.blender.org/D13269 --- intern/cycles/integrator/render_scheduler.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'intern') diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index f776d01ef67..276453f7aec 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -827,6 +827,26 @@ int RenderScheduler::get_num_samples_to_path_trace() const num_samples_to_occupy = lround(state_.occupancy_num_samples * 0.7f / state_.occupancy); } + /* When time limit is used clamp the calculated number of samples to keep occupancy. + * This is because time limit causes the last render iteration to happen with less number of + * samples, which conflicts with the occupancy (lower number of samples causes lower + * occupancy, also the calculation is based on number of previously rendered samples). + * + * When time limit is not used the number of samples per render iteration is either increasing + * or stays the same, so there is no need to clamp number of samples calculated for occupancy. + */ + if (time_limit_ && state_.start_render_time) { + const double remaining_render_time = max( + 0.0, time_limit_ - (time_dt() - state_.start_render_time)); + const double time_per_sample_average = path_trace_time_.get_average(); + const double predicted_render_time = num_samples_to_occupy * time_per_sample_average; + + if (predicted_render_time > remaining_render_time) { + num_samples_to_occupy = lround(num_samples_to_occupy * + (remaining_render_time / predicted_render_time)); + } + } + num_samples_to_render = max(num_samples_to_render, min(num_samples_to_occupy, max_num_samples_to_render)); } -- cgit v1.2.3 From f71813204c405821bb2efb8e4ad65d240d390eaf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 12 Nov 2021 16:12:05 +0100 Subject: Cycles: Don't tile if image area fits into tile area Previously the check was done based on dimension of image and if any of dimensions were larger than tile size tiling was used. This change makes it so that if image does not exceed number of pixels in the tile no tile will be used. Allows to render widescreen images without tiling. Differential Revision: https://developer.blender.org/D13206 --- intern/cycles/session/session.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'intern') diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp index 65c46d0dd3c..530baa8cafb 100644 --- a/intern/cycles/session/session.cpp +++ b/intern/cycles/session/session.cpp @@ -367,14 +367,26 @@ void Session::draw() int2 Session::get_effective_tile_size() const { + const int image_width = buffer_params_.width; + const int image_height = buffer_params_.height; + /* No support yet for baking with tiles. */ if (!params.use_auto_tile || scene->bake_manager->get_baking()) { - return make_int2(buffer_params_.width, buffer_params_.height); + return make_int2(image_width, image_height); } - /* TODO(sergey): Take available memory into account, and if there is enough memory do not tile - * and prefer optimal performance. */ + const int64_t image_area = static_cast(image_width) * image_height; + + /* TODO(sergey): Take available memory into account, and if there is enough memory do not + * tile and prefer optimal performance. */ + const int tile_size = tile_manager_.compute_render_tile_size(params.tile_size); + const int64_t actual_tile_area = static_cast(tile_size) * tile_size; + + if (actual_tile_area >= image_area) { + return make_int2(image_width, image_height); + } + return make_int2(tile_size, tile_size); } -- cgit v1.2.3