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

Extend test coverage for clClonekernel #1251

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jainvikas8
Copy link

Add the following test coverage for the clCloneKernel

With args:
Use clSetKernelArg to set args after kernel is cloned. Enqueue and
read the buffer to validate.

With Execinfo:
Use clSetKernelExecInfo after the kernel is cloned and read the buffer
to validate.

With no args:
Clone a kernel with no args and enqueue.

With SVM pointer:
Use clSetKernelArgSVMPointer to set args after kernel is cloned.
Enqueue and read the buffer to validate.

This fixes #1098 and #1234

This PR also replaces test_error with test_assert_error to report the error during failure.

@CLAassistant
Copy link

CLAassistant commented May 14, 2021

CLA assistant check
All committers have signed the CLA.

@jainvikas8
Copy link
Author

I'm seeing

fatal: unable to access 'https://github.com/KhronosGroup/libclcxx.git/': Could not resolve host: github.com
Command exited with code 128

How can we restart this?

@jainvikas8
Copy link
Author

@gwawiork, please review.

@mantognini
Copy link
Contributor

I'm seeing

fatal: unable to access 'https://github.com/KhronosGroup/libclcxx.git/': Could not resolve host: github.com
Command exited with code 128

How can we restart this?

I had the same issue on another PR. I ended up re-pushing (on the same branch) to retrigger another run. Hopefully there's a more clever alternative with a simple button to press somewhere, but I couldn't find it.

@jainvikas8
Copy link
Author

Forced pushed to rebase.

@jainvikas8
Copy link
Author

Forced pushed again, CI was stuck

@gwawiork
Copy link
Contributor

gwawiork commented Aug 5, 2021

Hi @jainvikas8
I've check your changes on Windows on Intel GPU and I am getting
ERROR: clFinish failed! (CL_OUT_OF_RESOURCES from C:\NewVPG\Repo\public-github\opensource-qb\OpenCL-CTS\test_conformance\api\test_clone_kernel.cpp:524) test_exec_enqueue_helper failed for cloneKernel_2 on retry. clCloneKernel test_cloned_kernel_exec_info failed. clone_kernel FAILED

The test process is not able to exit looks like hang. Could you double check on your side if everything is ok ? I will analyze the problem as well.

@jainvikas8
Copy link
Author

Forced pushed to rebase.

@jainvikas8
Copy link
Author

Hi @jainvikas8
I've check your changes on Windows on Intel GPU and I am getting
ERROR: clFinish failed! (CL_OUT_OF_RESOURCES from C:\NewVPG\Repo\public-github\opensource-qb\OpenCL-CTS\test_conformance\api\test_clone_kernel.cpp:524) test_exec_enqueue_helper failed for cloneKernel_2 on retry. clCloneKernel test_cloned_kernel_exec_info failed. clone_kernel FAILED

The test process is not able to exit looks like hang. Could you double check on your side if everything is ok ? I will analyze the problem as well.

Have not observed this in the past, normally it should fail for this too.
test_exec_enqueue_helper failed for cloneKernel_1 on the retry
Will look into reproducing this issue. Thanks.

sizeof(svmCaps), &svmCaps, NULL);
test_error(error, "Unable to query CL_DEVICE_SVM_CAPABILITIES");

