[PATCH] D49503: [test-suite] Added Image Processing Kernels Using Benchmark Library: Dither Algorithms

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 14:22:40 PDT 2018


Meinersbur added inline comments.


================
Comment at: MicroBenchmarks/ImageProcessing/Dither/main.cpp:36
+
+  initializeRandomImage((int *)*inputImage, HEIGHT, WIDTH);
+
----------------
Does this work? It dereferences the pointer returned by malloc (which should be the //uninitialized// first bytes of the memory allocated be malloc) and then casts it to a pointer. Id' expect this to result in a segfault.


================
Comment at: MicroBenchmarks/ImageProcessing/Dither/orderedDitherKernel.c:13
+                         int outputImage[height][width],
+                         int temp[height][width], int n, int m) {
+  int scale;
----------------
Do you need `m` to by a variable? It is only passed the constant `4` in this benchmark. The code would be more optimizable if the compiler knew the constant.

Alternatively, you could run the kernel several times with different values of `m`.


https://reviews.llvm.org/D49503





More information about the llvm-commits mailing list