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

gpuinfo reports wrong workitem dimensions for 32-bit architectures #24

Open
doe300 opened this issue Sep 3, 2017 · 5 comments
Open

Comments

@doe300
Copy link

doe300 commented Sep 3, 2017

The value returned by clGetDeviceInfo with the parameter CL_DEVICE_MAX_WORK_ITEM_SIZES is of type size_t[] and is read by easycl::printDeviceInfoArray() as cl_ulong[].
Since for 32-bit systems, size_t is unsigned int, not unsigned long, the value read is wrong.

@hughperkins
Copy link
Owner

Ok. Thoughts on how to fix this?

@doe300
Copy link
Author

doe300 commented Sep 4, 2017

If all device-info queries which use easycl::printDeviceInfoArray() have the type size_t[], you could just rewrite this method to use a size_t array.

Otherwise, copy easycl::printDeviceInfoArray() and write a version for arrays of type size_t. Or make it a template-function with specializations for both cl_ulongand size_t and use the correct one.

@hughperkins
Copy link
Owner

First option sounds tempting, but it's not very general, is that a fair impression?

Second option sounds plausible, and easy-ish. Would need to keep the old function in, for backwards compatibility.

One variant on the second is, looks like clGetDeviceInfo can tell us the size in bytes of the data being returned? https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clGetDeviceInfo.html

@doe300
Copy link
Author

doe300 commented Sep 4, 2017

Yeah, 1 is the more simple one, but will introduce other errors, if for some query cl_ulong[] is returned. Which, as far as I can tell, is never used as a return-type for a device-query in OpenCL 2.1, but may be used by extensions or future versions.

As to getting the byte-size of the type returned: The type-size can be calculated, and then you could use formatted printing (with either %uor %ul) depending on the byte-size of the type.

@hughperkins
Copy link
Owner

As to getting the byte-size of the type returned: The type-size can be calculated, and then you could use formatted printing (with either %uor %ul) depending on the byte-size of the type.

Yes. Well, at least have a case switch, with the size_t and cl_long types for now, and an exception for other types.

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

No branches or pull requests

2 participants