aboutsummaryrefslogtreecommitdiff
path: root/chapters/scatter_gather.adoc
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2021-02-17 19:23:39 -0800
committerEric Kunze <eric.kunze@arm.com>2021-03-08 10:06:31 -0800
commit1e9ba65f263a15f1f9cf9b9484047ea51237187a (patch)
treebf1eb0f43d24b207612e6e8a87799a211ba155a4 /chapters/scatter_gather.adoc
parent54ff87d31637c97958ac49e40312e9b6de0a8f1a (diff)
downloadspecification-1e9ba65f263a15f1f9cf9b9484047ea51237187a.tar.gz
Consistency cleanup
Attempt to get consistent across the pseudocode. Change the data types to all be intN_t instead of some cases of intN. Use float_t as the general floating point data type. Be consistent on use of the term "floating-point" Move general pseudocode helpers to their own section. Change-Id: Ie77666cd3ee438c71f39c62b9c424fe687b0bb51 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'chapters/scatter_gather.adoc')
-rw-r--r--chapters/scatter_gather.adoc48
1 files changed, 24 insertions, 24 deletions
diff --git a/chapters/scatter_gather.adoc b/chapters/scatter_gather.adoc
index a026335..c2fcbe4 100644
--- a/chapters/scatter_gather.adoc
+++ b/chapters/scatter_gather.adoc
@@ -32,11 +32,11 @@ None
[source,c]
----
-for_each(0<=n<N, 0<=w<W, 0<=c<C) {
- index_t k = tensor_read<index_t>(indices, [N,W], [n,w])
- assert(0<=k && k<K)
- value_t value = tensor_read<value_t>(values, [N,K,C], [n, k, c])
- tensor_write<value_t>(output, [N,W,C], [n,w,c], value)
+for_each(0 <= n < N, 0 <= w < W, 0 <= c < C) {
+ index_t k = tensor_read<index_t>(indices, [N,W], [n,w]);
+ assert(0 <= k && k < K);
+ value_t value = tensor_read<value_t>(values, [N,K,C], [n,k,c]);
+ tensor_write<value_t>(output, [N,W,C], [n,w,c], value);
}
----
@@ -45,10 +45,10 @@ for_each(0<=n<N, 0<=w<W, 0<=c<C) {
|===
|Profile|Mode|index_t|value_t
-|Any|signed 8|int32|int8
-|Any|signed 16|int32|int16
-|Any|signed 32|int32|int32
-|MI,MT|float|int32|float
+|Any|signed 8|int32_t|int8_t
+|Any|signed 16|int32_t|int16_t
+|Any|signed 32|int32_t|int32_t
+|MI,MT|float|int32_t|float
|===
==== SCATTER
@@ -80,24 +80,24 @@ None
// The following array is used to check compliance that an output position
// is modified at most once.
-bool output_modified[N,K,C];
+bool_t output_modified[N,K,C];
// Copy the values_in tensor to the values_out tensor.
// Values not written by the scatter operation are unchanged in the output.
-for_each(0<=n<N, 0<=k<K, 0<=c<C) {
- value_t value = tensor_read<value_t>(values_in, [N,K,C], [n,k,c])
- tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value)
+for_each(0 <= n < N, 0 <= k < K, 0 <= c < C) {
+ value_t value = tensor_read<value_t>(values_in, [N,K,C], [n,k,c]);
+ tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value);
output_modified[n,k,c]=false;
}
// Now perform the SCATTER operation, modifying the positions from the indices tensor
-for_each(0<=n<N, 0<=w<W, 0<=c<C) {
- index_t k = tensor_read<index_t>(indices, [N,W], [n,w])
- assert(0<=k && k<K)
- assert(output_modified[n,k,c]==false);
- value_t value = tensor_read<value_t>(input, [N,W,C], [n,w,c])
- tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value)
- output_modified[n,k,c]=true;
+for_each(0 <= n < N, 0 <= w < W, 0 <= c < C) {
+ index_t k = tensor_read<index_t>(indices, [N,W], [n,w]);
+ assert(0 <= k && k < K);
+ assert(output_modified[n,k,c] == false);
+ value_t value = tensor_read<value_t>(input, [N,W,C], [n,w,c]);
+ tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value);
+ output_modified[n,k,c] = true;
}
----
@@ -106,8 +106,8 @@ for_each(0<=n<N, 0<=w<W, 0<=c<C) {
|===
|Profile|Mode|index_t|value_t
-|Any|signed 8|int32|int8
-|Any|signed 16|int32|int16
-|Any|signed 32|int32|int32
-|MI,MT|float|int32|float
+|Any|signed 8|int32_t|int8_t
+|Any|signed 16|int32_t|int16_t
+|Any|signed 32|int32_t|int32_t
+|MI,MT|float|int32_t|float
|===