ASYNC_WORK_GROUP_COP(3clc)
π NAME π
hiii bestie, welcome to async_work_group_copy β straight out of the OpenCL Manual β she does an async copy and honestly? she eats every time π
event_t async_work_group_copy(__local gentype *dst,
const __global gentype *src,
size_t num_gentypes, event_t event);
event_t async_work_group_copy(__global gentype *dst,
const __local gentype *src,
size_t num_gentypes, event_t event);
πΈ DESCRIPTION πΈ
okay so the OpenCL C programming language implements these functions, and what they give you is asynchronous copies between global and local memory, plus a prefetch from global memory. it's giving multitasking queen β¨
So what she actually does: perform an async copy of num_gentypes elements from src to dst. π«
Now here's the part where you HAVE to pay attention, no cap:
The async copy is performed by all work-items in a work-group, and this built-in function must therefore be encountered by all work-items in a work-group executing the kernel with the same argument values; otherwise the results are undefined. π like, undefined-undefined. do not test her.
She returns an event object that you can hand to wait_group_events(3clc) to wait for the async copy to finish. π«Ά
And the event argument? You can also use it to associate the async_work_group_copy with a previous async copy, which lets one single event be shared by multiple async copies β otherwise event should be zero. π
If the event argument is non-zero, then the event object supplied in the event argument will be returned. periodt.
Also important, bestie: this function does not perform any implicit synchronization of source data, like, it's not gonna sneak a barrier(3clc) in there before performing the copy. you want that barrier? you write that barrier. π
β¨ NOTES β¨
The generic type name gentype indicates the built-in data types char, char{2|3|4|8|16}, uchar, uchar{2|3|4|8|16}, short, short{2|3|4|8|16}, ushort, ushort{2|3|4|8|16}, int, int{2|3|4|8|16}, uint, uint{2|3|4|8|16}, long, long{2|3|4|8|16}, ulong, ulong{2|3|4|8|16} or float, float{2|3|4|8|16} as the type for the arguments, unless otherwise stated. π
Optionally, the generic type name gentype may indicate double and double{2|3|4|8|16} as arguments and return values. And if it's extended with cl_khr_fp16(3clc), the generic type name gentype may indicate half and half{2|3|4|8|16} as arguments and return values. π§
One more thing: async_work_group_copy and async_work_group_strided_copy for 3-component vector types behave as async_work_group_copy and async_work_group_strided_copy respectively for 4-component vector types. yeah. she said what she said. π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
go read those next bestie, they're part of the lore π¦
π AUTHORS π
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES (footnote edition, yes there's another one) π
- OpenCL Specification page 276, section 6.12.10 - Async Copies from Global to Local Memory...
okay that's the whole page, you're officially educated π this was brought to you by The Khronos Group, version date 01/14/2021 β love you, go forth and async copy responsibly πβ¨π«Ά
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms