3.6.3.14 SHLS-24

The SHLS-24 warning message informs users that the memory partitioning request specified through a pragma has failed, and provides the reason for the failure. Below, we will outline a few common reasons for failure.

Reason 1

Message:

Warning: (SHLS-24) The user specified memory '{variable}' on {location} could not be partitioned because the memory has incompatible accesses such as out-of-bound array access, casting, and partial accesses.
/*****************************************************************
 *  This example is expected to result in
 *  - Code  : SHLS-24
 *  - Type  : Warning
 *  - Cause : User-specified memory partitioning failed due to
 *            incompatible accesses.
 *            - array_1 : Out-of-bound access
 *            - array_2 : Memory casting
 *            - array_3 : Partial access
 *****************************************************************/ 
#include <stdint.h>

#pragma HLS memory partition variable(array) type(complete)
int      array[10];
#pragma HLS memory partition variable(array_u8) type(complete)
uint8_t  array_u8[10];
#pragma HLS memory partition variable(array_u16) type(complete)
uint16_t array_u16[10];

void DUT(unsigned v) {
    #pragma HLS function top

    // Out-of-bound access
    array[10] *= 2;

    // Accessing by casting to a different data type
    *((uint16_t*)array_u8+1) += 1;

    // Partial element access
    *((uint8_t*)array_u16+v) |= 1;
}

Output

Warning: (SHLS-24) The user specified memory 'array' on line 14 of test.cpp could not be partitioned because the memory has incompatible accesses such as out-of-bound array access, casting, and partial accesses.
Warning: (SHLS-24) The user specified memory 'array_u8' on line 16 of test.cpp could not be partitioned because the memory has incompatible accesses such as out-of-bound array access, casting, and partial accesses.
Warning: (SHLS-24) The user specified memory 'array_u16' on line 18 of test.cpp could not be partitioned because the memory has incompatible accesses such as out-of-bound array access, casting, and partial accesses.
Reason 2

Message:

Warning: (SHLS-24) The user specified memory '{variable}' on {location} could not be partitioned because the memory aliases with another memory at {location} that has a different partitioning.
/*****************************************************************
 *  This example is expected to result in
 *  - Code  : SHLS-24
 *  - Type  : Warning
 *  - Cause : Both 'x' and 'y' could be accessed by function sum()
 *            through argument 'v', so they cannot be partitioned
 *            in different way.
 *****************************************************************/
int sum(int *v) {
#pragma HLS function noinline
    int sum = 0;
    for(int i=0; i<100; i++)
        sum += v[i];
    return sum;
}

#pragma HLS memory partition variable(x) type(block)  dim(1) factor(4)
int x[100];
#pragma HLS memory partition variable(y) type(cyclic) dim(1) factor(4)
int y[100];

int DUT() {
#pragma HLS function top
    return sum(x) + sum(y);
}

Output

Warning: (SHLS-24) The user specified memory 'x' on line 18 of test.cpp could not be partitioned because the memory aliases with another memory at line 9 of test.cpp that has a different partitioning.
Warning: (SHLS-24) The user specified memory 'y' on line 20 of test.cpp could not be partitioned because the memory aliases with another memory at line 9 of test.cpp that has a different partitioning.
Reason 3

Message:

Warning: (SHLS-24) The user specified memory '{variable}' on {location} could not be partitioned because the memory will be partitioned into too many slices which may cause runtime issues.
/*****************************************************************
 *  This example is expected to result in
 *  - Code  : SHLS-24
 *  - Type  : Warning
 *  - Cause : More than 4096 memory partitions will be created
 *            if the user's specified request is applied.
 *****************************************************************/ 
#pragma HLS memory partition variable(big_array) type(complete)
int big_array[5000];

void DUT() {
    #pragma HLS function top
    for (int i = 0; i < 5000; i++) {
        big_array[i] *= 2;
    }
}

Related to: Memory Partitioning