Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Correction to range parameter of parallel_for for conformance to SYCL specification. #188

Merged
merged 8 commits into from
Mar 22, 2021
10 changes: 4 additions & 6 deletions SYCL/ESIMD/kmeans/kmeans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,13 @@ int main(int argc, char *argv[]) {
// Actual execution goes here

unsigned int total_threads = (NUM_POINTS - 1) / POINTS_PER_THREAD + 1;
auto GlobalRange = cl::sycl::range<1>(total_threads);
cl::sycl::range<1> LocalRange{1};
auto GlobalRange1 = cl::sycl::range<1>(NUM_CENTROIDS_ACTUAL);
cl::sycl::range<1> LocalRange1 = cl::sycl::range<1>{1};

auto submitJobs = [&]() {
// kmeans
nd_range<1> Range{total_threads, 1};
auto e = q.submit([&](cl::sycl::handler &cgh) {
cgh.parallel_for<class kMeans>(
GlobalRange * LocalRange, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
Range, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
simd<float, 2 * NUM_CENTROIDS_ALLOCATED> centroids(0);
auto centroidsXYXY =
centroids.format<float, NUM_CENTROIDS_ALLOCATED / SIMD_SIZE,
Expand Down Expand Up @@ -345,8 +342,9 @@ int main(int argc, char *argv[]) {

// compute centroid position
auto e2 = q.submit([&](cl::sycl::handler &cgh) {
nd_range<1> Range1{NUM_CENTROIDS_ACTUAL, 1};
cgh.parallel_for<class kCompCentroidPos>(
GlobalRange1 * LocalRange1, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
Range1, [=](nd_item<1> it) SYCL_ESIMD_KERNEL {
simd<float, SIMD_SIZE> xsum(0);
simd<float, SIMD_SIZE> ysum(0);
simd<int, SIMD_SIZE> npoints(0);
Expand Down