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

[SYCL] Fix usage of uninitialized variable in device_impl #819

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

romanovvlad
Copy link
Contributor

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

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)); }
Copy link
Contributor Author

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?

Copy link
Contributor

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()?

Copy link
Contributor

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.

Copy link
Contributor

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)); }
Copy link
Contributor

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.

@bader bader merged commit 30493bb into intel:sycl Nov 14, 2019
vmaksimo pushed a commit to vmaksimo/llvm that referenced this pull request Nov 30, 2020
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>
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.

4 participants