KhronosGroup / KhronosGroup/OpenCL-Docs

returning CL_INVALID_OPERATION from clSetProgramSpecializationConstant

Open
#1,601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
421
Forks
132
Avg merge
5d 13h
Merged PRs (30d)
11

Description

When we made IL programs optional in OpenCL 3.0, we added the error condition for clSetProgramSpecializationConstant:

CL_INVALID_OPERATION if no devices associated with program support intermediate language programs.

Note that clSetProgramSpecializationConstant also has the error condition:

CL_INVALID_PROGRAM if program is not a valid program object created from an intermediate language (e.g. SPIR-V), or if the intermediate language does not support specialization constants.

In the description of clCreateProgramWithIL, though, we also have the error condition:

CL_INVALID_OPERATION if no devices in context support intermediate language programs.

This means:

  • If no devices in the context support intermediate language programs, it is impossible to create a valid program object created from an intermediate language, because clCreateProgramWithIL will return an error.
  • Therefore, the CL_INVALID_OPERATION error condition for clSetProgramSpecializationConstant is debatably redundant and unnecessary, because in all of the conditions when it could be returned it will also be a CL_INVALID_PROGRAM.

We have a "consistency check" CTS test for this scenario, but note that the error could just as correctly be CL_INVALID_PROGRAM (since the program is created from source) as it could be CL_INVALID_OPERATION (since no devices associated with the program support IL programs).

https://github.com/KhronosGroup/OpenCL-CTS/blob/b8f8906c251926b1b3679323bfbf3df730b40fb8/test_conformance/api/test_api_consistency.cpp#L955

Should we remove this error condition (and update the CTS)? Or, is there a different way we should phrase the error condition, instead?

Contributor guide

Open the contributing guide

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 comparing the clSetProgramSpecializationConstant and clCreateProgramWithIL error conditions in the linked OpenCL specification sections. Then inspect test_conformance/api/test_api_consistency.cpp around line 955. Done means the error wording has an agreed resolution and the consistency test is updated to match it.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, testing
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.