Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

Shared Virtual Memory (SVM) Support

Altera_Forum
Honored Contributor II
2,225 Views

Hi, 

 

I see in the release notes for v15 update 2, that "Adds OpenCL Shared Virtual Memory (SVM) application programming interface (API) support to emulation" - so apparently it is supported in general. 

 

I cannot seem to be able to find in any documentation anything about SVM, how to use the SVM functions etc. (it appears that in CL/cl_ext.h there are functions like clSetKernelArgSVMPointerAltera()).  

I cannot get them to work - i.e., successfully compile. 

 

Can someone shed some light or provide any documentation with more details on SVM and how to get it work? 

 

Thanks! 

 

~~~ 

 

EDIT: Partially answering my question. 

 

So, it seems that the following SMV-related functions are available (it is pretty much what OpenCL 2.0 supports, BUT you need to add the "Altera" suffix, so their arguments list, return types, errors, etc. should be what you can see for the corresponding OpenCL 2.0 functions): 

clEnqueueSVMFreeAltera 

clEnqueueSVMMapAltera 

clEnqueueSVMMemFillAltera 

clEnqueueSVMMemcpyAltera 

clEnqueueSVMUnmapAltera 

clSVMAllocAltera 

clSVMFreeAltera 

clSetKernelArgSVMPointerAltera 

 

In order to use SVM your allocations have to be aligned, in my case at least 1024 - CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE shows 1024. 

Then use the clSetKernelArgSVMPointerAltera() to set the SVM pointer argument. 

 

int *test_arr=(int *)memalign(1024, sizeof(cl_int)*32); ... clSetKernelArgSVMPointerAltera(kernel, 1, test_arr); 

 

The kernel argument and use within the kernel is as with any global memory pointer. 

Since, fine-grained system SVM is supported there is no need for map/unmaps, nor for explicit clSVMAllocPointerAltera() - at least to my understanding :)
0 Kudos
0 Replies
Reply