Exceptions

A DPU program can stop in fault for 3 reasons.

Only dpu-lldb is capable of printing the stop reason. The Host API will only say that a DPU is in fault, and not the reason of the fault.

Memory fault

This exception happens when the DPU tries to perform a load or a store at an address which is either out of the WRAM or not aligned on its size.

In any case, dpu-lldb will print the following message when it happens:

* thread #1, name = 'DPUthread0', stop reason = memory fault

DMA fault

This exception happens when the DPU tries to perform a DMA operation with the WRAM addresses out of the WRAM and/or the MRAM addresses out of the MRAM. Note that it does not apply only to the starting address, but the whole range targeted by the transfer.

In any case, dpu-lldb will print the following message when it happens:

* thread #1, name = 'DPUthread0', stop reason = dma fault

Fault

Faults are generated by the DPU Runtime Library, when it detects something wrong at runtime.

The list of known errors is listed here-after:

Error message (stop reason printed by dpu-lldb)

Error description

fault 1 (Heap Full)

Raised when the dpu cannot allocate more memory

fault 2 (Division by Zero)

Raised when the dpu tries to compute a division by zero

fault 3 (Assert)

Raised by a call to assert (if NDEBUG is undefined) if the specified condition is false

fault 4 (Halt)

Raised by a call to halt (defined in defs.h)

fault 5 (Printf Overflow)

Raised when a printf message is bigger than the printf buffer

fault 6 (Already Profiling)

Raised when calling profiling_start twice in a row without calling profiling_stop in-between

fault 7 (Not Profiling)

Raised when calling profiling_sop without calling profiling_start beforehand

fault 8 (Wrong Alignment)

Raised when calling mram_write_unaligned with MRAM/WRAM addresses unequal modulo 8