[Bf-blender-cvs] [ae8afae8a2] cycles_split_kernel: Cycles: Round global size down rather than up to avoid setting too large

Mai Lavelle noreply at git.blender.org
Wed Feb 22 13:21:27 CET 2017


Commit: ae8afae8a27013aaa121f26232fa44d746c19f83
Author: Mai Lavelle
Date:   Wed Feb 22 07:17:04 2017 -0500
Branches: cycles_split_kernel
https://developer.blender.org/rBae8afae8a27013aaa121f26232fa44d746c19f83

Cycles: Round global size down rather than up to avoid setting too large

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

M	intern/cycles/device/opencl/opencl_split.cpp
M	intern/cycles/util/util_types.h

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

diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index 7c327ccaac..7e04c6fac2 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -307,7 +307,7 @@ public:
 		        << string_human_readable_size(max_buffer_size) << ").";
 
 		size_t num_elements = max_elements_for_max_buffer_size(max_buffer_size / 2, task->passes_size);
-		int2 global_size = make_int2(round_up((int)sqrt(num_elements), 64), (int)sqrt(num_elements));
+		int2 global_size = make_int2(round_down((int)sqrt(num_elements), 64), (int)sqrt(num_elements));
 		VLOG(1) << "Global size: " << global_size << ".";
 		return global_size;
 	}
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index f91b6f6989..36d2f1053c 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -484,6 +484,11 @@ ccl_device_inline int round_up(int x, int multiple)
 	return ((x + multiple - 1) / multiple) * multiple;
 }
 
+ccl_device_inline int round_down(int x, int multiple)
+{
+	return (x / multiple) * multiple;
+}
+
 /* Interpolation types for textures
  * cuda also use texture space to store other objects */
 enum InterpolationType {




More information about the Bf-blender-cvs mailing list