aboutsummaryrefslogtreecommitdiff
path: root/rcc-legacy/tests/performance/13_stencil1.sy
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-06-08 17:10:31 +0800
commit72af0dedf9e18911da65b9a5c4906689e868d9fc (patch)
tree2ecbad93f96ab8ad7e26dc02cd02d802f853ab97 /rcc-legacy/tests/performance/13_stencil1.sy
parent8faf6d290d6703b1775e0ad7a8928a4ebea4b11b (diff)
downloadrcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.gz
rcc-project-72af0dedf9e18911da65b9a5c4906689e868d9fc.tar.xz
[legacy] Add functional and performance test suites
Diffstat (limited to 'rcc-legacy/tests/performance/13_stencil1.sy')
-rw-r--r--rcc-legacy/tests/performance/13_stencil1.sy63
1 files changed, 63 insertions, 0 deletions
diff --git a/rcc-legacy/tests/performance/13_stencil1.sy b/rcc-legacy/tests/performance/13_stencil1.sy
new file mode 100644
index 0000000..4e7e16e
--- /dev/null
+++ b/rcc-legacy/tests/performance/13_stencil1.sy
@@ -0,0 +1,63 @@
+const int width = 1024;
+const int height = 1024;
+int image_in[width * height];
+int image_out[width * height];
+
+int cutout(int val){
+ if(val < 0){
+ val = 0;
+ }
+ else{
+ if(val > 255){
+ val = 255;
+ }
+ }
+ return val;
+}
+
+int main(){
+ int i;
+ int j;
+ int num = getarray(image_in);
+
+ starttime();
+ j = 1;
+ while(j < width - 1){
+ i = 1;
+ while(i < height - 1){
+ int im1jm1 =(i-1)*width + j-1;
+ int im1j =(i-1)*width + j;
+ int im1jp1 =(i-1)*width + j+1;
+ int ijm1 =(i )*width + j-1;
+ int ij =(i )*width + j;
+ int ijp1 =(i )*width + j+1;
+ int ip1jm1 =(i+1)*width + j-1;
+ int ip1j =(i+1)*width + j;
+ int ip1jp1 =(i+1)*width + j+1;
+ int val = 8*image_in[ij] - image_in[im1jm1] - image_in[im1j] - image_in[im1jp1] -image_in[ijm1] - image_in[ijp1] - image_in[ip1jm1] - image_in[ip1j] - image_in[ip1jp1];
+
+ image_out[i*width + j] = cutout(val);
+ i = i + 1;
+ }
+ j = j + 1;
+ }
+
+ i = 0;
+ while(i < height){
+ image_out[i * width] = image_in[i * width];
+ image_out[i * width + width - 1] = image_in[i * width + width - 1];
+ i = i + 1;
+ }
+
+ j = 0;
+ while(j < width){
+ image_out[j] = image_in[j];
+ image_out[(height - 1) * width + j] = image_in[(height - 1) * width + j];
+ j = j + 1;
+ }
+
+ stoptime();
+
+ putarray(width * height, image_out);
+ return num;
+} \ No newline at end of file