[test-suite] r338924 - [test-suite] Add pathfinder kernel from Rodinia Benchmark
Pankaj Kukreja via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 3 14:38:21 PDT 2018
Author: proton
Date: Fri Aug 3 14:38:21 2018
New Revision: 338924
URL: http://llvm.org/viewvc/llvm-project?rev=338924&view=rev
Log:
[test-suite] Add pathfinder kernel from Rodinia Benchmark
Adding pathfinder kernel from Rodinia benchmark.
Reviewers: Meinersbur
Differential Revision: https://reviews.llvm.org/D49886
Added:
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/CMakeLists.txt
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/main.c
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.h
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.reference_output
test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinderKernel.c
Modified:
test-suite/trunk/MultiSource/Benchmarks/Rodinia/CMakeLists.txt
Modified: test-suite/trunk/MultiSource/Benchmarks/Rodinia/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/CMakeLists.txt?rev=338924&r1=338923&r2=338924&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/CMakeLists.txt Fri Aug 3 14:38:21 2018
@@ -1,2 +1,3 @@
add_subdirectory(hotspot)
add_subdirectory(srad)
+add_subdirectory(pathfinder)
Added: test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/CMakeLists.txt?rev=338924&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/CMakeLists.txt (added)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/CMakeLists.txt Fri Aug 3 14:38:21 2018
@@ -0,0 +1,8 @@
+set(PROG pathfinder)
+list(APPEND CFLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../Common/)
+set(HASH_PROGRAM_OUTPUT 1)
+llvm_multisource(pathfinder
+ main.c
+ pathfinderKernel.c
+ ../Common/glibc_compat_rand.c
+)
Added: test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/main.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/main.c?rev=338924&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/main.c (added)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/main.c Fri Aug 3 14:38:21 2018
@@ -0,0 +1,41 @@
+#include "glibc_compat_rand.h"
+#include "pathfinder.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+void pathFinderKernel(int rows, int cols, int *data, int *result, int *src);
+void initialize(int rows, int cols, int *result, int *data);
+void printResult(int len, int *result);
+
+int main() {
+
+ int *data = (int *)malloc(sizeof(int) * ROWS * COLS);
+ int *result = (int *)malloc(sizeof(int) * COLS);
+ int *src = (int *)malloc(sizeof(int) * COLS);
+
+ initialize(ROWS, COLS, result, data);
+
+ pathFinderKernel(ROWS, COLS, data, result, src);
+
+ printResult(COLS, result);
+
+ return 0;
+}
+
+void initialize(int rows, int cols, int *result, int *data) {
+ glibc_compat_srand(SEED);
+ for (int i = 0; i < rows; i++) {
+ for (int j = 0; j < cols; j++) {
+ data[i * cols + j] = glibc_compat_rand() % 10;
+ }
+ }
+ for (int j = 0; j < COLS; j++) {
+ result[j] = data[j];
+ }
+}
+
+void printResult(int len, int *result) {
+ for (int i = 0; i < len; i++) {
+ printf("%d\n", result[i]);
+ }
+}
Added: test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.h?rev=338924&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.h (added)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.h Fri Aug 3 14:38:21 2018
@@ -0,0 +1,8 @@
+#ifndef _PATHFINDER_H_
+#define _PATHFINDER_H_
+
+#define ROWS 100000
+#define COLS 500
+#define SEED 9
+
+#endif
\ No newline at end of file
Added: test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.reference_output?rev=338924&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.reference_output (added)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinder.reference_output Fri Aug 3 14:38:21 2018
@@ -0,0 +1 @@
+38b47b2426f6fc1af9d4d0e2066f834d
Added: test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinderKernel.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinderKernel.c?rev=338924&view=auto
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinderKernel.c (added)
+++ test-suite/trunk/MultiSource/Benchmarks/Rodinia/pathfinder/pathfinderKernel.c Fri Aug 3 14:38:21 2018
@@ -0,0 +1,20 @@
+#include "pathfinder.h"
+#include <stdio.h>
+#define MIN(a, b) ((a) <= (b) ? (a) : (b))
+void pathFinderKernel(int row, int col, int data[row][col], int result[col],
+ int src[col]) {
+ for (int t = 0; t < row - 1; t++) {
+ for (int n = 0; n < col; n++) {
+ src[n] = result[n];
+ }
+ for (int n = 0; n < col; n++) {
+ if (n == 0) {
+ result[n] = data[t + 1][n] + MIN(src[n], src[n + 1]);
+ } else if (n == col - 1) {
+ result[n] = data[t + 1][n] + MIN(src[n], src[col - 2]);
+ } else {
+ result[n] = data[t + 1][n] + MIN(src[n], MIN(src[n - 1], src[n + 1]));
+ }
+ }
+ }
+}
More information about the llvm-commits
mailing list