Skip to content

Commit 0f732a5

Browse files
authored
[cherry-pick] This PR enable offset of generator for custom device. (PaddlePaddle#60616) (PaddlePaddle#60772)
1 parent 1aa5f4b commit 0f732a5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

paddle/phi/core/generator.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ uint64_t Generator::Random64() {
278278

279279
std::pair<uint64_t, uint64_t> Generator::IncrementOffset(
280280
uint64_t increment_offset) {
281-
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
281+
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) || \
282+
defined(PADDLE_WITH_CUSTOM_DEVICE)
282283
std::lock_guard<std::mutex> lock(this->mu_);
283284
uint64_t cur_offset = this->state_.thread_offset;
284285
VLOG(10) << "cur_offset = " << cur_offset

0 commit comments

Comments
 (0)