Skip to content

Commit

Permalink
[SYCL][ESIMD] named_barrier_signal should have a fence (#12826)
Browse files Browse the repository at this point in the history
It's required.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex authored Feb 27, 2024
1 parent f81b5a2 commit e83a1f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ __ESIMD_API void named_barrier_signal(uint8_t barrier_id,
__ESIMD_DNS::vector_type_t<uint32_t, 8> payload = 0;
payload[2] = (num_consumers & 0xff) << 24 | (num_producers & 0xff) << 16 |
producer_consumer_mode << 14 | (barrier_id & 0b11111) << 0;

__esimd_fence(__ESIMD_NS::fence_mask::global_coherent_fence |
__ESIMD_NS::fence_mask::local_barrier);
__esimd_raw_send_nbarrier_signal<uint32_t, 8>(
0 /*sendc*/, gateway, descriptor, payload, 1 /*pred*/);
}
Expand Down
4 changes: 3 additions & 1 deletion sycl/test/esimd/nbarriers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -c -fsycl-device-only -Xclang -emit-llvm %s -o %t
// RUN: %clangxx -fsycl -c -fsycl-device-only -Xclang -emit-llvm %s -o - 2>&1 | FileCheck %s

#include <sycl/ext/intel/esimd.hpp>
#include <sycl/sycl.hpp>
Expand All @@ -15,6 +15,8 @@ void caller(int x) {
kernel<class kernel_esimd>([=]() SYCL_ESIMD_KERNEL {
named_barrier_init<7>();
named_barrier_wait(2);
// CHECK: call spir_func void @_Z13__esimd_fenceh(i8 noundef zeroext 33)
// CHECK-NEXT: call spir_func void @_Z32__esimd_raw_send_nbarrier_signal{{.*}}
named_barrier_signal(0, 0, 4, 4);
});
}

0 comments on commit e83a1f1

Please sign in to comment.