Skip to content
This repository was archived by the owner on Feb 16, 2019. It is now read-only.

Commit 20a85f0

Browse files
committed
avoid mixing obj types for reuse
1 parent abb09f4 commit 20a85f0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

openvx/ago/ago_drama_alloc.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ int agoGpuOclAllocBuffers(AgoGraph * graph)
9494

9595
// get the list of virtual data (D) that need GPU buffers and mark if CPU access is not needed for virtual buffers
9696
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;
10098
};
10199
std::vector<AgoData *> D;
102100
for (AgoSuperNode * supernode = graph->supernodeList; supernode; supernode = supernode->next) {
@@ -141,11 +139,20 @@ int agoGpuOclAllocBuffers(AgoGraph * graph)
141139
}
142140

143141
// 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+
};
144148
auto isMergePossible = [=](std::vector<AgoData *>& G, AgoData * data) -> bool {
145149
vx_uint32 s = data->hierarchical_life_start;
146150
vx_uint32 e = data->hierarchical_life_end;
151+
cl_mem_object_type dataMemType = getMemObjectType(data);
147152
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)) ||
149156
((e + 1) >= d->hierarchical_life_start && (e + 1) <= (d->hierarchical_life_end + 1)))
150157
{
151158
return false;

0 commit comments

Comments
 (0)