[cfe-dev] [RFC][OpenCL] Pass alignment of arguments in local addr space for device-side enqueued kernel to __enqueue_kernel functions

Anastasia Stulova via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 15 07:39:45 PST 2017


> OpenCL spec requires that a pointer should be aligned to at least the pointee type.


So a pointer to int16 would be 64 byte aligned? Seems strange though. Can you give me the spec reference?

> Otherwise, __enqueue_kernel has to either allocate unaligned local buffer, which degrades performance, or allocates local buffer with extra alignment therefore wasted memory space.

Can you explain in more details here, please.

Cheer,
Anastasia
________________________________
From: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>
Sent: 01 December 2017 19:45
To: Anastasia Stulova; cfe-dev (cfe-dev at lists.llvm.org); Bader, Alexey (alexey.bader at intel.com)
Cc: Sumner, Brian
Subject: [RFC][OpenCL] Pass alignment of arguments in local addr space for device-side enqueued kernel to __enqueue_kernel functions


Hi,



OpenCL spec requires that a pointer should be aligned to at least the pointee type. Therefore, if a device-side enqueued kernel has a local int* argument, it should be aligned to 4 bytes.



Since these buffers in local addr space are allocated by __enqueue_kernel, it needs to know the alignment of these buffers, not just their sizes.



Although such information is not passed to the original OpenCL builtin function enqueue_kernel, it can be obtained by checking the prototype of the block invoke function at compile time.



I would like to create a patch to pass this information to  __enqueue_kernel. Otherwise, __enqueue_kernel has to either allocate unaligned local buffer, which degrades performance, or allocates local buffer with extra alignment therefore wasted memory space.



Any comments?



Thanks.



Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171215/c8bf010a/attachment.html>


More information about the cfe-dev mailing list