aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Petit <kevin.petit@arm.com>2024-02-08 11:04:01 +0000
committerKevin Petit <kevin.petit@arm.com>2024-02-23 18:44:46 +0000
commit2aa2552bc4e2bec84c7b6b3718b5a9355bc4c2b0 (patch)
tree0140b27665de166cea1e7ea1599f6aa84608ba96
parentafaaa673e1620315e0d7d863d7bcef1a2dc54df9 (diff)
downloadspecification-2aa2552bc4e2bec84c7b6b3718b5a9355bc4c2b0.tar.gz
pseudocode: a few more simple syntax fixes
- Use function call syntax for static_cast and sizeof - Replace undefined in_u_t with in_t - Add missing semicolon Change-Id: If6147ae93b371230cbebdf45a55490bf462a8219 Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-rw-r--r--pseudocode/library/arithmetic_helpers.tosac4
-rw-r--r--pseudocode/operators/CAST.tosac4
-rw-r--r--pseudocode/operators/DEPTHWISE_CONV2D.tosac4
3 files changed, 6 insertions, 6 deletions
diff --git a/pseudocode/library/arithmetic_helpers.tosac b/pseudocode/library/arithmetic_helpers.tosac
index d2a4c46..18d5c64 100644
--- a/pseudocode/library/arithmetic_helpers.tosac
+++ b/pseudocode/library/arithmetic_helpers.tosac
@@ -17,7 +17,7 @@ in_t apply_add_s<in_t>(in_t a, in_t b) {
in_t apply_add_u<in_t>(in_t a, in_t b) {
if (is_floating_point<in_t>()) return a + b;
uint64_t c = zero_extend<uint64_t>(a) + zero_extend<uint64_t>(b);
- REQUIRE(c >= minimum_u<in_u_t>() && c <= maximum_u<in_u_t>());
+ REQUIRE(c >= minimum_u<in_t>() && c <= maximum_u<in_t>());
return truncate<in_t>(c);
}
@@ -130,7 +130,7 @@ in_t apply_sub_s<in_t>(in_t a, in_t b) {
in_t apply_sub_u<in_t>(in_t a, in_t b) {
uint64_t c = zero_extend<uint64_t>(a) - zero_extend<uint64_t>(b);
- REQUIRE(c >= minimum_u<in_u_t>() && c <= maximum_u<in_u_t>());
+ REQUIRE(c >= minimum_u<in_t>() && c <= maximum_u<in_t>());
return truncate<in_t>(c);
}
diff --git a/pseudocode/operators/CAST.tosac b/pseudocode/operators/CAST.tosac
index 4e2dca3..b8fdea9 100644
--- a/pseudocode/operators/CAST.tosac
+++ b/pseudocode/operators/CAST.tosac
@@ -28,11 +28,11 @@ for_each(index in shape) {
out = (in) ? 1 : 0;
} else if (is_floating_point<in_t>()) {
out = truncate<out_t>(apply_clip_s<i32_t>(round_to_nearest_int(in), minimum_s<out_t>(), maximum_s<out_t>()));
- } else if (sizeof(out_t) >= sizeof(in_t)) {
+ } else if (sizeof<out_t>() >= sizeof<in_t>()) {
out = sign_extend<out_t>(in);
} else {
out = truncate<out_t>(in);
}
}
- tensor_write<out_t>(output, shape, index, out)
+ tensor_write<out_t>(output, shape, index, out);
}
diff --git a/pseudocode/operators/DEPTHWISE_CONV2D.tosac b/pseudocode/operators/DEPTHWISE_CONV2D.tosac
index 6cbcc6a..a473375 100644
--- a/pseudocode/operators/DEPTHWISE_CONV2D.tosac
+++ b/pseudocode/operators/DEPTHWISE_CONV2D.tosac
@@ -30,8 +30,8 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW, 0 <= c < C, 0 <= m < M) {
out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight,
[KH,KW,C,M],
[ky,kx,c,m]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>input_zp);
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>weight_zp);
+ value = apply_sub_s<out_t>(value, static_cast<out_t>(input_zp));
+ weight = apply_sub_s<out_t>(weight, static_cast<out_t>(weight_zp));
acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
}
}