Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions paddle/phi/kernels/gpu/top_p_sampling_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,13 @@ void TopPSamplingKernel(const Context& dev_ctx,
phi::Stream(reinterpret_cast<phi::StreamId>(dev_ctx.stream())));
dev_curand_states =
reinterpret_cast<curandState_t*>(curand_states_buf->ptr());
unsigned int seed = 0;
uint64_t seed;
if (random_seed == -1) {
#ifndef _WIN32
rand_r(&seed);
setup_kernel<<<1, 256, 0, cu_stream>>>(dev_curand_states, seed, bs);
#else
srand(seed);
setup_kernel<<<1, 256, 0, cu_stream>>>(dev_curand_states, rand(), bs);
#endif
seed = static_cast<uint64_t>(time(NULL) % 1000000);
} else {
seed = random_seed;
}
setup_kernel<<<1, 256, 0, cu_stream>>>(dev_curand_states, seed, bs);

DenseTensor count_iter;
count_iter.Resize(phi::make_ddim({bs + 1}));
Expand Down