-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[OpenCL] Introduce OpenCL wrapper to TVM #13362
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
Conversation
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment. Generated by tvm-bot |
548d1cf to
fb3f5a6
Compare
fb3f5a6 to
6614443
Compare
|
@elvin-n Can you review this? |
446941f to
8ecacf8
Compare
csullivan
left a comment
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.
Many thanks for this great improvement to the user experience of compiling and running code on remote OpenCL devices @echuraev!
| /*! | ||
| * \file opencl_wrapper.cc | ||
| */ |
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 we note the version of opencl for which this wrapper is applicable?
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.
Added information about OpenCL version. Currently, this wrapper is applicable for OpenCL 1.2. Because it is version which is used in TVM. But we can easily uplift this version, then it will be necessary.
|
@tvm-bot rerun |
|
@tvm-bot rerun |
This wrapper helps dynamically loading OpenCL library. It allows us to avoid of looking for and copying OpenCL library to host, looking for OpenCL SDK.
Also, use OpenCL wrapper by default and fix Windows build
0df05af to
0453286
Compare
|
We discussed this in the TVM community meeting this morning. Here are notes:
|
As it was mentioned in apache#13362, it would be nice to add check when the user is using a version of libOpenCL.so that is too old. In this PR we introduce this functionality. In the `init` method, we traverse through all OpenCL devices and check their version. If the version is older than the target version in TVM, then we notify the user that we will skip this device. We cannot throw any exception from method `init` because it is possible that you have compiled host code with OpenCL support, but the host device won't have any OpenCL device which is supported by TVM (e.g. they all have too old version of libOpenCL.so). From OpenCL codegen we call function OpenCLModuleCreate. In the OpenCLModuleCreate init function might be called and in this case an exception will be generated on the host side although that the target device might be supported by TVM. This is why we don't throw any exceptions in the init function. If in the runtime we use some OpenCL methods and the list of the devices is empty, then we will generate an exception and notify user that possible reason is because version of libOpenCL.so is too old.
As it was mentioned in apache#13362, it would be nice to add check when the user is using a version of libOpenCL.so that is too old. In this PR we introduce this functionality. In the `init` method, we traverse through all OpenCL devices and check their version. If the version is older than the target version in TVM, then we notify the user that we will skip this device. We cannot throw any exception from method `init` because it is possible that you have compiled host code with OpenCL support, but the host device won't have any OpenCL device which is supported by TVM (e.g. they all have too old version of libOpenCL.so). From OpenCL codegen we call function OpenCLModuleCreate. In the OpenCLModuleCreate init function might be called and in this case an exception will be generated on the host side although that the target device might be supported by TVM. This is why we don't throw any exceptions in the init function. If in the runtime we use some OpenCL methods and the list of the devices is empty, then we will generate an exception and notify user that possible reason is because version of libOpenCL.so is too old.
As it was mentioned in apache#13362, it would be nice to add check when the user is using a version of libOpenCL.so that is too old. In this PR we introduce this functionality. In the `init` method, we traverse through all OpenCL devices and check their version. If the version is older than the target version in TVM, then we notify the user that we will skip this device. We cannot throw any exception from method `init` because it is possible that you have compiled host code with OpenCL support, but the host device won't have any OpenCL device which is supported by TVM (e.g. they all have too old version of libOpenCL.so). From OpenCL codegen we call function OpenCLModuleCreate. In the OpenCLModuleCreate init function might be called and in this case an exception will be generated on the host side although that the target device might be supported by TVM. This is why we don't throw any exceptions in the init function. If in the runtime we use some OpenCL methods and the list of the devices is empty, then we will generate an exception and notify user that possible reason is because version of libOpenCL.so is too old.
As it was mentioned in #13362, it would be nice to add check when the user is using a version of libOpenCL.so that is too old. In this PR we introduce this functionality. In the `init` method, we traverse through all OpenCL devices and check their version. If the version is older than the target version in TVM, then we notify the user that we will skip this device. We cannot throw any exception from method `init` because it is possible that you have compiled host code with OpenCL support, but the host device won't have any OpenCL device which is supported by TVM (e.g. they all have too old version of libOpenCL.so). From OpenCL codegen we call function OpenCLModuleCreate. In the OpenCLModuleCreate init function might be called and in this case an exception will be generated on the host side although that the target device might be supported by TVM. This is why we don't throw any exceptions in the init function. If in the runtime we use some OpenCL methods and the list of the devices is empty, then we will generate an exception and notify user that possible reason is because version of libOpenCL.so is too old.
* [OpenCL] Introduce OpenCL wrapper to TVM This wrapper helps dynamically loading OpenCL library. It allows us to avoid of looking for and copying OpenCL library to host, looking for OpenCL SDK. * Update apps and documentation * Apply comments * Apply comments and fix Android build Also, use OpenCL wrapper by default and fix Windows build * Apply comments * Update LICENSE file
As it was mentioned in apache#13362, it would be nice to add check when the user is using a version of libOpenCL.so that is too old. In this PR we introduce this functionality. In the `init` method, we traverse through all OpenCL devices and check their version. If the version is older than the target version in TVM, then we notify the user that we will skip this device. We cannot throw any exception from method `init` because it is possible that you have compiled host code with OpenCL support, but the host device won't have any OpenCL device which is supported by TVM (e.g. they all have too old version of libOpenCL.so). From OpenCL codegen we call function OpenCLModuleCreate. In the OpenCLModuleCreate init function might be called and in this case an exception will be generated on the host side although that the target device might be supported by TVM. This is why we don't throw any exceptions in the init function. If in the runtime we use some OpenCL methods and the list of the devices is empty, then we will generate an exception and notify user that possible reason is because version of libOpenCL.so is too old.
This wrapper helps dynamically loading OpenCL library. It allows us to avoid of looking for and copying OpenCL library to host, looking for OpenCL SDK.
cc: @elvin-n, @masahi, @csullivan