ASYNC_WORK_GROUP_STR(3clc)
πΈ ASYNC_WORK_GROUP_STR β the 3clc page, bestie edition πΈ
okay so this is from the OpenCL Manual besties, and it's literally all about one function. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
async_work_group_strided_copy β it does an async gather of num_elements gentype elements from source to destination. that's the whole vibe. no cap.
event_t async_work_group_strided_copy(__local gentype *dst,
const __global gentype *src,
size_t num_gentypes,
size_t src_stride, event_t event);
event_t async_work_group_strided_copy(__global gentype *dst,
const __local gentype *src,
size_t num_gentypes,
size_t dst_stride, event_t event);
π DESCRIPTION π
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. iconic behaviour honestly β¨
here's the tea: it performs an async gather of num_gentypes gentype elements from src to dst. src_stride is the stride in elements for each gentype element read from src. dst_stride is the stride in elements for each gentype element written to dst. and the async gather? it's performed by all work-items in a work-group. teamwork makes the dream work π§
π¨ so 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. yes, undefined. we do not play with undefined.
it 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 can also be used to associate the async_work_group_strided_copy with a previous async copy, which lets an event be shared by multiple async copies. otherwise, event should be zero. periodt.
if the event argument is non-zero, the event object supplied in the event argument will be returned. simple as that π
also β and this is important β this function does not perform any implicit synchronization of source data, like using a barrier(3clc) before performing the copy. do it yourself, bestie, i believe in you.
π the behavior ofasync_work_group_strided_copyis undefined ifsrc_strideordst_strideis0, or if thesrc_strideordst_stridevalues cause thesrcordstpointers to exceed the upper bounds of the address space during the copy. so don't do that. fr fr.
π 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. slay, so many options π
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. look at us, so versatile β¨
and this one's a fun little quirk: 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. yes really. iykyk π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
π 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π₯ NOTES π₯
- OpenCL Specification page 276, section 6.12.10 - Async Copies from Global to Local Memory...
okay that's the whole page bestie, you're officially educated π
little sign-off moment: this whole thing is brought to you by The Khronos Group, dated 01/14/2021, filed under ASYNC_WORK_GROUP_STR(3clc) β go forth and wait_group_events 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