ASYNC_WORK_GROUP_COP(3clc)

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

πŸ’– 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 Β© 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) πŸ“Ž

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