intel / intel/llvm

how to set gridSize and groupSize?

Open
#8,404 5 comments 0 reactions 0 assignees View on GitHub
bug confirmed good first issue
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

**Describe the bug**
As I use the gridSize and groupSize occurs Error as follow.

exception code : sycl:4 exception message : Non-uniform work-groups are not supported by the target device -54 (PI_ERROR_INVALID_WORK_GROUP_SIZE)

![image](https://user-images.githubusercontent.com/22990858/220042124-f42e91b9-11ad-490c-beb9-a07a6a3a9769.png)

How to solve the problem ? how to set gridSize and groupSize?

**To Reproduce**

CMakeLists.txt

```
cmake_minimum_required(VERSION 2.8.12)

set(DPCPP_HOME "/home/wzy/sycl_workspace")
set(DPCPP_SYCL_HOME "${DPCPP_HOME}/build-cuda-2022-12")

set(CMAKE_C_COMPILER "${DPCPP_SYCL_HOME}/bin/clang")
set(CMAKE_CXX_COMPILER "${DPCPP_SYCL_HOME}/bin/clang++")
set(CMAKE_CXX_STANDARD 17)

project(test_sycl_kernel)

include_directories("${DPCPP_SYCL_HOME}/include/sycl")
include_directories("${DPCPP_SYCL_HOME}/include")

message(STATUS "dpcpp_home : ${DPCPP_HOME}")
message(STATUS "dpcpp_sycl_home : ${DPCPP_SYCL_HOME}")

message(STATUS "find library path : ${DPCPP_SYCL_HOME}/lib")
set(CMAKE_BUILD_RPATH "${DPCPP_SYCL_HOME}/lib;${CMAKE_BUILD_RPATH}")
message(STATUS "cmake build rpath : ${CMAKE_BUILD_RPATH}")

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS "-fsycl -fsycl-targets=nvptx64-nvidia-cuda")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -std=c++17 -Wno-sycl-target -Wno-linker-warnings")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=c++17")

link_directories("${DPCPP_SYCL_HOME}/lib")

aux_source_directory(. DIR_SRCS)
add_executable(test_sycl_kernel ${DIR_SRCS})
target_include_directories(test_sycl_kernel PRIVATE "${DPCPP_SYCL_HOME}/include/sycl")
target_include_directories(test_sycl_kernel PRIVATE "${DPCPP_SYCL_HOME}/include")
target_link_libraries(test_sycl_kernel PRIVATE sycl )

```

add_2.cc

```
#include
#include

#include
using namespace sycl;

void add_2(queue &myQueue, sycl::range<3> dimGrid, sycl::range<3> dimBlock, void** void_args) {
float* device_input1 = (float*)(void_args[0]);
float* device_input2 = (float*)(void_args[1]);
try{
myQueue.submit([&](sycl::handler& h){
h.parallel_for(sycl::nd_range<3>{dimGrid,dimBlock},[=](nd_item<3> item){
int i = item.get_global_linear_id();
device_input2[i] = device_input1[i] + 2;
});
});
}catch(sycl::exception& e){
std::cout<<"exception code : "< dimGrid(1,1,16);
sycl::range<3> dimBlock(1,1,64);

int N = 1024;
float VAL = 1.0f;
float VAL2 = 2.0f;

std::vector host_input (N,VAL);
std::vector host_input2 (N,VAL2);
std::vector host_output (N);

auto device_input1 = sycl::malloc_device(N,myQueue);
auto device_input2 = sycl::malloc_device(N,myQueue);

myQueue.memcpy(device_input1,host_input.data(),N*sizeof(float));
myQueue.memcpy(device_input2,host_input2.data(),N*sizeof(float));

void* data_device[2] = {device_input1,device_input2};

add_2(myQueue,dimGrid,dimBlock,data_device);

myQueue.wait();

myQueue.memcpy(host_output.data(),device_input2,N*sizeof(float));

myQueue.wait();

for(int i = 0;i < N;i++){
std::cout << "hostData[" << i << "] = " << host_output[i] << std::endl;
}
}

```

**Environment (please complete the following information):**

- OS: Ubuntu20.04
- Target device and vendor: Nvidia GPU
- DPC++ version: clang-16 2022-12
- Dependencies version: cuda-11

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.