|
MU Library
|
Namespaces | |
| vector | |
Enumerations | |
| enum class | DpeMode { Bsw = 0 , Mate = 1 , Global = 2 , DB = 3 , NumDpeMode = 3 } |
| enum class | DpeLaunch { Sync = 0 , Async = 1 } |
| enum class | DpeBuffer { DPB = 0 , LDB = 1 } |
| enum class | LogLevel { Trace , Debug , Info , Warn , Error , Critical , None } |
Functions | |
| void | Assert (bool cond, const char *file=__builtin_FILE(), const char *func=__builtin_FUNCTION(), int line=__builtin_LINE()) |
| Assertion function for runtime checks. More... | |
| void | exit () |
| Terminates the MU kernel execution. More... | |
| int32_t | atomicAdd (int32_t *address, int32_t val) |
| Atomically adds a value to memory. More... | |
| int32_t | atomicAddAsync (int32_t *address, int32_t val) |
| Atomically adds a value to memory asynchronously. More... | |
| uint32_t | atomicAnd (uint32_t *address, uint32_t val) |
| Atomically performs bitwise AND operation with memory. More... | |
| uint32_t | atomicAndAsync (uint32_t *address, uint32_t val) |
| Atomically performs bitwise AND operation with memory asynchronously. More... | |
| uint32_t | atomicOr (uint32_t *address, uint32_t val) |
| Atomically performs bitwise OR operation with memory. More... | |
| uint32_t | atomicOrAsync (uint32_t *address, uint32_t val) |
| Atomically performs bitwise OR operation with memory asynchronously. More... | |
| uint32_t | atomicXor (uint32_t *address, uint32_t val) |
| Atomically performs bitwise XOR operation with memory. More... | |
| uint32_t | atomicXorAsync (uint32_t *address, uint32_t val) |
| Atomically performs bitwise XOR operation with memory asynchronously. More... | |
| int32_t | atomicInc (int32_t *address, int32_t val) |
| Atomically increments memory value. More... | |
| int32_t | atomicIncAsync (int32_t *address, int32_t val) |
| Atomically increments memory value asynchronously. More... | |
| int32_t | atomicDec (int32_t *address, int32_t val) |
| Atomically decrements memory value. More... | |
| int32_t | atomicDecAsync (int32_t *address, int32_t val) |
| Atomically decrements memory value asynchronously. More... | |
| int32_t | atomicMin (int32_t *address, int32_t val) |
| Atomically sets memory to minimum of current and new value. More... | |
| int32_t | atomicMax (int32_t *address, int32_t val) |
| Atomically sets memory to maximum of current and new value. More... | |
| int32_t | atomicSwap (int32_t *address, int32_t val) |
| Atomically exchanges memory value with new value. More... | |
| int32_t | atomicCAS (int32_t *address, int32_t val, int32_t compare) |
| Atomically compares and swaps memory value. More... | |
| int64_t | atomicSwap58 (int64_t *address, int64_t val) |
| Atomically exchanges memory value with new value (58-bit) More... | |
| uint64_t | atomicOr58 (uint64_t *address, uint64_t val) |
| Atomically performs bitwise OR operation with memory (58-bit) More... | |
| uint64_t | atomicAnd58 (uint64_t *address, uint64_t val) |
| Atomically performs bitwise AND operation with memory (58-bit) More... | |
| uint64_t | atomicXor58 (uint64_t *address, uint64_t val) |
| Atomically performs bitwise XOR operation with memory (58-bit) More... | |
| int32_t | atomicLoad (int32_t *address) |
| Atomically reads a value from memory. More... | |
| int64_t | atomicLoad58 (int64_t *address) |
| Atomically reads a value from memory (58-bit) More... | |
| int32_t | atomicStoreAsync (int32_t *address, int32_t val) |
| Atomically stores a value to memory asynchronously. More... | |
| int64_t | atomicStore58Async (int64_t *address, int64_t val) |
| Atomically stores a value to memory asynchronously (58-bit) More... | |
| uint64_t | readGlobal (const void *src) |
| Read a value from global cache. More... | |
| void | writeGlobal (void *dst, uint64_t value) |
| Write a value to global cache. More... | |
| void | memcpyGlobal (void *dst, const void *src, uint64_t size) |
| Copy data to global cache. More... | |
| void | flushCache (const void *addr, uint64_t size=64) |
| Flush cache lines for a memory region. More... | |
| void | flushCacheAll () |
| Flush all cache lines for current thread. More... | |
| void | prefetch (const void *addr, uint64_t size=64) |
| Prefetch a contiguous memory region into cache. More... | |
| void | prefetchStride (const void *addr, uint64_t count, uint64_t offset=64) |
| Prefetch multiple cache lines at regular stride intervals. More... | |
| bool | prefetchLinkedList (const void *addr, uint64_t count, uint64_t ptrOffset) |
| Prefetch cache lines by traversing a linked list. More... | |
| uint64_t | getClockCycle () |
| Get the current clock cycle count. More... | |
| bool | isNormalMode (uint32_t mode) |
| CALL_HELPER (0) | |
| CALL_HELPER (1) | |
| CALL_HELPER (2) | |
| CALL_HELPER (3) | |
| CALL_HELPER (4) | |
| CALL_HELPER (5) | |
| CALL_HELPER (6) | |
| CALL_HELPER (7) | |
| CALL_HELPER (8) | |
| CALL_HELPER (9) | |
| template<typename FP > | |
| void | callMain (FP func, uint32_t mode, uint32_t ndarrayValueBit, char *buffer) |
| void | muSetDpbMemory (uint32_t swId, uint8_t isSrc1Physical, uint64_t src1, uint8_t isSrc2Physical, uint64_t src2, uint32_t count) |
| void | muSetLdbMemory (uint32_t swId, uint8_t isSrc1Physical, uint64_t src1, uint8_t isSrc2Physical, uint64_t src2, uint32_t count) |
| uint64_t | muRunDpe (uint32_t swId, DpeMode mode, uint32_t tMask, uint32_t iLen, uint32_t jStart, uint32_t jLen, uint32_t weight, uint8_t isPhysical, uint64_t dstAddr, uint32_t tOffset, uint32_t tDelta, uint32_t maxStart, uint32_t skipVsb, DpeLaunch asyncMode) |
| uint64_t | getId () |
| Return the id of Mu. More... | |
| uint64_t | getExecutionCount () |
| Return the execution count of Mu. More... | |
| int | logPrintf (const char *format,...) |
| Prints a formatted log message. More... | |
| int | logPrintf (LogLevel level, const char *format,...) |
| Prints a formatted log message with a specified log level. More... | |
| void | asyncMessage (void *src, uint64_t size) |
| Send asynchronous message to host. More... | |
| void | syncMessage (void *src, uint64_t size) |
| Send synchronous message to host and wait for response. More... | |
| uint32_t | getTaskIdx (void) |
| Get the current task index. More... | |
| uint32_t | getTaskCount (void) |
| Get the total number of tasks. More... | |
| int | uartPrintf (const char *format,...) |
| Print a formatted string to UART. More... | |
| int | hostPrintf (const char *format,...) |
| Print a formatted string to the host. More... | |
| void | profilerStart (const char *tag) |
| Start the profiler. More... | |
| void | profilerEnd (const char *tag) |
| End the profiler. More... | |
Variables | |
| template<typename T > | |
| constexpr bool | is_ndarray_v = is_ndarray<T>::value |
| constexpr uint64_t | DpeAddrAlignBit = 6 |
|
strong |
| Enumerator | |
|---|---|
| DPB | |
| LDB | |
Definition at line 27 of file dpe_common.hpp.
|
strong |
| Enumerator | |
|---|---|
| Sync | |
| Async | |
Definition at line 21 of file dpe_common.hpp.
|
strong |
| Enumerator | |
|---|---|
| Bsw | |
| Mate | |
| Global | |
| DB | |
| NumDpeMode | |
Definition at line 12 of file dpe_common.hpp.
|
strong |
| Enumerator | |
|---|---|
| Trace | |
| Debug | |
| Info | |
| Warn | |
| Error | |
| Critical | |
| None | |
Definition at line 9 of file logger_const.hpp.
| void mu::Assert | ( | bool | cond, |
| const char * | file = __builtin_FILE(), |
||
| const char * | func = __builtin_FUNCTION(), |
||
| int | line = __builtin_LINE() |
||
| ) |
Assertion function for runtime checks.
This function performs runtime assertion checks in debug builds. When the condition is false, it triggers a kernel halt for debugging.
| cond | The boolean condition to check |
| file | Source file where the assertion occurred (automatically filled) |
| func | Function name where the assertion occurred (automatically filled) |
| line | Line number where the assertion occurred (automatically filled) |
| void mu::asyncMessage | ( | void * | src, |
| uint64_t | size | ||
| ) |
Send asynchronous message to host.
Sends a message to the host system without waiting for a response. This function returns immediately after sending the message.
| src | Pointer to the source data to be sent |
| size | Size of the data in bytes |
| int32_t mu::atomicAdd | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically adds a value to memory.
Computes (old + val) and stores the result in memory.
| address | Target memory address |
| val | Value to add |
| int32_t mu::atomicAddAsync | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically adds a value to memory asynchronously.
Computes (old + val) and stores the result in memory.
| address | Target memory address |
| val | Value to add |
| uint32_t mu::atomicAnd | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise AND operation with memory.
Computes (old & val) and stores the result in memory.
| address | Target memory address |
| val | Value to AND with |
| uint64_t mu::atomicAnd58 | ( | uint64_t * | address, |
| uint64_t | val | ||
| ) |
Atomically performs bitwise AND operation with memory (58-bit)
| address | Target memory address |
| val | Value to AND with |
| uint32_t mu::atomicAndAsync | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise AND operation with memory asynchronously.
Computes (old & val) and stores the result in memory.
| address | Target memory address |
| val | Value to AND with |
| int32_t mu::atomicCAS | ( | int32_t * | address, |
| int32_t | val, | ||
| int32_t | compare | ||
| ) |
Atomically compares and swaps memory value.
Computes ((old == compare) ? val : old) and stores the result in memory
| address | Target memory address |
| val | New value to set if comparison succeeds |
| compare | Value to compare with |
| int32_t mu::atomicDec | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically decrements memory value.
Computes (((old == 0) || (old > val)) ? val : (old - 1)) and stores the result in memory.
| address | Target memory address |
| val | Minimum value before wrapping |
| int32_t mu::atomicDecAsync | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically decrements memory value asynchronously.
Computes (((old == 0) || (old > val)) ? val : (old - 1)) and stores the result in memory.
| address | Target memory address |
| val | Minimum value before wrapping |
| int32_t mu::atomicInc | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically increments memory value.
Computes ((old >= val) ? 0 : (old + 1)) and stores the result in memory.
| address | Target memory address |
| val | Maximum value before wrapping |
| int32_t mu::atomicIncAsync | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically increments memory value asynchronously.
Computes ((old >= val) ? 0 : (old + 1)) and stores the result in memory.
| address | Target memory address |
| val | Maximum value before wrapping |
| int32_t mu::atomicLoad | ( | int32_t * | address | ) |
Atomically reads a value from memory.
| address | Memory address to read from |
| int64_t mu::atomicLoad58 | ( | int64_t * | address | ) |
Atomically reads a value from memory (58-bit)
| address | Memory address to read from |
| int32_t mu::atomicMax | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically sets memory to maximum of current and new value.
Computes max(old, val) and stores the result in memory
| address | Target memory address |
| val | Value to compare with |
| int32_t mu::atomicMin | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically sets memory to minimum of current and new value.
Computes min(old, val) and stores the result in memory
| address | Target memory address |
| val | Value to compare with |
| uint32_t mu::atomicOr | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise OR operation with memory.
Computes (old | val) and stores the result in memory.
| address | Target memory address |
| val | Value to OR with |
| uint64_t mu::atomicOr58 | ( | uint64_t * | address, |
| uint64_t | val | ||
| ) |
Atomically performs bitwise OR operation with memory (58-bit)
| address | Target memory address |
| val | Value to OR with |
| uint32_t mu::atomicOrAsync | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise OR operation with memory asynchronously.
Computes (old | val) and stores the result in memory.
| address | Target memory address |
| val | Value to OR with |
| int64_t mu::atomicStore58Async | ( | int64_t * | address, |
| int64_t | val | ||
| ) |
Atomically stores a value to memory asynchronously (58-bit)
Stores a value to memory with atomic guarantees. This function performs the operation asynchronously.
| address | Target memory address |
| val | Value to store |
| int32_t mu::atomicStoreAsync | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically stores a value to memory asynchronously.
Stores a value to memory with atomic guarantees. This function performs the operation asynchronously.
| address | Target memory address |
| val | Value to store |
| int32_t mu::atomicSwap | ( | int32_t * | address, |
| int32_t | val | ||
| ) |
Atomically exchanges memory value with new value.
| address | Target memory address |
| val | Value to swap with |
| int64_t mu::atomicSwap58 | ( | int64_t * | address, |
| int64_t | val | ||
| ) |
Atomically exchanges memory value with new value (58-bit)
| address | Target memory address |
| val | Value to swap with |
| uint32_t mu::atomicXor | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise XOR operation with memory.
Computes (old ^ val) and stores the result in memory.
| address | Target memory address |
| val | Value to XOR with |
| uint64_t mu::atomicXor58 | ( | uint64_t * | address, |
| uint64_t | val | ||
| ) |
Atomically performs bitwise XOR operation with memory (58-bit)
| address | Target memory address |
| val | Value to XOR with |
| uint32_t mu::atomicXorAsync | ( | uint32_t * | address, |
| uint32_t | val | ||
| ) |
Atomically performs bitwise XOR operation with memory asynchronously.
Computes (old ^ val) and stores the result in memory.
| address | Target memory address |
| val | Value to XOR with |
| mu::CALL_HELPER | ( | 0 | ) |
| mu::CALL_HELPER | ( | 1 | ) |
| mu::CALL_HELPER | ( | 2 | ) |
| mu::CALL_HELPER | ( | 3 | ) |
| mu::CALL_HELPER | ( | 4 | ) |
| mu::CALL_HELPER | ( | 5 | ) |
| mu::CALL_HELPER | ( | 6 | ) |
| mu::CALL_HELPER | ( | 7 | ) |
| mu::CALL_HELPER | ( | 8 | ) |
| mu::CALL_HELPER | ( | 9 | ) |
|
inline |
Definition at line 141 of file call_main.hpp.
| void mu::exit | ( | ) |
Terminates the MU kernel execution.
Forces an immediate termination of the MU kernel's execution. This function is typically called after a critical assertion failure.
| void mu::flushCache | ( | const void * | addr, |
| uint64_t | size = 64 |
||
| ) |
Flush cache lines for a memory region.
This function flushes all cache lines that contain data from the specified memory region, ensuring that modified data in those cache lines is written back to memory. The function will flush all cache lines that overlap with the memory range [addr, addr + size).
| addr | Starting address of the memory region to flush |
| size | Size of the memory region in bytes (default: 64 bytes) |
| void mu::flushCacheAll | ( | ) |
Flush all cache lines for current thread.
This function flushes all cache lines in the cache hierarchy associated with the current thread, ensuring that all modified data across all cache lines is written back to memory. This operation only affects the cache lines belonging to the current thread's cache hierarchy.
| uint64_t mu::getClockCycle | ( | ) |
Get the current clock cycle count.
Returns the current processor clock cycle count.
| uint64_t mu::getExecutionCount | ( | ) |
Return the execution count of Mu.
This function returns the execution count of Mu.
| uint64_t mu::getId | ( | ) |
Return the id of Mu.
This function returns the id of Mu.
| uint32_t mu::getTaskCount | ( | void | ) |
Get the total number of tasks.
This function returns the total number of tasks in the current execution.
| uint32_t mu::getTaskIdx | ( | void | ) |
Get the current task index.
This function returns the index of the currently executing task.
| int mu::hostPrintf | ( | const char * | format, |
| ... | |||
| ) |
Print a formatted string to the host.
This function sends a formatted string to the host interface. It behaves similarly to the standard printf function but targets the host.
| format | The format string. |
| ... | Additional arguments specifying data to print. |
| bool mu::isNormalMode | ( | uint32_t | mode | ) |
| int mu::logPrintf | ( | const char * | format, |
| ... | |||
| ) |
Prints a formatted log message.
This function prints a formatted log message using the specified format string and additional arguments. The log information is stored in memory and can be accessed via a CLI.
| format | The format string. |
| ... | Additional arguments for the format string. |
| int mu::logPrintf | ( | LogLevel | level, |
| const char * | format, | ||
| ... | |||
| ) |
Prints a formatted log message with a specified log level.
This function prints a formatted log message using the specified log level, format string, and additional arguments. The log information is stored in memory and can be accessed via a CLI.
| level | The log level. |
| format | The format string. |
| ... | Additional arguments for the format string. |
| void mu::memcpyGlobal | ( | void * | dst, |
| const void * | src, | ||
| uint64_t | size | ||
| ) |
Copy data to global cache.
This function copies data from source to destination and writes it directly to the global cache for shared access across multiple cores.
| dst | Destination address in global cache |
| src | Source address to copy from |
| size | Number of bytes to copy |
| uint64_t mu::muRunDpe | ( | uint32_t | swId, |
| DpeMode | mode, | ||
| uint32_t | tMask, | ||
| uint32_t | iLen, | ||
| uint32_t | jStart, | ||
| uint32_t | jLen, | ||
| uint32_t | weight, | ||
| uint8_t | isPhysical, | ||
| uint64_t | dstAddr, | ||
| uint32_t | tOffset, | ||
| uint32_t | tDelta, | ||
| uint32_t | maxStart, | ||
| uint32_t | skipVsb, | ||
| DpeLaunch | asyncMode | ||
| ) |
| void mu::muSetDpbMemory | ( | uint32_t | swId, |
| uint8_t | isSrc1Physical, | ||
| uint64_t | src1, | ||
| uint8_t | isSrc2Physical, | ||
| uint64_t | src2, | ||
| uint32_t | count | ||
| ) |
| void mu::muSetLdbMemory | ( | uint32_t | swId, |
| uint8_t | isSrc1Physical, | ||
| uint64_t | src1, | ||
| uint8_t | isSrc2Physical, | ||
| uint64_t | src2, | ||
| uint32_t | count | ||
| ) |
| void mu::prefetch | ( | const void * | addr, |
| uint64_t | size = 64 |
||
| ) |
Prefetch a contiguous memory region into cache.
This function prefetches memory starting from the specified address for the given size in bytes.
| addr | Starting address for prefetch. Should be 64-byte aligned (cache line boundary) for optimal performance. |
| size | Number of bytes to prefetch (valid range: 64 to 512 bytes, default: 64 bytes) |
| bool mu::prefetchLinkedList | ( | const void * | addr, |
| uint64_t | count, | ||
| uint64_t | ptrOffset | ||
| ) |
Prefetch cache lines by traversing a linked list.
This function prefetches cache lines by following a linked list structure. Starting from the given address, it reads the next pointer located at addr + ptrOffset and follows the chain, prefetching each node up to count times. The traversal stops early if a null pointer (0) is encountered at the next pointer location.
| addr | Starting address of the linked list node. Must be 8-byte aligned. |
| count | Maximum number of nodes to prefetch (valid range: 1 to 8) |
| ptrOffset | Offset to the next pointer in 8-byte units (valid range: 0 to 4088, must be 8-byte aligned) |
| void mu::prefetchStride | ( | const void * | addr, |
| uint64_t | count, | ||
| uint64_t | offset = 64 |
||
| ) |
Prefetch multiple cache lines at regular stride intervals.
This function prefetches cache lines starting from the specified address at regular intervals. The prefetch operation iterates from i = 0 to count - 1, prefetching the cache line at address: addr + offset * i.
| addr | Starting address for prefetch. Should be 64-byte aligned (cache line boundary) for optimal performance. |
| count | Number of cache lines to prefetch (valid range: 1 to 8) |
| offset | Stride interval in bytes (valid range: 64 to 4088, must be 64-byte aligned, default: 64 bytes) |
| void mu::profilerEnd | ( | const char * | tag | ) |
End the profiler.
This function ends the profiler.
| void mu::profilerStart | ( | const char * | tag | ) |
Start the profiler.
This function starts the profiler.
| uint64_t mu::readGlobal | ( | const void * | src | ) |
Read a value from global cache.
This function reads a 64-bit value from the specified address in the global cache. It ensures that the data is read directly from the global cache for shared access.
| src | Source address in global cache |
| void mu::syncMessage | ( | void * | src, |
| uint64_t | size | ||
| ) |
Send synchronous message to host and wait for response.
Sends a message to the host system and blocks until receiving a response. The function will not return until the host processes the message.
| src | Pointer to the source data to be sent |
| size | Size of the data in bytes |
| int mu::uartPrintf | ( | const char * | format, |
| ... | |||
| ) |
Print a formatted string to UART.
This function sends a formatted string to the UART interface. It behaves similarly to the standard printf function but targets UART.
| format | The format string. |
| ... | Additional arguments specifying data to print. |
| void mu::writeGlobal | ( | void * | dst, |
| uint64_t | value | ||
| ) |
Write a value to global cache.
This function writes a 64-bit value to the specified address in the global cache. It ensures that the data is written directly to the global cache for shared access.
| dst | Destination address in global cache |
| value | Value to write |
|
constexpr |
Definition at line 11 of file dpe_common.hpp.
|
constexpr |
Definition at line 264 of file call_main_template.hpp.