Skip to content

[SYCL][CUDA] Multiple fixes #1299

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

Merged
merged 1 commit into from
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::string platformInfoToString(pi_platform_info info);
template <class To, class From> To cast(From value);

// Holds the PluginInformation for the plugin that is bound.
// Currently a global varaible is used to store OpenCL plugin information to be
// Currently a global variable is used to store OpenCL plugin information to be
// used with SYCL Interoperability Constructors.
extern std::shared_ptr<plugin> GlobalPlugin;

Expand Down
10 changes: 9 additions & 1 deletion sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
pi_uint64{max_alloc});
}
case PI_DEVICE_INFO_IMAGE_SUPPORT: {
return getInfo(param_value_size, param_value, param_value_size_ret, false);
return getInfo(param_value_size, param_value, param_value_size_ret,
PI_FALSE);
}
case PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS: {
return getInfo(param_value_size, param_value, param_value_size_ret, 0);
Expand Down Expand Up @@ -2921,6 +2922,11 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
// PI interface supports higher version or the same version.
strncpy(PluginInit->PluginVersion, SupportedVersion, 4);

// Set whole function table to zero to make it easier to detect if
// functions are not set up below.
std::memset(&(PluginInit->PiFunctionTable), 0,
sizeof(PluginInit->PiFunctionTable));

// Forward calls to OpenCL RT.
Copy link
Contributor

Choose a reason for hiding this comment

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

OpenCL RT, really? )

Copy link
Contributor

Choose a reason for hiding this comment

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

@bjoernknafla, would you like to address this comment before the merge or after?

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, it will be addressed by #1241.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch and thank you for tracking it being fixed by @fwyzard !

#define _PI_CL(pi_api, cuda_api) \
(PluginInit->PiFunctionTable).pi_api = (decltype(&::pi_api))(&cuda_api);
Expand Down Expand Up @@ -2975,6 +2981,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
_PI_CL(piKernelRetain, cuda_piKernelRetain)
_PI_CL(piKernelRelease, cuda_piKernelRelease)
_PI_CL(piKernelSetExecInfo, cuda_piKernelSetExecInfo)

// Event
_PI_CL(piEventCreate, cuda_piEventCreate)
_PI_CL(piEventGetInfo, cuda_piEventGetInfo)
Expand Down Expand Up @@ -3006,6 +3013,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
_PI_CL(piEnqueueMemImageFill, cuda_piEnqueueMemImageFill)
_PI_CL(piEnqueueMemBufferMap, cuda_piEnqueueMemBufferMap)
_PI_CL(piEnqueueMemUnmap, cuda_piEnqueueMemUnmap)

_PI_CL(piextKernelSetArgMemObj, cuda_piextKernelSetArgMemObj)

#undef _PI_CL
Expand Down