The .stencil() primitive generates a Stencil IR node in HCL program, which will later be handled SODA compiler to generate high performance stencil kernels with optimized dataflow architecture. Here is an example of usage:
def jacobi(input_image, output_image):
def jacobi_kernel(y, x):
return (input_image[y+1, x-1] +
input_image[y , x ] +
input_image[y+1, x ] +
input_image[y+1, x+1] +
input_image[y+2, x ]) / 5
return hcl.update(output_image, jacobi_kernel, name=output_image.name)
s = hcl.create_schedule([input_image, output_image], jacobi)
s[jacobi.output].stencil()
Right now, stencil kernel takes arrays as input arguments by default. The goal to generate stencil kernel with hls::stream input and outputs when .stencil() primitive is used along with to() for the stencil stage.
Target
Expected input program
s = hcl.create_schedule([input_image, output_image], jacobi)
s[jacobi.output].stencil()
s.to(x, s[jacobi.output])
s.to(jacobi.output.y, output)
Problem Description
The
.stencil()
primitive generates aStencil
IR node in HCL program, which will later be handled SODA compiler to generate high performance stencil kernels with optimized dataflow architecture. Here is an example of usage:The generated HLS code:
Right now, stencil kernel takes arrays as input arguments by default. The goal to generate stencil kernel with hls::stream input and outputs when
.stencil()
primitive is used along withto()
for the stencil stage.Target
Expected input program
Expected output