-
Notifications
You must be signed in to change notification settings - Fork 171
Various handle-related changes and improvements #463
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
Changes from all commits
5408229
8384937
299ce8d
674cee7
650e3ae
18a9c85
b59918b
aee4a4f
2189cb1
37a6850
43654c4
bc9595b
7db6642
63f7feb
c96f6de
e4cde77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||
// Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. | ||||||||||||||||||||||||||||
// | ||||||||||||||||||||||||||||
// SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
#pragma once | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
#include <type_traits> | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
// In cuda.bindings 12.8, the private member name was renamed from "_ptr" to "_pvt_ptr". | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzhurba01 do you recall what prompted this change when updating to 12.8? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're using a private member? Do we own the code with the private member? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we own everything, they are autogen'd, for example for cuda-python/cuda_bindings/cuda/bindings/driver.pxd.in Lines 185 to 197 in 02a4178
hence I feel SFINAE over all possibilities is OK. I think if we accidentally change the codegen in the future, the added Cython test should be able to catch it. |
||||||||||||||||||||||||||||
// We want to have the C++ layer supporting all past 12.x versions, so some tricks are needed. | ||||||||||||||||||||||||||||
// Since there's no std::has_member<T, member_name> so we use SFINAE to create the same effect. | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
template <typename T, | ||||||||||||||||||||||||||||
std::enable_if_t<std::is_pointer_v<decltype(std::remove_pointer_t<T>::_pvt_ptr)>, int> = 0> | ||||||||||||||||||||||||||||
inline auto& get_cuda_native_handle(const T& obj) { | ||||||||||||||||||||||||||||
return *(obj->_pvt_ptr); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
template <typename T, | ||||||||||||||||||||||||||||
std::enable_if_t<std::is_pointer_v<decltype(std::remove_pointer_t<T>::_ptr)>, int> = 0> | ||||||||||||||||||||||||||||
inline auto& get_cuda_native_handle(const T& obj) { | ||||||||||||||||||||||||||||
return *(obj->_ptr); | ||||||||||||||||||||||||||||
} |
Uh oh!
There was an error while loading. Please reload this page.