-
Notifications
You must be signed in to change notification settings - Fork 33
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
alexandermorozov
wants to merge
8
commits into
autumnai:master
Choose a base branch
from
alexandermorozov:refactor-sync
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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.
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.
…_CHANGELOG] REFERENCE: autumnai#37
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!`.
…..>` Allocation of `SharedTensor` may fail only on OOM, so returning `Result` type is redundant.
alexandermorozov
force-pushed
the
refactor-sync
branch
from
April 23, 2016 16:46
c128a9b
to
6a21c7f
Compare
alexandermorozov
added a commit
to alexandermorozov/collenchyma-blas
that referenced
this pull request
Apr 23, 2016
Refactor code CUDA and Native backend to match #autumnai/collenchyma/62 that provides enchanced memory management and syncronization. Since memory management is now automatic, `*_plain` variants of functions are removed. BREAKING CHANGE: *_plain versions of API functions are removed, arguments of their counterpart functions may have changed in mutablity. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62 refactor/native: convert to the new memory management API Convert Native backend. Code now compiles.
alexandermorozov
added a commit
to alexandermorozov/collenchyma-nn
that referenced
this pull request
Apr 24, 2016
Refactor code CUDA and Native backend to match #autumnai/collenchyma/62 that provides enchanced memory management and syncronization. Since memory management is now automatic, `*_plain` variants of functions are removed. BREAKING CHANGE: *_plain versions of API functions are removed, arguments of their counterpart functions may have changed in mutablity. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/collenchyma-blas
that referenced
this pull request
Apr 24, 2016
Refactor code CUDA and Native backend to match #autumnai/collenchyma/62 that provides enchanced memory management and syncronization. Since memory management is now automatic, `*_plain` variants of functions are removed. BREAKING CHANGE: *_plain versions of API functions are removed, arguments of their counterpart functions may have changed in mutablity. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/collenchyma-nn
that referenced
this pull request
Apr 24, 2016
Refactor code CUDA and Native backend to match #autumnai/collenchyma/62 that provides enchanced memory management and syncronization. Since memory management is now automatic, `*_plain` variants of functions are removed. BREAKING CHANGE: *_plain versions of API functions are removed, arguments of their counterpart functions may have changed in mutablity. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/collenchyma-nn
that referenced
this pull request
Apr 28, 2016
Refactor code CUDA and Native backend to match #autumnai/collenchyma/62 that provides enchanced memory management and syncronization. Since memory management is now automatic, `*_plain` variants of functions are removed. BREAKING CHANGE: *_plain versions of API functions are removed, arguments of their counterpart functions may have changed in mutablity. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/leaf
that referenced
this pull request
Apr 30, 2016
Use .read()/.write_only()/.read_write() instead of .sync()/.add_device()/.get() calls. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/leaf
that referenced
this pull request
Apr 30, 2016
…I [SKIP_CHANGELOG] REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
alexandermorozov
added a commit
to alexandermorozov/leaf-examples
that referenced
this pull request
Apr 30, 2016
Fix SharedTensor::new() usage. REFERENCE: autumnai/collenchyma#37, autumnai/collenchyma#62
This was referenced Apr 30, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've implemented memory access API and syncronization based on bitmasks. Tesnsor/TensorView and decoupling aren't implemented.
Native and CUDA pass all tests. OpenCL compiles but segfaults on my machine, both with this PR and without it.
PR isn't ready to be merged yet -- I'd like to fix plugins and Leaf first to see that there are no unexpected problems.