-
Notifications
You must be signed in to change notification settings - Fork 194
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
Re-enabling narrowing errors #1144
base: main
Are you sure you want to change the base?
Conversation
e41f811
to
f46c622
Compare
c16511e
to
25983c6
Compare
Any comments on here? |
25983c6
to
629fb20
Compare
@ahesham-arm This is failing the CI. It may require a rebase and/or fixes. |
08da74d
to
2b418b0
Compare
@kpet Rebased and all CI checks are now passing. |
@@ -274,7 +274,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest | |||
&pattern[0], 0, nullptr, nullptr); | |||
test_error(error, "clEnqueueWriteBuffer failed"); | |||
|
|||
cl_int offset[] = { 0, pattern.size() - 1 }; | |||
size_t offset[] = { 0, pattern.size() - 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.
Can you please check that this change is correct? I'm nervous that going from a 32-bit type (cl_int
) to a possibly 64-bit type (size_t
) may require some additional changes.
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.
offset
is used in 3 locations in this function, two are trivial loop comparisons against another size_t
, so those are fine. The other, main one, is a call to clEnqueueWriteBuffer
which expects a void*
and the size in bytes. The call is already using sizeof
so I don't see why this would fail regardless of the data type and/or architecture.
TestFns set = { (int)0xffffffff, | ||
(long long)0xffffffffffffffffLL, |
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 might be better to cast these to the types used in the structure, which are guaranteed to have a fixed size, rather than int
and long long
that could be different sizes for different compilers.
TestFns set = { (int)0xffffffff, | |
(long long)0xffffffffffffffffLL, | |
TestFns set = { (cl_int)0xffffffff, | |
(cl_long)0xffffffffffffffffLL, |
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
2b418b0
to
d5937ea
Compare
@@ -274,7 +274,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest | |||
&pattern[0], 0, nullptr, nullptr); | |||
test_error(error, "clEnqueueWriteBuffer failed"); | |||
|
|||
cl_int offset[] = { 0, pattern.size() - 1 }; | |||
size_t offset[] = { 0, pattern.size() - 1 }; | |||
error = clEnqueueWriteBuffer(queue, off_mem, CL_TRUE, 0, sizeof(offset), | |||
offset, 0, nullptr, nullptr); | |||
test_error(error, "clEnqueueWriteBuffer 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.
off_mem is created for sizeof(cl_int) size so I think the enqueuewritebuffer to it using sizeof(size_t) can cause issues.
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 now using cl_uint
for the type of the array and an assert is added to ensure the casting is safe.
@@ -115,7 +115,8 @@ struct CreateCommandBufferRepeatedProperties : public BasicCommandBufferTest | |||
TEST_FAIL); | |||
|
|||
cl_command_buffer_properties_khr invalid_properties[3] = { | |||
CL_COMMAND_BUFFER_FLAGS_KHR, CL_INVALID_PROPERTY, 0 | |||
CL_COMMAND_BUFFER_FLAGS_KHR, | |||
(cl_command_buffer_properties_khr)CL_INVALID_PROPERTY, 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.
Not sure CL_INVALID_PROPERTY can be used in a property list like this. The spec only specifies its usage as a return 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.
I have used -1
instead.
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.
Left some comments
Fixes narrowing conversion build errors in test_common Removing disable of narrowing errors in main CMakeLists.txt and moving it down to test_conformance CMakeLists.txt where there are many more build errors revealed from this fix Contributes KhronosGroup#787 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
d5937ea
to
2c9e7d3
Compare
Moves -Wno-narrowing down to only run on suites with many narrowing errors. Includes some quick fixes for one-off errors this caused. Contributes KhronosGroup#787 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Includes fix for MacOS build error Contributes KhronosGroup#787 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Contributes KhronosGroup#787 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2c9e7d3
to
a27cdc3
Compare
Fixes narrowing conversion build errors in test_common
Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's
CMakeLists.txt where there are many more build errors revealed
from this fix.
Fixes a few simple issues under test_conformance in the process.
Contributes #787
Signed-off-by: Ellen Norris-Thompson ellen.norris-thompson@arm.com