Skip to content

Fix slice to selection range conversion #29

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ fn slice_to_selection(slice: Slice) -> Selection {
([], []) => dsl::range(slice.offset()..=slice.offset(), dsl::true_()),
// Special case trivial range `Selection`.
([size, rsizes @ ..], [stride, ..]) if rsizes.iter().all(|s| *s == 1) => dsl::range(
Range(slice.offset(), Some(slice.offset() + *size), *stride),
Range(
slice.offset(),
Some(slice.offset() + *size * *stride),
*stride,
),
dsl::true_(),
),
// Fallback to more heavy-weight translation for everything else.
Expand Down
6 changes: 0 additions & 6 deletions python/tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys
import traceback
from contextlib import contextmanager
from enum import Enum
from typing import Generator

import monarch
Expand Down Expand Up @@ -324,8 +323,6 @@ def test_movement(self, backend_type):
_ = b.to_mesh(sm1)

def test_broadcast_one(self, backend_type):
if backend_type == BackendType.RS:
pytest.skip("deadlocks on rust")
with self.local_device_mesh(2, 2, backend_type) as device_mesh:
for dim in ("host", "gpu"):
subset = device_mesh(**{dim: 1})
Expand All @@ -341,9 +338,6 @@ def test_broadcast_one(self, backend_type):
assert torch.allclose(a.expand(2, -1), b, rtol=0, atol=0)

def test_broadcast_two(self, backend_type):
if backend_type == BackendType.RS:
pytest.skip("deadlocks on rust")

with self.local_device_mesh(2, 2, backend_type) as device_mesh:
subset = device_mesh(host=1, gpu=1)
with subset.activate():
Expand Down