Skip to content

Commit 02cd540

Browse files
author
Alexander Khokhlov
committed
code review
1 parent 75a6990 commit 02cd540

File tree

3 files changed

+40
-38
lines changed

3 files changed

+40
-38
lines changed

CLW/CL/CLW.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,8 @@ __kernel void segmented_distribute_part_sum_int_nocut(
15131513
#define DEFINE_ATOMIC(operation)\
15141514
__attribute__((always_inline)) void atomic_##operation##_float(volatile __global float* addr, float value)\
15151515
{\
1516-
union{\
1516+
union\
1517+
{\
15171518
unsigned int u32;\
15181519
float f32;\
15191520
} next, expected, current;\
@@ -1549,7 +1550,7 @@ __attribute__((always_inline)) void atomic_min_int(volatile __global int* addr,
15491550
// --------------------- REDUCTION ------------------------
15501551

15511552
#define DEFINE_REDUCTION(bin_op, type)\
1552-
__kernel void reduction_##bin_op##_##type(__global type* buffer,\
1553+
__kernel void reduction_##bin_op##_##type(const __global type* buffer,\
15531554
int count,\
15541555
__local type* shared_mem,\
15551556
__global type* out,\
@@ -1577,10 +1578,10 @@ __kernel void reduction_##bin_op##_##type(__global type* buffer,\
15771578
// --------------------- NORMALIZATION ------------------------
15781579

15791580
#define DEFINE_BUFFER_NORMALIZATION(type)\
1580-
__kernel void buffer_normalization_##type(__global type* input,\
1581+
__kernel void buffer_normalization_##type(const __global type* input,\
15811582
__global type* output,\
15821583
int count,\
1583-
__global type* storage)\
1584+
const __global type* storage)\
15841585
{\
15851586
type norm_coef = storage[0] - storage[1];\
15861587
int global_id = get_global_id(0);\

CLW/CLWParallelPrimitives.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,39 +1047,39 @@ CLWEvent CLWParallelPrimitives::Normalize(const char* normalizeKernelName,
10471047
return context_.Launch1D(deviceIdx, NUM_BLOCKS * WG_SIZE, WG_SIZE, normalizeKernel);
10481048
}
10491049

1050-
//CLWEvent CLWParallelPrimitives::Normalize(unsigned int deviceIdx, CLWBuffer<cl_int> input, CLWBuffer<cl_int> output, int numElems)
1051-
//{
1052-
// CLWBuffer<cl_int> cache = GetTempIntBuffer(2);
1053-
//
1054-
// CLWEvent event = Normalize("buffer_normalization_int",
1055-
// "reduction_min_int",
1056-
// "reduction_max_int",
1057-
// deviceIdx,
1058-
// input,
1059-
// output,
1060-
// numElems,
1061-
// cache);
1062-
//
1063-
// ReclaimTempIntBuffer(cache);
1064-
// return event;
1065-
//}
1066-
//
1067-
//CLWEvent CLWParallelPrimitives::Normalize(unsigned int deviceIdx, CLWBuffer<cl_float> input, CLWBuffer<cl_float> output, int numElems)
1068-
//{
1069-
// CLWBuffer<cl_float> cache = GetTempFloatBuffer(2);
1070-
//
1071-
// CLWEvent event = Normalize("buffer_normalization_float",
1072-
// "reduction_min_float",
1073-
// "reduction_max_float",
1074-
// deviceIdx,
1075-
// input,
1076-
// output,
1077-
// numElems,
1078-
// cache);
1079-
//
1080-
// ReclaimTempFloatBuffer(cache);
1081-
// return event;
1082-
//}
1050+
CLWEvent CLWParallelPrimitives::Normalize(unsigned int deviceIdx, CLWBuffer<cl_int> input, CLWBuffer<cl_int> output, int numElems)
1051+
{
1052+
CLWBuffer<cl_int> cache = GetTempIntBuffer(2);
1053+
1054+
CLWEvent event = Normalize("buffer_normalization_int",
1055+
"reduction_min_int",
1056+
"reduction_max_int",
1057+
deviceIdx,
1058+
input,
1059+
output,
1060+
numElems,
1061+
cache);
1062+
1063+
ReclaimTempIntBuffer(cache);
1064+
return event;
1065+
}
1066+
1067+
CLWEvent CLWParallelPrimitives::Normalize(unsigned int deviceIdx, CLWBuffer<cl_float> input, CLWBuffer<cl_float> output, int numElems)
1068+
{
1069+
CLWBuffer<cl_float> cache = GetTempFloatBuffer(2);
1070+
1071+
CLWEvent event = Normalize("buffer_normalization_float",
1072+
"reduction_min_float",
1073+
"reduction_max_float",
1074+
deviceIdx,
1075+
input,
1076+
output,
1077+
numElems,
1078+
cache);
1079+
1080+
ReclaimTempFloatBuffer(cache);
1081+
return event;
1082+
}
10831083

10841084
CLWEvent CLWParallelPrimitives::Normalize(unsigned int deviceIdx, CLWBuffer<cl_float3> input, CLWBuffer<cl_float3> output, int numElems)
10851085
{

RadeonRays/src/async/thread_pool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ THE SOFTWARE.
2929
#include <atomic>
3030
#include <future>
3131
#include <iostream>
32+
#include <algorithm>
3233

3334
namespace RadeonRays
3435
{
@@ -66,7 +67,7 @@ namespace RadeonRays
6667
{
6768
std::unique_lock<std::mutex> lock(mutex_);
6869
cv_.wait(lock, [this](){return !queue_.empty();});
69-
t = queue_.front();
70+
t = std::move(queue_.front());
7071
queue_.pop();
7172
}
7273

0 commit comments

Comments
 (0)