-
Notifications
You must be signed in to change notification settings - Fork 70
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
minor modifications #162
minor modifications #162
Conversation
xiaomx32
commented
Dec 29, 2024
- add the initialization of the '_default_io' variable to the 'initialization list'
- avoid repeated calls to 'cuDriverGetVersion' or 'cuDeviceGetCount' function
- remove seemingly redundant parameters
- remove unused header files
// provide a default binary IO | ||
if (_io == nullptr) { | ||
_default_io = luisa::make_unique<DefaultBinaryIO>(context()); |
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.
This change is incorrect. The original implementation only creates _default_io
when input io
is nullptr, but now it's always created.
) noexcept | ||
: DeviceInterface { std::move(ctx) } | ||
, _handle { device_id } | ||
, _default_io { luisa::make_unique<DefaultBinaryIO>(context()) } |
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.
See comments below.
@@ -1023,14 +1026,18 @@ static constexpr auto required_cuda_version_major = 11; | |||
static constexpr auto required_cuda_version_minor = 7; | |||
static constexpr auto required_cuda_version = required_cuda_version_major * 1000 + required_cuda_version_minor * 10; | |||
|
|||
static void initialize() { | |||
[[nodiscard]] | |||
static std::pair<int, int> initialize() { |
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.
This is incorrect. If we create multiple devices, all devices other than the first will receive incorrect driver version and device count.
@@ -208,7 +208,7 @@ Device Context::create_device( | |||
interface->_backend_name = std::move(backend_name); | |||
auto handle = Device::Handle { | |||
interface, | |||
[impl = _impl, deleter = m.deleter](auto p) noexcept { | |||
[deleter = m.deleter](auto p) noexcept { |
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.
_impl
is captured to extend its lifetime until device handle is destroyed. You CANNOT remove it.