-
Notifications
You must be signed in to change notification settings - Fork 733
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
[SYCL] Fix usage of uninitialized variable in device_impl #819
[SYCL] Fix usage of uninitialized variable in device_impl #819
Conversation
MType variable is not initialized for the host device. The patch changes several device_impl methods to avoid using MType if a device is a host one. Signed-off-by: Vlad Romanov <vlad.romanov@intel.com>
@@ -74,17 +74,19 @@ class device_impl { | |||
/// Check if device is a CPU device | |||
/// | |||
/// @return true if SYCL device is a CPU device | |||
bool is_cpu() const { return (MType == PI_DEVICE_TYPE_CPU); } | |||
bool is_cpu() const { return (!is_host() && (MType == PI_DEVICE_TYPE_CPU)); } |
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 it's right approach. Probably the right approach would be to add new device type(host) to _pi_device_type enum. What do you think?
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 don't think PI wants to cover "host". It is rather interface for offloading. So I think what you are doing is preferable, but is it really OK that we return false in all of these for "host"? Should we return true for is_cpu()?
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.
@smaslov-intel technically, host device is not CPU, it is host. But I agree with your point about covering host on PI.
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.
OK, then I am OK with the fix.
@@ -74,17 +74,19 @@ class device_impl { | |||
/// Check if device is a CPU device | |||
/// | |||
/// @return true if SYCL device is a CPU device | |||
bool is_cpu() const { return (MType == PI_DEVICE_TYPE_CPU); } | |||
bool is_cpu() const { return (!is_host() && (MType == PI_DEVICE_TYPE_CPU)); } |
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.
OK, then I am OK with the fix.
At this point LoopControlParameters can be empty only if a single metadata llvm.loop.ivdep.enable is attached to a branch instruction. Signed-off-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
MType variable is not initialized for the host device. The patch
changes several device_impl methods to avoid using MType if a
device is a host one.
Signed-off-by: Vlad Romanov vlad.romanov@intel.com