intel / intel/llvm

How to understand the piKernelCreate?

Open
#9,018 0 comments 0 reactions 0 assignees View on GitHub
bug cuda hip
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

When I use third party application to invoke sycl toolchain, the problem occurs as below.
```
PI HIP ERROR:
Value: 500
Name: hipErrorNotFound
Description: named symbol not found
Function: hip_piKernelCreate
Source Location: /home/wzy/sycl_workspace/llvm/sycl/plugins/hip/pi_hip.cpp:2717
```

How to understand the piKernelCreate by ModuleGetFunction with kernel name+"_with_offset"? what is the kernel name difference between 'xx_with_offset' and 'xx'?

```
pi_result cuda_piKernelCreate(pi_program program, const char *kernel_name,
pi_kernel *kernel) {
assert(kernel != nullptr);
assert(program != nullptr);

pi_result retErr = PI_SUCCESS;
std::unique_ptr<_pi_kernel> retKernel{nullptr};

try {
ScopedContext active(program->get_context());

CUfunction cuFunc;
retErr = PI_CHECK_ERROR(
cuModuleGetFunction(&cuFunc, program->get(), kernel_name));

std::string kernel_name_woffset = std::string(kernel_name) + "_with_offset";
CUfunction cuFuncWithOffsetParam;
CUresult offsetRes = cuModuleGetFunction(
&cuFuncWithOffsetParam, program->get(), kernel_name_woffset.c_str());

// If there is no kernel with global offset parameter we mark it as missing
if (offsetRes == CUDA_ERROR_NOT_FOUND) {
cuFuncWithOffsetParam = nullptr;
} else {
retErr = PI_CHECK_ERROR(offsetRes);
}

retKernel = std::unique_ptr<_pi_kernel>(
new _pi_kernel{cuFunc, cuFuncWithOffsetParam, kernel_name, program,
program->get_context()});
} catch (pi_result err) {
retErr = err;
} catch (...) {
retErr = PI_ERROR_OUT_OF_HOST_MEMORY;
}

*kernel = retKernel.release();
return retErr;
}
```

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

- OS: Linux
- Target device and vendor: AMD GPU gfx906
- DPC++ version: clang++ 16
- Dependencies version: [e.g. low-level runtime versions (like NEO 20.04)]

**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.