if (svmCaps != 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should return TEST_SKIPPED_ITSELF in case svmCaps == 0 now there is TEST_PASS

Copy link
Author

Choose a reason for hiding this comment

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

I think we should return TEST_SKIPPED_ITSELF in case svmCaps == 0 now there is TEST_PASS

Acknowledged

cl_command_queue queue, int num_elements)
{
if (test_buff_image_multiple_args(deviceID, context, queue, num_elements)
!= 0)
Copy link
Author

Choose a reason for hiding this comment

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

Check for TEST_FAIL as test can be

    TEST_PASS = 0,
    TEST_FAIL = 1,
    TEST_SKIP = 2,
    TEST_SKIPPED_ITSELF = -100,

@jainvikas8
Copy link
Author

Forced pushed to rebase and add 2 new commits to address the review comments.

@jainvikas8
Copy link
Author

Hi @jainvikas8
I've check your changes on Windows on Intel GPU and I am getting
ERROR: clFinish failed! (CL_OUT_OF_RESOURCES from C:\NewVPG\Repo\public-github\opensource-qb\OpenCL-CTS\test_conformance\api\test_clone_kernel.cpp:524) test_exec_enqueue_helper failed for cloneKernel_2 on retry. clCloneKernel test_cloned_kernel_exec_info failed. clone_kernel FAILED
The test process is not able to exit looks like hang. Could you double check on your side if everything is ok ? I will analyze the problem as well.

Have not observed this in the past, normally it should fail for this too.
test_exec_enqueue_helper failed for cloneKernel_1 on the retry
Will look into reproducing this issue. Thanks.

@gwawiork I've been unable to reproduce this issue on MALI-GPU in Linux with OpenCL 2.1 and 3.0. So, please let me know your thoughts on this?

clSVMFree(context, svmPtr_srcKernel_1);

// enqueue - cloneKernel_1 again, to check if the args were not modified
if (test_exec_enqueue_helper(context, queue, pBuf, svmPtr_cloneKernel_1,

Choose a reason for hiding this comment

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

From this point on, pBuf still contains pointer to svmPtr_srcKernel_1.
Since test_exec_enqueue_helper does not update the pBuf, the cloneKernel_1 will receive an invalid pointer as argument.

The pointer inside pBuf needs to be updated before enqueuing the kernel.

Copy link
Author

Choose a reason for hiding this comment

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

I have moved clSVMFree to free the buffers in the end.

Comment on lines 549 to 550
error = clFinish(queue);
test_error(error, "clFinish failed");

Choose a reason for hiding this comment

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

This clFinish should not be needed, since clEnqueueSVMMap is made blocking by passing it CL_TRUE as the second argument.

Copy link
Author

Choose a reason for hiding this comment

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

done

"set_kernel_exec_info_kernel");
test_error(error, "Unable to create srcKernel");

BufPtr* pBuf =

Choose a reason for hiding this comment

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

It looks like the same structure pBuf will be passed to each kernel (as a pointer) and only the pBuf->store will be updated before enqueuing each kernel. Not sure if this is intended?

Copy link
Author

@jainvikas8 jainvikas8 Dec 13, 2021

Choose a reason for hiding this comment

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

@ddabek-i It is indeed intended. We use it to test clSetKernelexecinfo with clCloneKernel

@ddabek-i
Copy link

@jainvikas8 Please take a look at my review when you have the time.

@lakshmih
Copy link
Contributor

[Qualcomm] We tested this and it passed on our 3.0 implementation. Will need more time for a detailed review.

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.

This is a nice start but there are a few nice-to-have fixes and please check that the call to clSetKernelExecInfo is correct.

I also see there is a fair amount of code duplication between the SVM and SVM kernel exec info tests - have you considered any ways to reduce this code duplication?

Thanks!

"}\n"

};
const char* clone_kernel_test_kernel[] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: consider using C++11 raw string literals here to make these tests easier to read and modify.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

Comment on lines 246 to 235
cl_kernel* srcKernel, cl_int* value,
cl_mem* bufOut)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I think we should pass the kernel, the value, and the buffer by value, rather than as a pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

error = clSetKernelArgSVMPointer(*srcKernel, 1, pBuf);
test_error(error, "clSetKernelArgSVMPointer failed");
error = clSetKernelExecInfo(*srcKernel, CL_KERNEL_EXEC_INFO_SVM_PTRS,
sizeof(pBuf), pBuf);
test_error(error, "clSetKernelExecInfo failed");
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't quite look correct to me. pBuf is already set as an SVM pointer kernel argument, so it does not also need to be passed via clSetKernelExecInfo, but svmPtr_Kernel does. Can you please check that we shouldn't be passing svmPtr_Kernel to clSetKernelExecInfo instead of pBuf?

Copy link
Contributor

Choose a reason for hiding this comment

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

The call to clSetKernelExecInfo is not needed here, removed.

Comment on lines 512 to 509
BufPtr* pBuf, cl_int* svmPtr_Kernel,
cl_kernel* srcKernel, cl_int* value)
Copy link
Contributor

Choose a reason for hiding this comment

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

See above - I think we can pass most (if not all) of these by value.

Do we need to pass pBuf at all?

Minor: I'd also consider renaming this function to something like test_SVM_enqueue_helper, since this helper could work for other SVM tests and not just tests for clSetKernelExecInfo.

Copy link
Contributor

Choose a reason for hiding this comment

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

srcKernel and value are now passed by value.
pBuf removed as it was not used.
Function renamed to test_svm_enqueue_helper and the other helper removed.

Comment on lines 742 to 740
int test_svm_enqueue_helper(cl_context context, cl_command_queue queue,
cl_int* svmPtr_Kernel, cl_kernel* srcKernel,
cl_int* value)
Copy link
Contributor

Choose a reason for hiding this comment

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

See above - do we need another helper here, or can we reuse the previous helper from clSetKernelExecInfo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

@bashbaug
Copy link
Contributor

bashbaug commented Jun 1, 2022

Removing "focused review" until this PR has an updated owner.

JohnKesapidesARM added a commit to JohnKesapidesARM/OpenCL-CTS that referenced this pull request Oct 17, 2022
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Use `clSetKernelArg` to set args after kernel is cloned. Enqueue and
read the buffer to validate.
The test uses `buf_write_kernel` kernel program with 2 arguments.

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
In test_clone_kernel, if `clEnqueueReadBuffer` was a success then
the error code would be `CL_SUCCESS`, which will not print the error
message when buffer validation fails, therefore replace with
`test_assert_error` to print the error message.

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
Use `clSetKernelExecInfo` after kernel is cloned and read the buffer
to validate.

The test uses the `set_kernel_exec_info_kernel` kernel program
with 2 arguments.

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
Clone a kernel with no args and enqueue.
The test uses `test_kernel_empty` kernel program with no arguments.

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
Use `clSetKernelArgSVMPointer` to set args after kernel is cloned.
Enqueue and read the buffer to validate.
The test uses `buf_write_kernel` kernel program with 2 arguments.

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
@ahesham-arm
Copy link
Contributor

@kpet Rebased and CI checks are passing.
@bashbaug Addressed outstanding review comments.

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