Skip to content

Commit d651676

Browse files
committed
treewide: Add reduction_opcode_width configuration parameter
1 parent 6a7e9af commit d651676

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

sw/snRuntime/api/sync_decls.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#include <stdint.h>
88

9+
#define SNRT_COLLECTIVE_MASK_WIDTH \
10+
(64 - SNRT_REDUCTION_OPCODE_WIDTH - SNRT_COLLECTIVE_OPCODE_WIDTH)
11+
912
typedef struct {
1013
uint32_t volatile cnt;
1114
uint32_t volatile iteration;
@@ -35,9 +38,10 @@ typedef enum {
3538

3639
typedef union {
3740
struct __attribute__((__packed__)) {
38-
snrt_reduction_opcode_t reduction_opcode : SNRT_COLLECTIVE_WIDTH;
39-
snrt_collective_opcode_t collective_opcode : 2;
40-
uint64_t mask : (64 - SNRT_COLLECTIVE_WIDTH - 2);
41+
snrt_reduction_opcode_t reduction_opcode : SNRT_REDUCTION_OPCODE_WIDTH;
42+
snrt_collective_opcode_t collective_opcode
43+
: SNRT_COLLECTIVE_OPCODE_WIDTH;
44+
uint64_t mask : SNRT_COLLECTIVE_MASK_WIDTH;
4145
} f;
4246
uint64_t w;
4347
} snrt_collective_op_t;

target/snitch_cluster/sw/runtime/common/snitch_cluster_cfg.h.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#define SNRT_SUPPORTS_NARROW_REDUCTION
2727
% endif
2828

29-
#define SNRT_COLLECTIVE_WIDTH ${cfg['cluster']['collective_width']}
29+
#define SNRT_REDUCTION_OPCODE_WIDTH ${cfg['cluster']['reduction_opcode_width']}
30+
#define SNRT_COLLECTIVE_OPCODE_WIDTH ${cfg['cluster']['collective_width'] - cfg['cluster']['reduction_opcode_width']}
3031

3132
// Software configuration
3233
#define SNRT_LOG2_STACK_SIZE 10

util/clustergen/schema/snitch_cluster.schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,14 @@
166166
"description": "Width of the cluster's atomic ID.",
167167
"default": 1
168168
},
169+
"reduction_opcode_width": {
170+
"type": "number",
171+
"description": "Width of the reduction opcode field.",
172+
"default": 4
173+
},
169174
"collective_width": {
170175
"type": "number",
171-
"description": "Width of the collective operation field.",
176+
"description": "Width of the collective operation information in the awuser field, which includes the reduction opcode.",
172177
"default": 6
173178
},
174179
"enable_narrow_collectives": {

0 commit comments

Comments
 (0)