MCPcopy Create free account
hub / github.com/cactus-compute/cactus / test_neon_reduction_correctness

Function test_neon_reduction_correctness

tests/test_kernel.cpp:104–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104bool test_neon_reduction_correctness() {
105 std::vector<__fp16> input = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f};
106
107 double sum_result = cactus_sum_all_f16(input.data(), input.size());
108 double expected_sum = 36.0;
109
110 if (std::abs(sum_result - expected_sum) > 1e-2) {
111 return false;
112 }
113
114 double mean_result = cactus_mean_all_f16(input.data(), input.size());
115 double expected_mean = 4.5;
116
117 if (std::abs(mean_result - expected_mean) > 1e-2) {
118 return false;
119 }
120
121 return true;
122}
123
124bool test_neon_transpose_fp16_correctness() {
125 const size_t M = 3, N = 4;

Callers 1

mainFunction · 0.85

Calls 4

cactus_sum_all_f16Function · 0.85
cactus_mean_all_f16Function · 0.85
dataMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected