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

Fix bit math #46837

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions c10/core/Stream.h
Expand Up @@ -124,11 +124,11 @@ class Stream final {
}

static Stream unpack(uint64_t bits) {
auto stream_id = static_cast<StreamId>(bits) & 0xFFFFFFFFull;
const auto stream_id = static_cast<StreamId>(bits & 0xFFFFFFFFull);
bits >>= 32;
auto device_index = static_cast<DeviceIndex>(bits) & 0xFFFFull;
const auto device_index = static_cast<DeviceIndex>(bits & 0xFFFFull);
bits >>= 16;
auto device_type = static_cast<DeviceType>(bits);
const auto device_type = static_cast<DeviceType>(bits);
TORCH_CHECK(isValidDeviceType(device_type));
// Unfortunately, we can't check if the StreamId is valid here; it
// will be checked upon first use.
Expand Down