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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 16:52:21 PDT 2018


Meinersbur accepted this revision.
Meinersbur added a comment.
This revision is now accepted and ready to land.

What is the execution time of this?



================
Comment at: MicroBenchmarks/ImageProcessing/Dither/main.cpp:36
+
+  initializeRandomImage((int *)*inputImage, HEIGHT, WIDTH);
+
----------------
proton wrote:
> Meinersbur wrote:
> > 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.
> Yes, It works properly because the pointer returned by malloc is casted as **int (*) [][]**. So to access the array we have to first dereference the pointer (use it as (*inputImage)[i][j]).
Looks much better now


================
Comment at: MicroBenchmarks/ImageProcessing/Dither/main.cpp:99
+  if (state.range(0) == 20) {
+    saveImage(outputImage, (const char *)"failedCase.txt", height, width);
+  }
----------------
Could you add a comment that this exists to avoid the computation being optimized away?


================
Comment at: MicroBenchmarks/ImageProcessing/Dither/main.cpp:148
+  if (state.range(0) == 20) {
+    saveImage(outputImage, (const char *)"failedCase.txt", height, width);
+  }
----------------
Here as well


https://reviews.llvm.org/D49503





More information about the llvm-commits mailing list