Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-10-20 21:40:32 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-10-21 14:08:10 +0300
commit39810b3f5163cb934c87db4e623b2ae41901cef3 (patch)
treec8d90317585faf306e8dca556441e31933dca853 /intern/cycles/device/hip/queue.cpp
parent6ef8c9e6461456354c5e6b95a1d5cc7176723fe0 (diff)
Cleanup: make HIP and CUDA code more consistent
Ref D12834
Diffstat (limited to 'intern/cycles/device/hip/queue.cpp')
-rw-r--r--intern/cycles/device/hip/queue.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/intern/cycles/device/hip/queue.cpp b/intern/cycles/device/hip/queue.cpp
index 6cb29670f94..a612f59fb32 100644
--- a/intern/cycles/device/hip/queue.cpp
+++ b/intern/cycles/device/hip/queue.cpp
@@ -41,22 +41,19 @@ HIPDeviceQueue::~HIPDeviceQueue()
int HIPDeviceQueue::num_concurrent_states(const size_t state_size) const
{
- int num_states = 0;
const int max_num_threads = hip_device_->get_num_multiprocessors() *
hip_device_->get_max_num_threads_per_multiprocessor();
- if (max_num_threads == 0) {
- num_states = 1048576; // 65536 * 16
- }
- else {
- num_states = max_num_threads * 16;
- }
+ int num_states = ((max_num_threads == 0) ? 65536 : max_num_threads) * 16;
const char *factor_str = getenv("CYCLES_CONCURRENT_STATES_FACTOR");
if (factor_str) {
- float factor = (float)atof(factor_str);
- if (!factor)
+ const float factor = (float)atof(factor_str);
+ if (factor != 0.0f) {
+ num_states = max((int)(num_states * factor), 1024);
+ }
+ else {
VLOG(3) << "CYCLES_CONCURRENT_STATES_FACTOR evaluated to 0";
- num_states = max((int)(num_states * factor), 1024);
+ }
}
VLOG(3) << "GPU queue concurrent states: " << num_states << ", using up to "