ASYNC_WORK_GROUP_STR(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

🌸 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 of async_work_group_strided_copy is undefined if src_stride or dst_stride is 0, or if the src_stride or dst_stride values cause the src or dst pointers 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 Β© 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 πŸ”₯

  1. 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