Merge branch 'master' of github.com:marian-nmt/marian-dev into pmaster

This commit is contained in:
Marcin Junczys-Dowmunt 2021-04-21 05:13:58 +00:00
commit 309bd748ab
3 changed files with 7 additions and 4 deletions

View File

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Dynamic gradient-scaling with `--dynamic-gradient-scaling`.
- Add unit tests for binary files.
- Fix compilation with OMP
- Compute aligned memory sizes using exact sizing
### Fixed
- Missing depth-scaling in transformer FFN

View File

@ -175,8 +175,9 @@ public:
reserve(bytes);
}
size_t alignedSize(size_t size) {
return (size_t)(ceil(size / (double)alignment_) * alignment_);
size_t alignedSize(size_t size) const {
size_t over = size + alignment_ - 1;
return over - (over % alignment_);
}
void throwAtReallocation(bool throwRealloc) { throw_ = throwRealloc; }

View File

@ -15,8 +15,9 @@ protected:
size_t size_{0};
size_t alignment_;
size_t align(size_t size) {
return (size_t)(ceil(size / (float)alignment_) * alignment_);
size_t align(size_t size) const {
size_t over = size + alignment_ - 1;
return over - (over % alignment_);
}
public: