Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This release is compatible with NumPy 2.5.
* Replaced references to the `dpnp.amax`/`dpnp.amin` aliases with the canonical `dpnp.max`/`dpnp.min` in docstrings and code internally [#2990](https://github.com/IntelPython/dpnp/pull/2990)
* Aligned the signature of `dpnp.tensor.expand_dims` with the Python array API by making `axis` a required argument [#2988](https://github.com/IntelPython/dpnp/pull/2988)
* Removed dead code branches guarded by outdated oneMKL and DPC++ compiler version checks [#2999](https://github.com/IntelPython/dpnp/pull/2999)
* Replaced the deprecated `nd_item::barrier()` member calls in the `accumulators` and `gemm` kernels with the SYCL 2020 `sycl::group_barrier()` free function [#3006](https://github.com/IntelPython/dpnp/pull/3006)

### Deprecated

Expand Down
21 changes: 13 additions & 8 deletions dpnp/tensor/libtensor/include/kernels/accumulators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,12 @@ sycl::event inclusive_scan_base_step_blocked(
local_iscan.back(), identity, scan_op);
// ensure all finished reading from SLM, to avoid race condition
// with subsequent writes into SLM
it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(),
sycl::memory_scope::work_group);
}

slm_iscan_tmp[(lid + 1) % wg_size] = wg_iscan_val;
it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);
const outputT modifier = (lid == 0) ? identity : slm_iscan_tmp[lid];

#pragma unroll
Expand Down Expand Up @@ -430,7 +431,8 @@ sycl::event inclusive_scan_base_step_striped(
slm_iscan_tmp[local_offset0 + i] = local_iscan[i];
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(),
sycl::memory_scope::work_group);
}

{
Expand All @@ -452,7 +454,8 @@ sycl::event inclusive_scan_base_step_striped(
slm_iscan_tmp[block_offset + disp_exchanged];
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(),
sycl::memory_scope::work_group);
}
}

Expand All @@ -476,19 +479,20 @@ sycl::event inclusive_scan_base_step_striped(
identity, scan_op);
// ensure all finished reading from SLM, to avoid race condition
// with subsequent writes into SLM
it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(),
sycl::memory_scope::work_group);
}

slm_iscan_tmp[(lid + 1) % wg_size] = wg_iscan_val;
it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);
const outputT modifier = (lid == 0) ? identity : slm_iscan_tmp[lid];

#pragma unroll
for (nwiT m_wi = 0; m_wi < n_wi; ++m_wi) {
local_iscan[m_wi] = scan_op(local_iscan[m_wi], modifier);
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

// convert back to blocked layout
{
Expand All @@ -499,7 +503,8 @@ sycl::event inclusive_scan_base_step_striped(
slm_iscan_tmp[local_offset0 + m_wi] = local_iscan[m_wi];
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(),
sycl::memory_scope::work_group);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ class GemmBatchFunctorThreadK
}
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

std::size_t t_shift = block_s * delta_k * n_wi;
std::size_t global_s_offset = i * k + t_shift;
Expand All @@ -672,7 +672,7 @@ class GemmBatchFunctorThreadK
std::size_t workspace_i_shift = local_i * delta_k;
workspace[workspace_i_shift + local_s] = private_sum;

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

if (local_s == 0 && i < n) {
accV_t local_sum(workspace[workspace_i_shift]);
Expand Down Expand Up @@ -1063,7 +1063,7 @@ class GemmBatchFunctorThreadNM_vecm
}
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

const std::uint32_t lo_lhs_st_k = (wg_delta_n * wi_delta_n);
const std::uint32_t lo_rhs_rk_k = (wg_delta_m * wi_delta_m_vecs);
Expand Down Expand Up @@ -1095,7 +1095,7 @@ class GemmBatchFunctorThreadNM_vecm
}
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);
}

if constexpr (m_vec_size == 1) {
Expand Down Expand Up @@ -1942,7 +1942,7 @@ class GemmBatchNoAtomicFunctorThreadNM
}
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

i += local_i * wi_delta_n;
j += local_j * wi_delta_m;
Expand Down Expand Up @@ -2115,7 +2115,7 @@ class GemmBatchNoAtomicFunctorThreadK
}
}

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

std::size_t t_shift = block_s * delta_k * n_wi;
std::size_t global_s_offset = i * k + t_shift;
Expand All @@ -2134,7 +2134,7 @@ class GemmBatchNoAtomicFunctorThreadK
std::size_t workspace_i_shift = local_i * delta_k;
workspace[workspace_i_shift + local_s] = private_sum;

it.barrier(sycl::access::fence_space::local_space);
sycl::group_barrier(it.get_group(), sycl::memory_scope::work_group);

if (local_s == 0 && i < n) {
accV_t local_sum(workspace[workspace_i_shift]);
Expand Down
Loading