mirror of
https://github.com/NVIDIA/TensorRT-LLM.git
synced 2026-01-14 06:27:45 +08:00
Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com> Signed-off-by: peaceh <103117813+peaceh-nv@users.noreply.github.com> Signed-off-by: Jinyang Yuan <154768711+jinyangyuan-nvidia@users.noreply.github.com> Co-authored-by: Yao Yao <lowsfer@users.noreply.github.com> Co-authored-by: peaceh-nv <103117813+peaceh-nv@users.noreply.github.com>
19 lines
464 B
Plaintext
19 lines
464 B
Plaintext
#include "../utils.h"
|
|
#include <cstdint>
|
|
#include <cuda_runtime.h>
|
|
|
|
__global__ void kernel_warmup(uint64_t cycles)
|
|
{
|
|
uint64_t const tic = clock64();
|
|
while (tic + cycles < clock64())
|
|
{
|
|
}
|
|
}
|
|
|
|
void warmup(cudaDeviceProp const& prop, float ms, cudaStream_t stream = nullptr)
|
|
{
|
|
uint64_t const nbCycles = std::round(prop.clockRate * ms); // clockRate is in kHz
|
|
kernel_warmup<<<16, 128, 0, stream>>>(nbCycles);
|
|
checkCuda(cudaGetLastError());
|
|
}
|