Cannot Apply Array Stencil Optimization - Cannot Apply Array Stencil Optimization - 2026.1 English - UG1448

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2026-06-23
Version
2026.1 English

Description

Warning: Cannot apply array stencil optimization to variable in loop because the accesses are not read-only in the loop.

Explanation

Stencil optimization cannot be applied to ports that both read and write data. To enable optimization, modify the port to be read-only.

DTYPE temp, mul;
stencil_label1:for (r=0; r<row_size-2; r++) {
stencil_label2:for (c=0; c<col_size-2; c++) {
#pragma HLS pipeline II=1
#pragma HLS array_stencil variable=O
                 temp = (DTYPE)0;
stencil_label3:for (k1=0;k1<3;k1++){
stencil_label4:for (k2=0;k2<3;k2++){
                 mul = F_buf[k1][k2] * O[r+k1][c+k2];
                 temp += mul;
               }
               }
               O[r][c] = temp;
               *(S + (r*col_size) + c) = temp;
               }
               }
}