[test-suite] r339154 - Fixed build error caused by MicroBenchmarks/ImageProcessing with clang
Pankaj Kukreja via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 7 10:21:26 PDT 2018
Author: proton
Date: Tue Aug 7 10:21:25 2018
New Revision: 339154
URL: http://llvm.org/viewvc/llvm-project?rev=339154&view=rev
Log:
Fixed build error caused by MicroBenchmarks/ImageProcessing with clang
clang gives error
Changes:
Removed -std=c++11 flag from cmake files of ImageProcessing kernels
Used c++03 version of benchmark library instead of c++11
In main.cpp changed Args({a, b}) to ArgPair(a,b)
In main.cpp changed for(auto _ : state) to while(state.KeepRunning())
Modified:
test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp
test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/main.cpp
test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/main.cpp
test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp
test-suite/trunk/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt Tue Aug 7 10:21:25 2018
@@ -1,12 +1,12 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
-list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11)
+list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
+list(APPEND LDFLAGS -lm)
llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt")
llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/anisotropicDiffusion.reference_output")
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
-
llvm_test_executable(AnisotropicDiffusion ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp anisotropicDiffusionKernel.c)
target_link_libraries(AnisotropicDiffusion benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp Tue Aug 7 10:21:25 2018
@@ -6,6 +6,7 @@
#include "ImageHelper.h"
#include "diffusion.h"
+#include <cstdlib>
#include <iostream> // std::cerr
#define BENCHMARK_LIB
@@ -82,7 +83,7 @@ void BENCHMARK_ANISTROPIC_DIFFUSION(benc
/* first call made to warm up cache */
anisotropicDiffusionKernel(height, width, inputImage, outputImage, ITERATION);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
anisotropicDiffusionKernel(height, width, inputImage, outputImage,
ITERATION);
}
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt Tue Aug 7 10:21:25 2018
@@ -1,6 +1,7 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11)
+list(APPEND LDFLAGS -lm)
llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt")
llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/boxBlur.reference_output")
@@ -9,7 +10,6 @@ llvm_test_verify("${CMAKE_SOURCE_DIR}/Ha
llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/gaussianBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/gaussianBlur.reference_output")
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
-
llvm_test_executable(blur ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp boxBlurKernel.c gaussianBlurKernel.c)
target_link_libraries(blur benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/main.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/main.cpp?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/main.cpp (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/main.cpp Tue Aug 7 10:21:25 2018
@@ -6,6 +6,7 @@ Indian Institute of Technology Hyderabad
#include "ImageHelper.h"
#include "blur.h"
+#include <cstdlib>
#include <iostream>
#define BENCHMARK_LIB
@@ -126,7 +127,7 @@ int main(int argc, char *argv[]) {
void BENCHMARK_boxBlurKernel(benchmark::State &state) {
int height = state.range(0);
- int width = state.range(1);
+ int width = state.range(0);
int *outputImage = (int *)malloc(sizeof(int) * (height) * (width));
@@ -137,7 +138,7 @@ void BENCHMARK_boxBlurKernel(benchmark::
/* This call is to warm up the cache */
boxBlurKernel(height, width, inputImage, outputImage);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
boxBlurKernel(height, width, inputImage, outputImage);
}
/* Since we are not passing state.range as 20 this if case will always be
@@ -150,16 +151,16 @@ void BENCHMARK_boxBlurKernel(benchmark::
free(outputImage);
}
BENCHMARK(BENCHMARK_boxBlurKernel)
- ->Args({128, 128})
- ->Args({256, 256})
- ->Args({512, 512})
- ->Args({1024, 1024})
+ ->Arg(128)
+ ->Arg(256)
+ ->Arg(512)
+ ->Arg(1024)
->Unit(benchmark::kMicrosecond);
void BENCHMARK_GAUSSIAN_BLUR(benchmark::State &state) {
int height = state.range(0);
- int width = state.range(1);
+ int width = state.range(0);
int *outputImage = (int *)malloc(sizeof(int) * (height) * (width));
@@ -169,8 +170,7 @@ void BENCHMARK_GAUSSIAN_BLUR(benchmark::
}
/* This call is to warm up the cache */
gaussianBlurKernel(height, width, inputImage, outputImage);
-
- for (auto _ : state) {
+ while (state.KeepRunning()) {
gaussianBlurKernel(height, width, inputImage, outputImage);
}
/* Since we are not passing state.range as 20 this if case will always be
@@ -184,9 +184,9 @@ void BENCHMARK_GAUSSIAN_BLUR(benchmark::
}
BENCHMARK(BENCHMARK_GAUSSIAN_BLUR)
- ->Args({128, 128})
- ->Args({256, 256})
- ->Args({512, 512})
- ->Args({1024, 1024})
+ ->Arg(128)
+ ->Arg(256)
+ ->Arg(512)
+ ->Arg(1024)
->Unit(benchmark::kMicrosecond);
#endif
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt Tue Aug 7 10:21:25 2018
@@ -1,5 +1,6 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
-list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11)
+list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
+list(APPEND LDFLAGS -lm)
llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt")
llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/orderedDither.reference_output")
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/main.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/main.cpp?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/main.cpp (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/main.cpp Tue Aug 7 10:21:25 2018
@@ -6,6 +6,7 @@
#include "ImageHelper.h"
#include "dither.h"
#include <cmath>
+#include <cstdlib>
#include <iostream> // std::cerr
#define BENCHMARK_LIB
@@ -79,7 +80,7 @@ void BENCHMARK_ORDERED_DITHER(benchmark:
/* This call is to warm up the cache */
orderedDitherKernel(height, width, inputImage, outputImage, temp, n, m);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
orderedDitherKernel(height, width, inputImage, outputImage, temp, n, m);
}
/* Since we are not passing state.range as 20 this if case will always be
@@ -105,10 +106,10 @@ static void CustomArguments(benchmark::i
start = 128;
}
for (int i = start; i <= limit; i <<= 1) {
- b->Args({i, 2});
- b->Args({i, 3});
- b->Args({i, 4});
- b->Args({i, 8});
+ b->ArgPair(i, 2);
+ b->ArgPair(i, 3);
+ b->ArgPair(i, 4);
+ b->ArgPair(i, 8);
}
}
BENCHMARK(BENCHMARK_ORDERED_DITHER)
@@ -128,7 +129,7 @@ void BENCHMARK_FLOYD_DITHER(benchmark::S
}
/* This call is to warm up the cache */
floydDitherKernel(height, width, inputImage, outputImage);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
floydDitherKernel(height, width, inputImage, outputImage);
}
/* Since we are not passing state.range as 20 this if case will always be
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt Tue Aug 7 10:21:25 2018
@@ -1,5 +1,5 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
-list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11)
+list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt")
llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/bicubic.reference_output")
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp Tue Aug 7 10:21:25 2018
@@ -5,6 +5,7 @@
*/
#include "ImageHelper.h"
#include "interpolation.h"
+#include <cstdlib>
#include <iostream> // std::cerr
#define BENCHMARK_LIB
@@ -89,7 +90,7 @@ void BENCHMARK_BICUBIC_INTERPOLATION(ben
/* This call is to warm up the cache */
bicubicKernel(inputHeight, inputWidth, inputImage, outputImage);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
bicubicKernel(inputHeight, inputWidth, inputImage, outputImage);
}
@@ -126,7 +127,7 @@ void BENCHMARK_BILINEAR_INTERPOLATION(be
/* This call is to warm up the cache */
bilinearKernel(inputHeight, inputWidth, inputImage, outputImage);
- for (auto _ : state) {
+ while (state.KeepRunning()) {
bilinearKernel(inputHeight, inputWidth, inputImage, outputImage);
}
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp?rev=339154&r1=339153&r2=339154&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp Tue Aug 7 10:21:25 2018
@@ -7,6 +7,7 @@ Indian Institute of Technology Hyderabad
#include "ImageHelper.h"
#include "glibc_compat_rand.h"
+#include <cstdlib>
#include <fstream> // For reading and saving Image
#include <iostream> // For std::cerr
More information about the llvm-commits
mailing list