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

[SYCLomatic] Fix unsuccessful compilation of dpct::load_kernel_library_mem due to failed argument cast #2525

Merged
merged 8 commits into from
Dec 2, 2024

Conversation

the-slow-one
Copy link
Collaborator

@the-slow-one the-slow-one commented Nov 29, 2024

Here is the CUDA source and migrated SYCL code.

void test(CUmodule module, unsigned char* data) {
  cuModuleLoadData(&module, data);
}
#include <sycl/sycl.hpp>                                                                                                                                                                                                                                                                           #include <dpct/dpct.hpp>
void test(dpct::kernel_library module, unsigned char* data) {
  /*
  DPCT1104:0: 'data' should point to a dynamic library loaded in memory. The
  dynamic library should supply wrapped kernel functions.
  */
  module = dpct::load_kernel_library_mem(data);
}

icpx fails to compile the migrated code with following error.

dpct_output/src.dp.cpp:11:42: error: cannot initialize a parameter of type 'const char *' with an lvalue of type 'u8 *' (aka 'unsigned char *')
11 |   module = dpct::load_kernel_library_mem(data);
   |                                          ^~~~
/nfs/shm/proj/icl/cmplrarch/deploy_syclct/llorgsyclctefi2linux/20241125_160000/build/linux_qa_release/include/dpct/kernel.hpp:376:72: note: passing argument to parameter 'image' here
376 | static inline kernel_library load_kernel_library_mem(char const *const image) {
    |                                                                        ^
1 error generated.

This PR fixes this issue by explicitly casting the pointer the expected type.

Signed-off-by: Deepak Raj H R

@the-slow-one the-slow-one removed the request for review from ziranzha November 29, 2024 06:04
@zhimingwang36 zhimingwang36 merged commit dc616d9 into oneapi-src:SYCLomatic Dec 2, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

5 participants