KhronosGroup / WebCL-conformance

WebCL conformance tests
20 stars 15 forks source link

Review::master_r12132013: bindingTesting/programAndKernel/cl_program_build.html #25

Open tonikitoo opened 10 years ago

tonikitoo commented 10 years ago
// Testing for exception "INVALID_OPERATION".
kernelSource = wtu.readKernel("../../../resources/kernels/nbody_simulation.cl");
webCLProgram = wtu.createProgram(webCLContext, kernelSource);
wtu.build(webCLProgram, webCLDevice, null, callback);
shouldThrowExceptionName("webCLProgram.build(webCLDevice);", "INVALID_OPERATION");

exception should only be thrown by the last line if the previous "build" call was not finished.

in my debug though, it shows that the "callback" executes before the exception line executes, so the call passes normally without exception.

Maybe a very large program source, that actually takes time to compile could be what we need, but it is not guarantee anyways.

Well, test should be fixed, regardless.

SharathKamathK commented 10 years ago

I agree this test is very much device dependent. No matter how huge the kernel is, it depends on compilation speed of the underlying OpenCL and the devices.

Tried calling a JS sleep in callback to test this exception, but OpenCL does not throw a exception as build is considered as finished once the callback is called and not once the callback method is completed.

@steveneliuk any inputs on this one ?

tonikitoo commented 10 years ago

maybe refer to that OpenCL test suite?

steveneliuk commented 10 years ago

Thats a tough one,

I shall investigate,

steveneliuk commented 10 years ago

For "INVALID_OPERATION -- if a previous build of this WebCLProgram for any of the devices listed in devices has not completed" one could try building a large kernel on multiple devices, then call again... no guarantee there is more than one device though.

For the other, you could test for objects being attached, from the spec "INVALID_OPERATION -- if there are WebCLKernel objects already attached to this WebCLProgram".

SharathKamathK commented 10 years ago

This is exactly how we are trying to test the exception. But what threw exception for us (passed), is working fine (failing) for Antonio. The problem is the OpenCL build takes less time than time taken by JS engine to goto next statement. So depending on device this test case may pass(slower devices) or fail(faster ones).

The 2nd point is covered in ./conformance/bindingTesting/programAndKernel/cl_program_build.html.

SharathKamathK commented 10 years ago

INVALID_OPERATION if a previous build of this WebCLProgram for any of the devices listed in devices has not completed" cannot be tested as is highly dependent on the device hardware. So its better we remove the test case for this exception, and add a FIXME instead. @tonikitoo if we agree, can we close this bug ?

p.s also remove the huge kernel file is not used elsewhere.