-
Notifications
You must be signed in to change notification settings - Fork 199
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
base: main
Are you sure you want to change the base?
Extend test coverage for clClonekernel
#1251
Conversation
I'm seeing
How can we restart this? |
@gwawiork, please review. |
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. |
4b4ddc9
to
2bbf5ec
Compare
Forced pushed to rebase. |
2bbf5ec
to
95001a6
Compare
Forced pushed again, CI was stuck |
Hi @jainvikas8 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. |
95001a6
to
a9364f8
Compare
Forced pushed to rebase. |
Have not observed this in the past, normally it should fail for this too. |
sizeof(svmCaps), &svmCaps, NULL); | ||
test_error(error, "Unable to query CL_DEVICE_SVM_CAPABILITIES"); | ||
|
||
if (svmCaps != 0) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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,
a9364f8
to
40aed32
Compare
Forced pushed to rebase and add 2 new commits to address the review comments. |
@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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
error = clFinish(queue); | ||
test_error(error, "clFinish failed"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
@jainvikas8 Please take a look at my review when you have the time. |
40aed32
to
06a81db
Compare
[Qualcomm] We tested this and it passed on our 3.0 implementation. Will need more time for a detailed review. |
There was a problem hiding this 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[] = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
cl_kernel* srcKernel, cl_int* value, | ||
cl_mem* bufOut) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
BufPtr* pBuf, cl_int* svmPtr_Kernel, | ||
cl_kernel* srcKernel, cl_int* value) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
int test_svm_enqueue_helper(cl_context context, cl_command_queue queue, | ||
cl_int* svmPtr_Kernel, cl_kernel* srcKernel, | ||
cl_int* value) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Removing "focused review" until this PR has an updated owner. |
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>
Review comments
06a81db
to
0bfdac1
Compare
Review comments
0bfdac1
to
938be73
Compare
Add the following test coverage for the
clCloneKernel
With args:
Use
clSetKernelArg
to set args after kernel is cloned. Enqueue andread the buffer to validate.
With Execinfo:
Use
clSetKernelExecInfo
after the kernel is cloned and read the bufferto 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
withtest_assert_error
to report the error during failure.