0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-12 13:01:07 +01:00
construct/include/ircd/simt/broadcast.h

28 lines
818 B
C
Raw Normal View History

2021-04-02 21:51:59 +02:00
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
/// Broadcast originating from the local leader (index [0]). All threads in the
/// group participate.
inline void
ircd_simt_broadcast_f4lldr(__local float4 *const buf)
2021-04-02 21:51:59 +02:00
{
const uint
li = get_local_id(0),
ln = get_local_size(0);
2021-04-02 21:51:59 +02:00
for(uint stride = 1; stride < ln; stride <<= 1)
{
if(li < stride)
buf[li + stride] = buf[li];
barrier(CLK_LOCAL_MEM_FENCE);
}
}