oneapi-src / oneapi-src/unified-runtime

Consider changing `urProgramGetFunctionPointer` to `urProgramQueryHasKernel`

Open
#878 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

specification
Dominant language
C++
Stars
57
Forks
120
Avg merge
1d 14h
Merged PRs (30d)
1

Description

E.g.

ur_result_t urProgramQueryHasKernel(ur_program_handle_t hProgram, const char *pKernelName, bool *pHasKernelRet);

Currently SYCL-RT only uses urProgramGetFunctionPointer to check whether a program contains a kernel, and doesn't use the actual value of the result. This is only implementable in the OpenCL adapter by using the undocumented clGetDeviceFunctionPointer extension function, and we would like to rely on fewer vendor extensions.

We could implement this simplified entry point in the OpenCL adapter using clGetProgramInfo.

We can't just rely on the UR_PROGRAM_INFO_KERNEL_NAMES query, because this query cannot be implemented in the CUDA and HIP adapters, since there's no way to get the name of all functions in a module. There are long-standing comments in these adapters suggesting moving the has_kernel query from SYCL-RT to PI/UR.

Also, returning the actual function pointer in a backend-agnostic way doesn't make much sense, so it's unlikely other users of UR could make use of the existing entry point. Instead, using native interop of the program and kernel objects can be used to get the underlying function pointer.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing urProgramGetFunctionPointer entry point through the OpenCL, CUDA, and HIP adapters, then review the related SYCL-RT usage and long-standing adapter comments. The work is done when a urProgramQueryHasKernel-style entry point can determine kernel presence without returning a function pointer or requiring the undocumented OpenCL extension, while remaining viable for the supported adapters.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.