MCPcopy Create free account
hub / github.com/RenderKit/oidn / operator ()

Function operator ()

devices/gpu/gpu_input_process.h:82–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 oidn_device_inline void operator ()(const oidn_private WorkGroupItem<2>& it) const
83 {
84 const int hDst = it.getGlobalID<0>();
85 const int wDst = it.getGlobalID<1>();
86
87 const int h = hDst - tile.hDstBegin;
88 const int w = wDst - tile.wDstBegin;
89
90 // Gather and process the input channel values
91 float values[dstPaddedC] = {}; // = 0
92
93 if (h >= 0 && h < tile.H && w >= 0 && w < tile.W)
94 {
95 const int hSrc = h + tile.hSrcBegin;
96 const int wSrc = w + tile.wSrcBegin;
97
98 const vec3f inputValue = getInput(hSrc, wSrc);
99 values[0] = inputValue.x;
100 values[1] = inputValue.y;
101 values[2] = inputValue.z;
102
103 if (dstPaddedC >= 6 && albedo.ptr)
104 {
105 const vec3f albedoValue = getAlbedo(hSrc, wSrc);
106 values[3] = albedoValue.x;
107 values[4] = albedoValue.y;
108 values[5] = albedoValue.z;
109
110 if (dstPaddedC >= 9 && normal.ptr)
111 {
112 const vec3f normalValue = getNormal(hSrc, wSrc);
113 values[6] = normalValue.x;
114 values[7] = normalValue.y;
115 values[8] = normalValue.z;
116 }
117 }
118 }
119
120 #if defined(OIDN_COMPILE_SYCL) || defined(OIDN_COMPILE_CUDA) || defined(OIDN_COMPILE_HIP)
121 // Transpose the values in the subgroup into coalesced blocks and store them to memory (fast)
122 // All work-items in the subgroup are assumed to be in the same row
123 const int subgroupLocalID = it.getSubgroupLocalID();
124 const int wDstBegin = it.subgroupBroadcast(wDst, 0);
125 GlobalPtr<DstT> dstPtr = &dst(0, hDst, wDstBegin);
126
127 #if defined(OIDN_COMPILE_SYCL)
128 // The subgroup size is assumed to be equal to the channel count
129 constexpr int subgroupSize = dstPaddedC;
130
131 #pragma unroll
132 for (int i = 0; i < subgroupSize; ++i)
133 {
134 float dstBlock = 0;
135
136 #pragma unroll
137 for (int c = 0; c < min(dstPaddedC, 9); ++c) // only up to 9 non-zero channels
138 {
139 const auto value = it.subgroupBroadcast(values[c], i);

Callers

nothing calls this directly

Calls 11

getInputFunction · 0.85
getAlbedoFunction · 0.85
getNormalFunction · 0.85
getGlobalID<0>Method · 0.80
getGlobalID<1>Method · 0.80
subgroupStoreMethod · 0.80
minFunction · 0.50
getSubgroupLocalIDMethod · 0.45
subgroupBroadcastMethod · 0.45
getSubgroupSizeMethod · 0.45
subgroupShuffleMethod · 0.45

Tested by

no test coverage detected