cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

recoguy
Adept I

Memory-Leak at calling clBuildProgram with Radeon WX9100

Running the Code below leads to massive main memory consumption by using Radeon WX9100 with driver Version 18.Q1.

At iteration 1000 my program consumes about 1 GiByte Memory.

I also tested the code with AMD FirePro W8100 and a GTX760 and there was no memory leak.

Did I something wrong or can this be a driver bug?

const char szSource[] = "\

    const sampler_t Sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;\n\

    \n\

    __kernel void exampleKernel(\n\

        __read_only image2d_t image,\n\

        __global float* buffer,\n\

        uint4 bufferDim,\n\

        float maxValue,\n\

        float minValue)\n\

    {\n\

        size_t valueX = get_global_id(0);\n\

        size_t valueY = get_global_id(1);\n\

        size_t valueZ = get_global_id(2);\n\

    \n\

        float imageValue = read_imagef(image, Sampler, (float2)(1,1)).x;\n\

    \n\

        size_t index = (valueZ*bufferDim.y+valueY)*bufferDim.x+valueX;\n\

    \n\

        float result = buffer[index];\n\

    \n\

        result = result + imageValue;\n\

        result = clamp(result,minValue,maxValue);\n\

        buffer[index] = result;\n\

    }\n\

    ";

    std::size_t i = 0;

    while(true)

    {

        const char* strings = szSource;

        const size_t lengths = strlen(szSource);

        cl_program program = clCreateProgramWithSource(clContext, 1, &strings, &lengths, &error);

        if(error != CL_SUCCESS || program == NULL)  { std::cerr << "failed to compile program:" << error << std::endl; }

        error = clBuildProgram(program, 1, &clDevice, NULL, NULL, NULL);

        if(error != CL_SUCCESS) { std::cerr << "failed to build program: " << error << std::endl;}

        error = clReleaseProgram(program);

        if(error != CL_SUCCESS)  {std::cerr << "failed to release program: " << error << std::endl; }

        std::cout << i++ << std::endl;

    }

Tags (1)
0 Kudos
Reply
11 Replies
dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Thank you for reporting it. I'll inform the concerned team about the issue. Please share the OS information and clinfo output.

Regards,

0 Kudos
Reply
recoguy
Adept I

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

I'm using Windows 7 64-bit

clInfo:

  Platform Name:                 AMD Accelerated Parallel Processing

Number of devices:                 2

  Device Type:                     CL_DEVICE_TYPE_GPU

  Vendor ID:                     1002h

  Board name:                     Radeon (TM) Pro WX 9100

  Device Topology:                 PCI[ B#8, D#0, F#0 ]

  Max compute units:                 64

  Max work items dimensions:             3

    Max work items[0]:                 1024

    Max work items[1]:                 1024

    Max work items[2]:                 1024

  Max work group size:                 256

  Preferred vector width char:             4

  Preferred vector width short:             2

  Preferred vector width int:             1

  Preferred vector width long:             1

  Preferred vector width float:             1

  Preferred vector width double:         1

  Native vector width char:             4

  Native vector width short:             2

  Native vector width int:             1

  Native vector width long:             1

  Native vector width float:             1

  Native vector width double:             1

  Max clock frequency:                 1500Mhz

  Address bits:                     64

  Max memory allocation:             14360458035

  Image support:                 Yes

  Max number of images read arguments:         128

  Max number of images write arguments:         64

  Max image 2D width:                 16384

  Max image 2D height:                 16384

  Max image 3D width:                 2048

  Max image 3D height:                 2048

  Max image 3D depth:                 2048

  Max samplers within kernel:             16

  Max size of kernel argument:             1024

  Alignment (bits) of base address:         2048

  Minimum alignment (bytes) for any datatype:     128

  Single precision floating point capability

    Denorms:                     No

    Quiet NaNs:                     Yes

    Round to nearest even:             Yes

    Round to zero:                 Yes

    Round to +ve and infinity:             Yes

    IEEE754-2008 fused multiply-add:         Yes

  Cache type:                     Read/Write

  Cache line size:                 64

  Cache size:                     16384

  Global memory size:                 17163091968

  Constant buffer size:                 14360458035

  Max number of constant args:             8

  Local memory type:                 Scratchpad

  Local memory size:                 32768

  Max pipe arguments:                 16

  Max pipe active reservations:             16

  Max pipe packet size:                 1475556147

  Max global variable size:             12924412160

  Max global variable preferred total size:     17163091968

  Max read/write image args:             64

  Max on device events:                 1024

  Queue on device max size:             8388608

  Max on device queues:                 1

  Queue on device preferred size:         262144

  SVM capabilities:                

    Coarse grain buffer:             Yes

    Fine grain buffer:                 Yes

    Fine grain system:                 No

    Atomics:                     No

  Preferred platform atomic alignment:         0

  Preferred global atomic alignment:         0

  Preferred local atomic alignment:         0

  Kernel Preferred work group size multiple:     64

  Error correction support:             0

  Unified memory for Host and Device:         0

  Profiling timer resolution:             1

  Device endianess:                 Little

  Available:                     Yes

  Compiler available:                 Yes

  Execution capabilities:                

    Execute OpenCL kernels:             Yes

    Execute native function:             No

  Queue on Host properties:                

    Out-of-Order:                 No

    Profiling :                     Yes

  Queue on Device properties:                

    Out-of-Order:                 Yes

    Profiling :                     Yes

  Platform ID:                     000007FEC1CB4AB0

  Name:                         gfx900

  Vendor:                     Advanced Micro Devices, Inc.

  Device OpenCL C version:             OpenCL C 2.0

  Driver version:                 2527.8 (PAL,HSAIL)

  Profile:                     FULL_PROFILE

  Version:                     OpenCL 2.0 AMD-APP (2527.8)

  Extensions:                     cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_dx9_media_sharing cl_khr_image2d_from_buffer cl_khr_spir cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_liquid_flash

dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Thank you for sharing above information. I've opened a ticket against this issue. I will update you once I get more information from the concerned team.

recoguy
Adept I

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Is there any new information available? Thanks in Advance

dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

The issue is still under investigation. Once I get any update, I'll let you know.

Thanks for the patience.

Regards,

dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Hi recoguy,

Thank you for your patience.

Here is an update about this issue. As I've come to know, the issue has been resolved in the internal builds and the fix will soon be publicly available.

Regards,

recoguy
Adept I

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Good News!

When can I expect a new update?

0 Kudos
Reply
dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

Expecting within this quarter only, may be with upcoming August release or next one.

0 Kudos
Reply
dipak
Staff
Staff

Re: Memory-Leak at calling clBuildProgram with Radeon WX9100

It seems the fix is already available with the latest driver 18.Q3.  Can you please check and share your observation?

0 Kudos
Reply