MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / fromFloat

Function fromFloat

plugin/instanceNormalizationPlugin/instanceNormCommon.h:56–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55template <int32_t N>
56DEVICE_FUNCTION void fromFloat(int32_t (&dst)[N], float const (&src)[2 * N])
57{
58#pragma unroll
59 for (int32_t i = 0; i < N; ++i)
60 {
61 uint16_t lo, hi;
62 asm volatile("cvt.rn.f16.f32 %0, %1;" : "=h"(lo) : "f"(src[2 * i + 0]));
63 asm volatile("cvt.rn.f16.f32 %0, %1;" : "=h"(hi) : "f"(src[2 * i + 1]));
64 asm volatile("mov.b32 %0, {%1, %2};" : "=r"(dst[i]) : "h"(lo), "h"(hi));
65 }
66}
67
68template <int32_t N>
69DEVICE_FUNCTION void fromFloat(int32_t (&dst)[N], float const (&src)[4 * N], float scale)

Callers 2

stgFunction · 0.85
stgStreamFunction · 0.85

Calls 2

minFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected