Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define function types for prototype declaration #230

Merged
merged 8 commits into from
May 9, 2023

Conversation

Kerilk
Copy link
Contributor

@Kerilk Kerilk commented Apr 25, 2023

This is pull request implements what I have been describing in a recent WG meeting: providing and using type function definitions to declare symbols and pointers. This yields several benefits:

static clGetICDLoaderInfoOCLICD_t clGetICDLoaderInfoOCLICD;
cl_int
clGetICDLoaderInfoOCLICD(
   cl_icdl_info param_name,
   size_t       param_value_size,
   void *       param_value,
   size_t *     param_value_size_ret)
{

I kept the original exports as some users could be parsing the headers for the original declarations (We do in the CLHPP testing for instance)

I did cut this PR in 3 main patches, should we decide to partially apply these changes:

  • Add prototypes to the extensions through the generator.
  • Add prototype to the core functions in a new generated file cl_function_types
  • Apply prototypes (manually) to cl_icd.h which benefits a lot from the change. Given how suffixes are not really used (and very inconsistently in cl_icd.h) we could also take it a step father and remove the pointer type definitions from this file and use the function types directly inside the dispatch structure. For now I decided to minimize the scope of the changes. I did remove duplicated prototype declarations in cl_icdl.h, and added a missing guard around cl_api_clCreateFromGLTexture which apparently only exist in OpenCL 1.2. Implemented the change as suggested.

I tested using the ICD-Loader and CLHPP tests. No issues to report.

@Kerilk Kerilk changed the title Use function types for prototype declaration Define function types for prototype declaration Apr 26, 2023
bashbaug
bashbaug previously approved these changes May 2, 2023
Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I have a few comments but it would be fine to address them in a subsequent PR (or not at all).

CL/cl_icd.h Outdated Show resolved Hide resolved
@Kerilk Kerilk marked this pull request as ready for review May 2, 2023 17:32
Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I did some basic testing on Windows and everything seems to be in order.

@Kerilk
Copy link
Contributor Author

Kerilk commented May 3, 2023

LGTM! I did some basic testing on Windows and everything seems to be in order.

Thank for taking a look. Should we discuss this next week at the teleconference before merging?

@bashbaug
Copy link
Contributor

bashbaug commented May 9, 2023

Merging as discussed on the May 9th teleconference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants