@@ -94,9 +94,7 @@ int agoGpuOclAllocBuffers(AgoGraph * graph)
94
94
95
95
// get the list of virtual data (D) that need GPU buffers and mark if CPU access is not needed for virtual buffers
96
96
auto isDataValidForGd = [=](AgoData * data) -> bool {
97
- return data && data->isVirtual &&
98
- !(data->ref .type == VX_TYPE_LUT && data->u .lut .type == VX_TYPE_UINT8) // can't be used because of clCreateImage
99
- ;
97
+ return data && data->isVirtual ;
100
98
};
101
99
std::vector<AgoData *> D;
102
100
for (AgoSuperNode * supernode = graph->supernodeList ; supernode; supernode = supernode->next ) {
@@ -141,11 +139,20 @@ int agoGpuOclAllocBuffers(AgoGraph * graph)
141
139
}
142
140
143
141
// get data groups (Gd)
142
+ auto getMemObjectType = [=](AgoData * data) -> cl_mem_object_type {
143
+ cl_mem_object_type obj_type = CL_MEM_OBJECT_BUFFER;
144
+ if (data->ref .type == VX_TYPE_LUT && data->u .lut .type == VX_TYPE_UINT8)
145
+ obj_type = CL_MEM_OBJECT_IMAGE1D;
146
+ return obj_type;
147
+ };
144
148
auto isMergePossible = [=](std::vector<AgoData *>& G, AgoData * data) -> bool {
145
149
vx_uint32 s = data->hierarchical_life_start ;
146
150
vx_uint32 e = data->hierarchical_life_end ;
151
+ cl_mem_object_type dataMemType = getMemObjectType (data);
147
152
for (auto d : G) {
148
- if (( s >= d->hierarchical_life_start && s <= (d->hierarchical_life_end + 1 )) ||
153
+ cl_mem_object_type dMemType = getMemObjectType (d);
154
+ if ((dataMemType != dMemType) ||
155
+ ( s >= d->hierarchical_life_start && s <= (d->hierarchical_life_end + 1 )) ||
149
156
((e + 1 ) >= d->hierarchical_life_start && (e + 1 ) <= (d->hierarchical_life_end + 1 )))
150
157
{
151
158
return false ;
0 commit comments