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

Reconsider mutable command-buffer structure pointer chaining #1041

Closed
EwanC opened this issue Jan 10, 2024 · 2 comments · Fixed by #1045
Closed

Reconsider mutable command-buffer structure pointer chaining #1041

EwanC opened this issue Jan 10, 2024 · 2 comments · Fixed by #1045
Labels
cl_khr_command_buffer Relating to the command-buffer family of extension

Comments

@EwanC
Copy link
Contributor

EwanC commented Jan 10, 2024

The cl_command_buffer_mutable_dispatch extension introduced structure pointer chains used as part of the update API

cl_int clUpdateMutableCommandsKHR(
    cl_command_buffer_khr command_buffer,
    const cl_mutable_base_config_khr* mutable_config);

The advantages of pointer chaining are extensibility without API breakages, and also the ability for layers to inject structs into the linked list. However, because the structure pointer chaining design is limited to one corner of the OpenCL standard, there are no layers using it, and the API may be more complicated than necessary as it also throws up the issues highlighted in #990 .

An alternative approach that would keep the benefit of extensibility without API breakages, but drop the extra complexity, is an API that uses an array approach rather than a linked list. Credit to @bashbaug for this idea:

cl_int clUpdateMutableCommandsKHR(
    cl_command_buffer_khr command_buffer,
    cl_uint num_configs,                    /* the number of configs in the arrays */
    const cl_config_type_khr* config_types, /* the type of each config */
    const void** configs) ;                 /* the config data, interpreted using the type */

This would be a breaking change to existing cl_khr_command_buffer_mutable_dispatch implementations and code, but this is allowed due to the provisional nature of the extension. I think this is a better final design, as in future layered extensions it's not unlikely that we might want to have more than one instance of a struct, which is forbidden in Vulkan pointer chaining semantics, and defining our own pointer chaining semantics separate from Vulkan seems like more effort than it's worth when pointer chaining isn't giving us tons of value.

In summary, I'd like to propose removing the pointer chaining update API and replace it with the proposed update API entry-point.

PRs containing proposed changes

@EwanC EwanC added the cl_khr_command_buffer Relating to the command-buffer family of extension label Jan 10, 2024
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Jan 15, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Headers that referenced this issue Jan 15, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup/OpenCL-Docs#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Jan 16, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
@EwanC
Copy link
Contributor Author

EwanC commented Jan 16, 2024

EwanC added a commit to EwanC/oneapi-construction-kit that referenced this issue Jan 17, 2024
Implementation change to prototype specification changes proposed
in KhronosGroup/OpenCL-Docs#1041

Uses OpenCL-Docs and OpenCL-Header changes from
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
@EwanC
Copy link
Contributor Author

EwanC commented Jan 17, 2024

Also drafted an implementation of this in oneAPI Construction Kit as proof-of-concept EwanC/oneapi-construction-kit#1

EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Jan 19, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 18, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 22, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 22, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 25, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 28, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Mar 28, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Docs that referenced this issue Jun 19, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Headers that referenced this issue Jun 19, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup/OpenCL-Docs#1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-CTS that referenced this issue Jun 19, 2024
CTS change to reflect proposed change from KhronosGroup/OpenCL-Docs#1041
Taking advantage of the extension version macros to avoid
breaking existing implementations immediately.

This reflects PRs:
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
EwanC added a commit to EwanC/OpenCL-CTS that referenced this issue Jun 19, 2024
CTS change to reflect proposed change from KhronosGroup/OpenCL-Docs#1041
Taking advantage of the extension version macros to avoid
breaking existing implementations immediately.

This reflects PRs:
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
EwanC added a commit to EwanC/oneapi-construction-kit that referenced this issue Jun 19, 2024
Implementation change to prototype specification changes proposed
in KhronosGroup/OpenCL-Docs#1041

Uses OpenCL changes from
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
* KhronosGroup/OpenCL-CTS#1984
@bashbaug bashbaug linked a pull request Jun 21, 2024 that will close this issue
bashbaug pushed a commit that referenced this issue Jul 16, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See #1041 for
motivation.
EwanC added a commit to EwanC/OpenCL-Headers that referenced this issue Jul 19, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup/OpenCL-Docs#1041 for
motivation and KhronosGroup/OpenCL-Docs#1045
for OpenCL-Docs PR.
EwanC added a commit to EwanC/oneapi-construction-kit that referenced this issue Jul 19, 2024
Implementation change to prototype specification changes proposed
in KhronosGroup/OpenCL-Docs#1041

Uses OpenCL changes from
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
* KhronosGroup/OpenCL-CTS#1984
EwanC added a commit to EwanC/oneapi-construction-kit that referenced this issue Jul 19, 2024
Implementation change to prototype specification changes proposed
in KhronosGroup/OpenCL-Docs#1041

Uses OpenCL changes from
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
* KhronosGroup/OpenCL-CTS#1984
EwanC added a commit to EwanC/oneapi-construction-kit that referenced this issue Jul 19, 2024
Implementation change to prototype specification changes proposed
in KhronosGroup/OpenCL-Docs#1041

Uses OpenCL changes from
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
* KhronosGroup/OpenCL-CTS#1984
EwanC added a commit to EwanC/OpenCL-CTS that referenced this issue Sep 5, 2024
CTS change to reflect proposed change from KhronosGroup/OpenCL-Docs#1041
Taking advantage of the extension version macros to avoid
breaking existing implementations immediately.

This reflects PRs:
* KhronosGroup/OpenCL-Docs#1045
* KhronosGroup/OpenCL-Headers#245
bashbaug pushed a commit to KhronosGroup/OpenCL-Headers that referenced this issue Sep 6, 2024
Proposal to pass the update configs to `clUpdateMutableCommandsKHR` as
an array, rather than pointer changed linked list.

See KhronosGroup/OpenCL-Docs#1041 for
motivation and KhronosGroup/OpenCL-Docs#1045
for OpenCL-Docs PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cl_khr_command_buffer Relating to the command-buffer family of extension
Development

Successfully merging a pull request may close this issue.

1 participant