Skip to content

In-place ops deadlock when operands share the same storage #3227

@zackangelo

Description

@zackangelo

In InPlaceOp2, we must acquire a write lock on the lhs tensor's storage and a read lock on the rhs tensor's storage. Because Rust's RwLock is not reentrant, this results in a deadlock when both tensors share the same storage (e.g., are narrowed views into a larger tensor).

pub fn inplace_op2<C: InplaceOp2>(&self, rhs: &Self, c: &C) -> Result<()> {
self.storage_mut()
.inplace_op2(self.layout(), &rhs.storage(), rhs.layout(), c)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions