llvm::downscaleWeights

downscale the given weights preserving the ratio. If the maximum value is not already known and not provided via

Synopsis

Declared in <llvm/IR/ProfDataUtils.h>

SmallVector<uint32_t>
downscaleWeights(
    ArrayRef<uint64_t> Weights,
    std::optional<uint64_t> KnownMaxCount = std::nullopt);

Return Value

The downscaled 32-bit weights, preserving the original ratio.

Parameters

NameDescription
KnownMaxCount, it will be obtained from
WeightsThe 64-bit weights to downscale.