Skip to content

Commit

Permalink
This PR enable offset of generator for custom device. (#60616)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohaixu authored Jan 10, 2024
1 parent b622e96 commit da5399a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion paddle/phi/core/generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ uint64_t Generator::Random64() {
}

std::pair<uint64_t, uint64_t> Generator::IncrementOffset(uint64_t increment) {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) || \
defined(PADDLE_WITH_CUSTOM_DEVICE)
std::lock_guard<std::mutex> lock(mu_);
uint64_t offset = state().offset;
state().offset = offset + increment;
Expand Down

0 comments on commit da5399a

Please sign in to comment.