Skip to content

[SYCL] Remove kernel set id to fix kernel lookup #10551

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 27 commits into from
Aug 14, 2023

Conversation

KseniyaTikhomirova
Copy link
Contributor

No description provided.

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
@KseniyaTikhomirova KseniyaTikhomirova temporarily deployed to aws August 3, 2023 14:55 — with GitHub Actions Inactive
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
@KseniyaTikhomirova KseniyaTikhomirova temporarily deployed to aws August 3, 2023 15:32 — with GitHub Actions Inactive
@KseniyaTikhomirova KseniyaTikhomirova temporarily deployed to aws August 3, 2023 16:19 — with GitHub Actions Inactive
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
@KseniyaTikhomirova KseniyaTikhomirova temporarily deployed to aws August 7, 2023 10:18 — with GitHub Actions Inactive
@KseniyaTikhomirova KseniyaTikhomirova temporarily deployed to aws August 7, 2023 11:18 — with GitHub Actions Inactive
@KseniyaTikhomirova KseniyaTikhomirova changed the title Kernel lookup failure [SYCL] Remove kernel set id to fix kernel lookup Aug 7, 2023
@KseniyaTikhomirova KseniyaTikhomirova marked this pull request as ready for review August 7, 2023 13:17
@KseniyaTikhomirova KseniyaTikhomirova requested a review from a team as a code owner August 7, 2023 13:17
}

std::lock_guard<std::mutex> KernelIDsGuard(m_KernelIDsMutex);
// TODO: There may be cases with sycl::program class usage in source code
Copy link
Contributor

Choose a reason for hiding this comment

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

sycl::program class doesn't exists anymore in our implementation, I doubt that this comment should be re-populated throughout the codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment introduced in 2019 and haven't been fixed for years (9095749). Removing comment as outdated

std::vector<pi_device_binary> RawImgs(std::distance(ItBegin, ItEnd));
auto It = ItBegin;
for (unsigned I = 0; It != ItEnd; ++It, ++I)
RawImgs[I] = const_cast<pi_device_binary>(&It->second->getRawData());
Copy link
Contributor

Choose a reason for hiding this comment

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

const_cast? Can we leave without it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this const cast is not introduced by my change, just moved.
The method that is used here has const return value and const itself:
const pi_device_binary_struct &getRawData(). Then we are getting pointer to that value that has type const pi_device_binary_struct*.

piextDeviceSelectBinary where array is passed to accepts non const data that leads to the necessity of this cast. We could remove const from getRawData return value but I prefer to do cast explicitly only where it is needed and keep it const.
What do you think?

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Copy link
Contributor

@sergey-semenov sergey-semenov left a comment

Choose a reason for hiding this comment

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

LGTM overall, mostly minor comments.

/// Keeps images without entry info.
/// Such images are assumed to contain all kernel associated with the module.
/// Access must be guarded by the \ref m_KernelIDsMutex mutex.
std::unordered_set<RTDeviceBinaryImage *> m_UniversalKernelSet;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this? I think this is just left from when we didn't have kernel entry information embedded in the fat binary, which, after several ABI breaking windows, shouldn't be something we support anymore.

You mentioned that this is still used by some of the tests. Assuming it's done there just for convenience, can we rewrite them to make use of the "proper" path and get rid of this universal kernel set logic altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding filter to throw out useless device image generated when no device code is present in application, will be fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is not blocking this review and can be applied in a follow-up PR.

@KseniyaTikhomirova KseniyaTikhomirova marked this pull request as draft August 10, 2023 13:44
@KseniyaTikhomirova
Copy link
Contributor Author

KseniyaTikhomirova commented Aug 10, 2023

fixed reviewer's comments. converting to draft for a while to double check possible memory leaks of images

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
@KseniyaTikhomirova KseniyaTikhomirova marked this pull request as ready for review August 10, 2023 16:46
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>

/// Caches all exported symbols to allow faster lookup when excluding these
// from kernel bundles.
/// Access must be guarded by the m_KernelIDsMutex mutex.
std::unordered_set<std::string> m_ExportedSymbols;

/// Keeps all device images we are refering to during program lifetime. Used
/// for proper cleanup.
std::unordered_set<RTDeviceBinaryImageUPtr> m_DeviceImages;
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking: why is this an unordered_set instead of a plain vector? Do we ever expect a duplicate image to be inserted here?

@@ -0,0 +1,45 @@
// REQUIRES: gpu, TEMPORARY_DISABLED
Copy link
Contributor

Choose a reason for hiding this comment

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

This is disabled due to a test issue, agreed to have this fixed and enabled in a follow-up PR.


if (m_UniversalKernelSet.size())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (m_UniversalKernelSet.size())
if (!m_UniversalKernelSet.empty())

Nitpick

if (m_UniversalKernelSet.size())
return getDeviceImage(m_UniversalKernelSet, Context, Device,
JITCompilationIsRequired);
else
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
else

Non-blocking, no else after return.

@sergey-semenov
Copy link
Contributor

sergey-semenov commented Aug 14, 2023

Since this PR is urgent and the only remaining comments are non-blocking, I'm merging it as is. Please, address the remaining comments shortly in a follow-up PR.

@sergey-semenov sergey-semenov merged commit e07deff into intel:sycl Aug 14, 2023
oleksandr-pavlyk added a commit to IntelPython/dpctl that referenced this pull request Aug 15, 2023
The intel/llvm/pull/10551 has been merged, so the build should succeed
and produce working binary.
oleksandr-pavlyk added a commit to IntelPython/dpctl that referenced this pull request Aug 15, 2023
The intel/llvm/pull/10551 has been merged, so the build should succeed
and produce working binary.

The intel/llvm project has transitioned from sycl-nightly tags to
nightly tags instead.
oleksandr-pavlyk added a commit to IntelPython/dpctl that referenced this pull request Aug 15, 2023
The intel/llvm/pull/10551 has been merged, so the build should succeed
and produce working binary.

The intel/llvm project has transitioned from sycl-nightly/YYYYMMDD tags to
nightly-YYYY-MM-DD tags instead.
oleksandr-pavlyk added a commit to IntelPython/dpctl that referenced this pull request Aug 15, 2023
The intel/llvm/pull/10551 has been merged, so the build should succeed
and produce working binary.

The intel/llvm project has transitioned from sycl-nightly/YYYYMMDD tags to
nightly-YYYY-MM-DD tags instead.

The artifact of intel/llvm nightly build has also changed the name
and the structure. Adjusting the code for that.
oleksandr-pavlyk added a commit to IntelPython/dpctl that referenced this pull request Aug 15, 2023
The intel/llvm/pull/10551 has been merged, so the build should succeed
and produce working binary.

The intel/llvm project has transitioned from sycl-nightly/YYYYMMDD tags to
nightly-YYYY-MM-DD tags instead.

The artifact of intel/llvm nightly build has also changed the name
and the structure. Adjusting the code for that.
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.

3 participants