Forums - Opencl CL_OUT_OF_HOST_MEMORY

2 posts / 0 new
Last post
Opencl CL_OUT_OF_HOST_MEMORY
shabuddin
Join Date: 25 Mar 15
Posts: 2
Posted: Wed, 2015-03-25 05:22

HI,

 I am running opencv with CL on qualcomm 800 series board, its having adreno 330 GPU and android platform, i am facing issue with some particular opencl codes, while running that code am getting error like cl_out_of_host_memory for one cl code while calling clbuildprogram function, at the same function call for some other cl code am getting "ran out of registers during register allocation " error. i tried tracing them, i checked all the arguments being passed to clbuildprogram function, every thing is okay, size of source code also i have checked, size of program source am passing to this clbuildprogram is also less when compared to the source code which is passing. can any one guide me please.

 

Thanks,

Shabuddin.

  • Up0
  • Down0
shabuddin
Join Date: 25 Mar 15
Posts: 2
Posted: Wed, 2015-04-08 23:18

Hi,

I found the reason for this issue, but still i have some doubts,first i will explain how i got this issue solved, later i will point out my doubt.

1) I was getting this issue when clbuildprogram is being called by passing program object, this program object is created using clcreateprogramwithsource, and the source being passed to this is having four kernel functions. 

2) In the file where those kernel functions are present some macros are there, those macros are as follows:
#define LSIZE 256
#define LSIZE_1 255
#define LSIZE_2 254
#define HF_LSIZE 128
#define LOG_LSIZE 8
#define LOG_NUM_BANKS 5
#define NUM_BANKS 32
#define GET_CONFLICT_OFFSET(lid) ((lid) >> LOG_NUM_BANKS)

3) Based on these macros, in each kernel function they are creating local variables as shown below.
__local int4 lm_sum[2][LSIZE + LOG_LSIZE];
__local float4 lm_sqsum[2][LSIZE + LOG_LSIZE];
__local int* sum_p;
__local float* sqsum_p;

4) that means total size of 0.5MB(540704B) is being allocated in local memory region, i have changed macros such a way that, total local memory being used by 4 kernel functions became 0.1MB(131104B), and with this change the issue CL_OUT_OF_HOST_MEMORY got cleared.

i understood that this issue is because of local memory, but my doubt is that, when i queried for local memory device is having it showed as it is having only 8kB, then why i got problem with 0.5MB local memory, and why the same is not happening with 0.1MB, how it is managing, can any one explain me this.

Thanks,
Shabuddin.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.