Skip to content

Commit

Permalink
remove first contiguous in multi from_sharded (tinygrad#5121)
Browse files Browse the repository at this point in the history
second contiguous guarantees lbs are contiguous going into MultiLazyBuffer, don't need the first contiguous
  • Loading branch information
chenyuxyz authored Jul 3, 2024
1 parent f1ff65e commit e5ba385
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tinygrad/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __repr__(self):

@staticmethod
def from_sharded(lb:LazyBuffer, devices:Tuple[str, ...], axis:Optional[int]=None):
lbs = [lb.contiguous() if lb.base != lb and not lb.is_unrealized_unmasked_const() else lb] * len(devices)
lbs = [lb] * len(devices)
sharded_lbs = [lb.copy_to_device(d) for lb,d in zip(to_sharded(lbs, axis) if axis is not None else lbs, devices)]
return MultiLazyBuffer([lb if lb.is_unrealized_unmasked_const() else lb.contiguous(allow_buffer_view=False) for lb in sharded_lbs], axis)

Expand Down

0 comments on commit e5ba385

Please sign in to comment.