DPU Host API  2025.1.0
dpu_types.h
Go to the documentation of this file.
1 /* Copyright 2020 UPMEM. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef DPU_TYPES_H
7 #define DPU_TYPES_H
8 
14 #include <stdint.h> // IWYU pragma: export
15 
16 #include <dpu_target.h>
17 
21 #define DPU_MAX_NR_CIS 8
22 
26 #define DPU_MAX_NR_DPUS_PER_CI 8
27 
31 #define DPU_BOOT_THREAD 0
32 
36 #define DPU_MAX_NR_GROUPS 8
37 
41 typedef uint16_t dpu_rank_id_t;
42 
46 typedef uint32_t dpu_id_t;
47 
51 typedef uint8_t dpu_slice_id_t;
52 
56 typedef uint8_t dpu_member_id_t;
57 
61 typedef uint8_t dpu_group_id_t;
62 
66 typedef uint8_t dpu_thread_t;
67 
71 typedef uint8_t dpu_notify_bit_id_t;
72 
76 typedef uint16_t iram_addr_t;
77 
81 typedef uint32_t wram_addr_t;
82 
86 typedef uint32_t mram_addr_t;
87 
92 
96 typedef uint16_t iram_size_t;
97 
101 typedef uint32_t wram_size_t;
102 
106 typedef uint32_t mram_size_t;
107 
112 
116 typedef uint64_t dpuinstruction_t;
117 
121 typedef uint32_t dpuword_t;
122 
126 typedef uint8_t dpu_bitfield_t;
127 
132 #define DPU_BITFIELD_ALL ((dpu_bitfield_t)-1)
133 
137 typedef uint8_t dpu_ci_bitfield_t;
138 
142 typedef enum _dpu_clock_division_t {
143  DPU_CLOCK_DIV8 = 0x0,
144  DPU_CLOCK_DIV4 = 0x4,
145  DPU_CLOCK_DIV3 = 0x3,
146  DPU_CLOCK_DIV2 = 0x8,
148 
153  DPU_SLICE_TARGET_NONE,
154  DPU_SLICE_TARGET_DPU,
155  DPU_SLICE_TARGET_ALL,
156  DPU_SLICE_TARGET_GROUP,
157  NR_OF_DPU_SLICE_TARGETS
158 };
159 
167  union {
172  };
173 };
174 
180 #define DPU_SLICE_TARGET_TYPE_NAME(target_type) \
181  ((((uint32_t)(target_type)) < NR_OF_DPU_SLICE_TARGETS) ? dpu_slice_target_names[target_type] \
182  : "DPU_SLICE_TARGET_TYPE_UNKNOWN")
183 
187 extern const char *dpu_slice_target_names[NR_OF_DPU_SLICE_TARGETS];
188 
192 typedef enum __attribute__((packed)) _dpu_event_kind_t {
193  DPU_EVENT_RESET,
194  DPU_EVENT_EXTRACT_CONTEXT,
195  DPU_EVENT_RESTORE_CONTEXT,
196  DPU_EVENT_MRAM_ACCESS_PROGRAM,
197  DPU_EVENT_LOAD_PROGRAM,
198  DPU_EVENT_DEBUG_ACTION,
200 
205 #define DPU_API_DEPRECATED __attribute__((deprecated))
206 
211 #define DPU_MRAM_HEAP_POINTER_NAME "__sys_used_mram_end"
212 
216 struct dpu_rank_t;
217 
221 struct dpu_t;
222 
226 struct dpu_transfer_matrix;
227 
231 typedef enum _dpu_set_kind_t {
237 
241 struct dpu_set_t {
243  dpu_set_kind_t kind;
245  union {
247  struct {
249  uint32_t nr_ranks;
251  struct dpu_rank_t **ranks;
252  } list;
254  struct dpu_t *dpu;
255  };
256 };
257 
261 struct dpu_program_t;
262 
266 struct dpu_symbol_t {
271 };
272 
276 struct dpu_incbin_t {
278  uint8_t *buffer;
280  size_t size;
282  const char *path;
283 };
284 
290  uint16_t cpu2dpu;
292  uint16_t dpu2cpu;
294  uint8_t nibble_swap;
296  uint8_t stutter;
297 };
298 
304  uint8_t cmd_duration;
306  uint8_t cmd_sampling;
308  uint8_t res_duration;
310  uint8_t res_sampling;
311 };
312 
318  uint8_t AB_msbs;
320  uint8_t CD_msbs;
322  uint8_t A_lsbs;
324  uint8_t B_lsbs;
326  uint8_t C_lsbs;
328  uint8_t D_lsbs;
330  uint8_t even_index;
332  uint8_t odd_index;
333 };
334 
339  DPU_TEMPERATURE_LESS_THAN_50 = 0,
340  DPU_TEMPERATURE_BETWEEN_50_AND_60 = 1,
341  DPU_TEMPERATURE_BETWEEN_60_AND_70 = 2,
342  DPU_TEMPERATURE_BETWEEN_70_AND_80 = 3,
343  DPU_TEMPERATURE_BETWEEN_80_AND_90 = 4,
344  DPU_TEMPERATURE_BETWEEN_90_AND_100 = 5,
345  DPU_TEMPERATURE_BETWEEN_100_AND_110 = 6,
346  DPU_TEMPERATURE_GREATER_THAN_110 = 7,
347 };
348 
363 };
364 
370  struct {
372  uint32_t nr_threads;
374  uint32_t nr_registers;
376  uint32_t nr_atomic_bits;
377 
384  } info;
385 
389  uint8_t *mram;
392 
394  uint32_t *registers;
400  bool *zero_flags;
402  bool *carry_flags;
406  uint8_t *scheduling;
408  bool bkp_fault;
410  bool dma_fault;
412  bool mem_fault;
420  uint32_t bkp_fault_id;
421 };
422 
428  uint32_t max_nr_blocks;
430  uint8_t **blocks_addr;
432  uint32_t *blocks_length;
434  uint32_t nr_blocks;
435 };
436 
446 
447 #endif // DPU_TYPES_H
scatter gather transfer buffer used to store multiple blocks for one DPU
Definition: dpu_types.h:426
uint8_t * buffer
Definition: dpu_types.h:278
iram_size_t iram_size
Definition: dpu_types.h:379
struct dpu_rank_t ** ranks
Definition: dpu_types.h:251
uint32_t nr_ranks
Definition: dpu_types.h:249
Definition: dpu_types.h:235
iram_addr_t * pcs
Definition: dpu_types.h:396
uint8_t C_lsbs
Definition: dpu_types.h:326
dpu_thread_t mem_fault_thread_index
Definition: dpu_types.h:418
bool * carry_flags
Definition: dpu_types.h:402
uint32_t * registers
Definition: dpu_types.h:394
_dpu_clock_division_t
Clock divisor for the DPU clock.
Definition: dpu_types.h:142
Definition: dpu_types.h:358
uint8_t odd_index
Definition: dpu_types.h:332
enum _dpu_clock_division_t dpu_clock_division_t
Clock divisor for the DPU clock.
uint8_t AB_msbs
Definition: dpu_types.h:318
uint16_t dpu_rank_id_t
ID of a DPU rank.
Definition: dpu_types.h:41
bool bkp_fault
Definition: dpu_types.h:408
uint8_t dpu_ci_bitfield_t
Bitfield of CIs in a rank.
Definition: dpu_types.h:137
enum _dpu_event_kind_t dpu_event_kind_t
High-level event that may be passed to the backends.
wram_size_t wram_size
Definition: dpu_types.h:383
uint8_t CD_msbs
Definition: dpu_types.h:320
Information on a binary embedded in the program with "DPU_INCBIN".
Definition: dpu_types.h:276
dpu_thread_t dma_fault_thread_index
Definition: dpu_types.h:416
uint32_t nr_threads
Definition: dpu_types.h:372
Definition: dpu_types.h:233
Memory bank reparation configuration.
Definition: dpu_types.h:316
dpu_slice_target_type
Target type for a CI Select command.
Definition: dpu_types.h:152
Definition: dpu_types.h:360
dpuword_t * wram
Definition: dpu_types.h:391
Information for a symbol from a DPU program.
Definition: dpu_types.h:266
uint32_t max_nr_blocks
Definition: dpu_types.h:428
size_t size
Definition: dpu_types.h:280
uint8_t nr_of_running_threads
Definition: dpu_types.h:404
dpu_temperature
Temperature measure, in degree Celsius, in a DPU.
Definition: dpu_types.h:338
uint8_t A_lsbs
Definition: dpu_types.h:322
mram_size_t mram_size
Definition: dpu_types.h:381
uint32_t mram_size_t
Size in MRAM.
Definition: dpu_types.h:106
const char * path
Definition: dpu_types.h:282
uint8_t dpu_group_id_t
ID of a DPU rank slice group.
Definition: dpu_types.h:61
uint16_t dpu2cpu
Definition: dpu_types.h:292
_dpu_event_kind_t
High-level event that may be passed to the backends.
Definition: dpu_types.h:192
uint16_t iram_addr_t
Address in IRAM.
Definition: dpu_types.h:76
bool * zero_flags
Definition: dpu_types.h:400
_dpu_set_kind_t
DPU device type of a DPU set.
Definition: dpu_types.h:231
uint8_t stutter
Definition: dpu_types.h:296
uint32_t wram_size_t
Size in WRAM.
Definition: dpu_types.h:101
uint8_t dpu_slice_id_t
ID of a DPU rank slice.
Definition: dpu_types.h:51
dpuinstruction_t * iram
Definition: dpu_types.h:387
dpu_mem_max_addr_t address
Definition: dpu_types.h:268
uint32_t dpu_id_t
ID of a DPU.
Definition: dpu_types.h:46
Definition: dpu_types.h:442
Definition: dpu_types.h:354
uint8_t * mram
Definition: dpu_types.h:389
uint32_t wram_addr_t
Address in WRAM.
Definition: dpu_types.h:81
bool dma_fault
Definition: dpu_types.h:410
uint8_t nibble_swap
Definition: dpu_types.h:294
uint8_t dpu_notify_bit_id_t
Index of a DPU notify bit.
Definition: dpu_types.h:71
uint8_t B_lsbs
Definition: dpu_types.h:324
dpu_transfer_matrix_type_t
Type of buffer to transfer.
Definition: dpu_types.h:440
uint8_t * scheduling
Definition: dpu_types.h:406
uint32_t nr_registers
Definition: dpu_types.h:374
uint8_t ** blocks_addr
Definition: dpu_types.h:430
dpu_set_kind_t kind
Definition: dpu_types.h:243
uint32_t dpuword_t
DPU word in WRAM.
Definition: dpu_types.h:121
dpu_member_id_t dpu_id
Definition: dpu_types.h:169
dpu_mem_max_size_t size
Definition: dpu_types.h:270
enum dpu_slice_target_type type
Definition: dpu_types.h:165
uint32_t * blocks_length
Definition: dpu_types.h:432
bool * atomic_register
Definition: dpu_types.h:398
uint8_t D_lsbs
Definition: dpu_types.h:328
A set of DPU devices.
Definition: dpu_types.h:241
uint32_t mram_addr_t
Address in MRAM.
Definition: dpu_types.h:86
Definition: dpu_types.h:444
uint16_t iram_size_t
Size in IRAM.
Definition: dpu_types.h:96
dpu_group_id_t group_id
Definition: dpu_types.h:171
uint64_t dpuinstruction_t
DPU instruction.
Definition: dpu_types.h:116
struct dpu_t * dpu
Definition: dpu_types.h:254
uint8_t dpu_member_id_t
ID of a DPU rank slice member.
Definition: dpu_types.h:56
dpu_pc_mode
Configuration for the instruction address size on a DPU.
Definition: dpu_types.h:352
mram_addr_t dpu_mem_max_addr_t
Bigger storage for a DPU memory address.
Definition: dpu_types.h:91
bool mem_fault
Definition: dpu_types.h:412
uint32_t nr_atomic_bits
Definition: dpu_types.h:376
uint8_t dpu_thread_t
Index of a DPU thread.
Definition: dpu_types.h:66
mram_size_t dpu_mem_max_size_t
Bigger storage for a DPU memory size.
Definition: dpu_types.h:111
uint32_t bkp_fault_id
Definition: dpu_types.h:420
uint16_t cpu2dpu
Definition: dpu_types.h:290
Definition: dpu_types.h:362
enum _dpu_set_kind_t dpu_set_kind_t
DPU device type of a DPU set.
uint8_t even_index
Definition: dpu_types.h:330
uint32_t nr_blocks
Definition: dpu_types.h:434
dpu_thread_t bkp_fault_thread_index
Definition: dpu_types.h:414
uint8_t dpu_bitfield_t
Bitfield of DPUs in a CI.
Definition: dpu_types.h:126
Target for a CI Select command.
Definition: dpu_types.h:163
Definition: dpu_types.h:356
Configuration used to handle bit shuffling.
Definition: dpu_types.h:288
Debugging information.
Definition: dpu_types.h:368