3.5.1.14.2 User-Specified Memory Partitioning

The user can explicitly specify a memory to be partitioned via the memory partition pragma (#pragma HLS memory partition variable, #pragma HLS memory partition argument). See 3.6.1.23 Partition Top-Level Interface and 3.6.1.22 Partition Memory for more details. User-specified partitioning also analyzes accesses but partitions based on a predefined structure and array dimension. SmartHLS supports block, cyclic and complete types for arrays, and struct_fields and complete partitioning for struct. Specifying the type to be none prevents partitioning the specified memory.

The memory partition pragma has optional arguments type and dim that specifies the partition type and dimension to partition, respectively. The default type is complete which means to partition the array into individual elements, and the default dimension is 0 which means to partition all dimensions. The factor argument is required for block and cyclic types to specify the partitioning factor, i.e. the number of partitions. Note that the pragma will be ignored if the factor <= 1.

Important: Lower numbered dimensions correspond to left-ward dimensions of the array and higher numbered dimensions correspond to right-ward dimensions of the array. For an a 2d array A[N][M], dim(1) refers to the dimension with N elements, and dim(2) refers to the dimension with M elements.

With user-specified partitioning, SmartHLS outputs messages to the console stating the variable set to be partitioned and its settings. SmartHLS also outputs messages specifying if a memory has been partitioned and into how many partitions. If a memory is specified to be partitioned but cannot be partitioned, SmartHLS will output a warning.

Info: Found user-specified memory: "array" on line 6 of test.c, with partition type: Complete, partition dimension: 0.
Info: Found user-specified memory: "array3d" on line 27 of test.c, with partition type: Block, partition dimension: 1, partition factor 2.
Warning: The user-specified memory "array3d" on line 27 of test.c could not be partitioned because a loop variable indexing into a multi-dimenional array comes from a loop variable and goes out of the array dimension bounds. Going outside of array dimension bounds is not supported for memory partitioning.
Info: Partitioning memory: array into 8 partitions.

For more examples and details, see Optimization Guide.