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

Refactor synchronization #62

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Apr 18, 2016

  1. refactor/tensor: refactor synchronization and memory access interface

    Remove methods `sync()`, `get()`, `get_mut()`, `remove_copy()` of
    `SharedTensor` and introduce new set of methods: `read()`, `read_write()`,
    `write_only()`, `drop_device()`. Signature of `SharedTensor::new()` has also
    changed.
    
    New API has following benefits:
     - limited checks of use of uninitialized memory,
     - better memory tracking: several memories can be simultaneously marked as
       up-to-date, so some synchronization operations might be skipped,
     - backing memory is automatically allocated on the first use and added to
       `SharedTensor`, even if it's immutable. Mutability is required only for
       reshaping, modifying actual data and dropping memories.
    
    Rationale and design decisions are discussed at the corresponding bugtracker
    issue.
    
    BREAKING CHANGE: sync and memory management API of `SharedTensor`
    
    CLOSE: autumnai#37
    alexandermorozov committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    c1eb168 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9c4918b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f76ced4 View commit details
    Browse the repository at this point in the history
  4. test/tensor: add several compile tests for SharedTensor API

    Implementation of SharedTensor uses `unsafe` to extend lifetime of memory
    references that are returned by read/write family of methods. Those tests
    verify that attempts to create dangling pointers or otherwise misuse API
    fail at compile time.
    alexandermorozov committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    df02d48 View commit details
    Browse the repository at this point in the history
  5. refactor/tensor: remove unused error types

    During refactoring (autumnai#37) several error were upgraded into panics. Those
    errors may happen only if internal logic of `SharedTensor` is incorrect
    and leads to inconsistent state and broken invariants.
    alexandermorozov committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    947d966 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2016

  1. Configuration menu
    Copy the full SHA
    926f1e3 View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2016

  1. feat/plugin: impl From<tensor::Error> for plugin::Error

    Since plugin operations rely on `SharedTensor`'s memory access and allocation
    API, they need to proxy errors. This commit adds new error enum entry to
    plugin::Error, and removes deprecated plugin::Error::MissingMemoryForDevice.
    It also adds autoconversion from plugin::Error::SharedTensor for convenient
    use of `try!`.
    alexandermorozov committed Apr 23, 2016
    Configuration menu
    Copy the full SHA
    753a773 View commit details
    Browse the repository at this point in the history
  2. refactor/tensor: return SharedTensor from new instead of `Result<…

    …..>`
    
    Allocation of `SharedTensor` may fail only on OOM, so returning `Result` type
    is redundant.
    alexandermorozov committed Apr 23, 2016
    Configuration menu
    Copy the full SHA
    6a21c7f View commit details
    Browse the repository at this point in the history