OpenCL-CTS icon indicating copy to clipboard operation
OpenCL-CTS copied to clipboard

Add clSetCommandQueueProperty test

Open ellnor01 opened this issue 4 years ago • 10 comments

Add test to check that clSetCommandQueueProperty successfully changes command queue properties.

Fixes #904

Signed-off-by: Ellen Norris-Thompson [email protected]

ellnor01 avatar Mar 08 '21 15:03 ellnor01

Hi I am not sure why we want to test this API call . According to specification it is deprecated: https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#clSetCommandQueueProperty

gwawiork avatar Apr 06 '21 13:04 gwawiork

Deprecated doesn't mean removed. All OpenCL implementations still have to support it. We've discussed removing it in the working group but until that happens, we have to test it.

kpet avatar Apr 06 '21 13:04 kpet

FWIW, we've had this comment in the OpenCL headers for as long as I can remember:

#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
    /*
     *  WARNING:
     *     This API introduces mutable state into the OpenCL implementation. It has been REMOVED
     *  to better facilitate thread safety.  The 1.0 API is not thread safe. It is not tested by the
     *  OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
     *  It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
     *
     *  Software developers previously relying on this API are instructed to set the command queue
     *  properties when creating the queue, instead.
     */
    extern CL_API_ENTRY cl_int CL_API_CALL
    clSetCommandQueueProperty(cl_command_queue              command_queue,
                              cl_command_queue_properties   properties,
                              cl_bool                       enable,
                              cl_command_queue_properties * old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED;
#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */

I think it's fine to have a CTS test that ensures the function can be called and things don't blow up, but I don't expect that it will work and change the command-queue properties on all currently shipping implementations. Our GPU implementation unconditionally returns CL_INVALID_VALUE for this API, for example.

I'm all for clarifying the spec to say this more clearly, as I agree this is a bit stronger than "deprecated".

bashbaug avatar Apr 12 '21 18:04 bashbaug

We also never implemented this entry point and I'm not aware of that ever causing problems. I understand that is not consistent with the specification definition of deprecation though.

alycm avatar Apr 14 '21 12:04 alycm

For now I got CL_INVALID_VALUE because properties are broken

I've removed my previous comments. I've analyzed the test once again and my comments were wrong. The test returns always CL_INVALID_VALUE on our GPU and properties are correct

gwawiork avatar Apr 15 '21 07:04 gwawiork

Waiting for feedback on Docs-621 before making significant changes to this test. Parking this unless there is a specific fix the test which can be resolved in the meantime?

ellnor01 avatar Oct 13 '21 17:10 ellnor01

@kpet Rebased and CI checks are passing.

ahesham-arm avatar Jul 11 '24 17:07 ahesham-arm

I think we need to update this test to allow OpenCL implementations newer than OpenCL 1.0 to unconditionally return an error code for this function, see https://github.com/KhronosGroup/OpenCL-Docs/pull/980.

bashbaug avatar Jul 11 '24 18:07 bashbaug

@ahesham-arm Agree with Ben. This test triggered a few discussions and we ended up allowing non-1.0 implementations to just not support this function. There are two options I can think of:

  1. Skip this test on non-1.0 implementations (we might also want to check that it does not use post-1.0 features)
  2. Skip the test at the first call to clSetCommandQueueProperty that returns an error.

I think my preference is for (2) since that seamlessly allows the test to run to completion on implementations that do want to support this function and skip it on others. Implementers can decide to expect pass or skip as a good result.

kpet avatar Jul 11 '24 21:07 kpet

@bashbaug @kpet Thanks for the review. Added the following after the first call to clSetCommandQueueProperty:

if (err == CL_INVALID_OPERATION)
{
    // Implementations are allowed to return an error for
    // non-OpenCL 1.0 devices. In which case, skip the test.
    return TEST_SKIPPED_ITSELF;
}

ahesham-arm avatar Jul 12 '24 08:07 ahesham-arm

Merging as discussed in the August 6th teleconference.

bashbaug avatar Aug 06 '24 16:08 bashbaug