Ask Your Question

Revision history [back]

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.

click to hide/show revision 2
No.2 Revision

updated 2015-04-09 01:11:05 -0600

berak gravatar image

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
#define LSIZE 256

define 256 #define LSIZE_1 255

define 255 #define LSIZE_2 254

define 254 #define HF_LSIZE 128

define 128 #define LOG_LSIZE 8

define 8 #define LOG_NUM_BANKS 5

define 5 #define NUM_BANKS 32

define 32 #define GET_CONFLICT_OFFSET(lid) ((lid) >> LOG_NUM_BANKS)

LOG_NUM_BANKS)

3) Based on these macros, in each kernel function they are creating local variables as shown below. 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;

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.