Skip to content

Commit

Permalink
fix overflow in cache flush (pytorch#260)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#260

As title. When benchmarking with a big embedding table, we were getting overflow UBSAN error

Reviewed By: jianyuh

Differential Revision: D19462823

fbshipit-source-id: 5eb42b615da6b5aa5020634d3bb2d586467a6d59
  • Loading branch information
jspark1105 authored and facebook-github-bot committed Feb 1, 2020
1 parent 930ea23 commit c0c5daf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bench/BenchUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void cache_evict(const T& vec) {

const char* data = reinterpret_cast<const char*>(vec.data());
constexpr int CACHE_LINE_SIZE = 64;
for (auto i = 0; i < dataSize; i += CACHE_LINE_SIZE) {
for (std::size_t i = 0; i < dataSize; i += CACHE_LINE_SIZE) {
_mm_clflush(&data[i]);
}
}
Expand Down

0 comments on commit c0c5daf

Please sign in to comment.