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

minor modifications #162

Closed
wants to merge 4 commits into from
Closed

Conversation

xiaomx32
Copy link

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

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

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() {
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 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 {
Copy link
Contributor

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.

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.

2 participants