cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

tando
Journeyman III

CL_MEM_OBJECT_ALLOCATION_FAILURE returns with clCreateBuffer.

I want to transfer data directly from AMD GPU to DDR memory on FPGA board.

I am trying to create a buffer object by mapping the FPGA's DDR memory with mmap using Linux UIO and setting the CL_MEM_USE_HOST_PTR flag in clcreatebuffer for the buffer I get, but CL_MEM_OBJECT_ ALLOCATION_FAILURE is returned.

 

I have confirmed that I can read/write to the memory of the FPGA board by the address obtained by mmap. (I also confirmed that the read/write result from the FPGA serial port is correct.)

So I think that mmap is working correctly.

 

How can I solve this problem?

 

Here is a part of source code.

 

fd = open("/dev/uio0", O_RDWR);

if (fd < 0) {

    exit(1);

}

buff = mmap(NULL, mem_alloc_size, (PROT_READ|PROT_WRITE), (MAP_SHARED|MAP_LOCKED), fd, 0);

if (buff == MAP_FAILED) {

exit(1);

}

mem_obj_host = clCreateBuffer(context, (CL_MEM_WRITE_ONLY|CL_MEM_USE_HOST_PTR), mem_alloc_size, buff, &ret);

if(ret != CL_SUCCESS) {

printf("ret:%d \n", ret);  // return -4 (CL_MEM_OBJECT_ ALLOCATION_FAILURE)

exit(1);

}

0 Likes
1 Reply
dipak
Big Boss

Hi @tando ,

Thanks for posting it. I have whitelisted you and moved the post to the OpenCL forum.

You may use DirectGMA which makes it possible for GPU to access FPGA memory directly (note, GPU and FPGA board both need to support DirectGMA feature). Below are some useful links:

https://github.com/GPUOpen-LibrariesAndSDKs/DirectGMA_P2P

https://registry.khronos.org/OpenCL/extensions/amd/cl_amd_bus_addressable_memory.txt

DirectGMA between a FPGA and GPU

Thanks.

0 Likes