aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Zagieboylo <dzag1600@berkeley.edu>2014-05-01 09:47:08 -0700
committerDrew Zagieboylo <dzag1600@berkeley.edu>2014-05-01 09:47:08 -0700
commitd881585b4d0284b0a4c0fcf5187480067ba53f93 (patch)
treeea0363d5b0c377e8f19897974fc375241a1a37ac
parent6a39083874c81189bce70b8cb0d205f132ab1ad9 (diff)
downloadriscv-tests-d881585b4d0284b0a4c0fcf5187480067ba53f93.zip
riscv-tests-d881585b4d0284b0a4c0fcf5187480067ba53f93.tar.gz
riscv-tests-d881585b4d0284b0a4c0fcf5187480067ba53f93.tar.bz2
increased stack size and added multi-core interference
-rw-r--r--benchmarks/common/crt.S4
-rw-r--r--benchmarks/sdisorder/sdisorder.c58
2 files changed, 41 insertions, 21 deletions
diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S
index 82cad93..06eb614 100644
--- a/benchmarks/common/crt.S
+++ b/benchmarks/common/crt.S
@@ -107,8 +107,8 @@ _start:
csrr a0, hartid
lw a1, 4(zero)
- # give each core 128KB of stack + TLS
-#define STKSHIFT 17
+ # give each core 128MB of stack + TLS
+#define STKSHIFT 27
sll a2, a0, STKSHIFT
add tp, tp, a2
add sp, a0, 1
diff --git a/benchmarks/sdisorder/sdisorder.c b/benchmarks/sdisorder/sdisorder.c
index 03d0b0a..0581b18 100644
--- a/benchmarks/sdisorder/sdisorder.c
+++ b/benchmarks/sdisorder/sdisorder.c
@@ -1,3 +1,4 @@
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@@ -11,18 +12,18 @@
#endif
-void InitStream(int *a, int n) {
- for (int i=0; i<n; i++)
+void InitStream(uint *a, uint n) {
+ for (uint i=0; i<n; i++)
a[i] = (i+STEP) % n;
}
// TODO: Verify this does the random shuffling well
-void ShuffleStream(int *a, int n) {
+void ShuffleStream(uint *a, uint n) {
if (n>1) {
- int i;
+ uint i;
for (i = 0; i < n-1; i++) {
- int j = i + rand() / (RAND_MAX / (n-i)+1);
- int t = a[j];
+ uint j = (i + rand() / (RAND_MAX / (n-i)+1)) % n;
+ uint t = a[j];
a[j] = a[i];
a[i] = t;
}
@@ -30,19 +31,19 @@ void ShuffleStream(int *a, int n) {
}
-int Chase(int *a, int n, int iterations) {
- int loc[MLP];
- for (int m=0; m<MLP; m++)
- loc[m] = m * (n/MLP) + m;
+int Chase(uint *a, uint n, uint iterations) {
+ uint loc[MLP];
+ for (uint m=0; m<MLP; m++)
+ loc[m] = (m * (n/MLP) + m) % n;
- for (int k=0; k<iterations; k++) {
- for (int i=0; i<n/MLP; i++) {
- for (int m=0; m<MLP; m++) {
+ for (uint k=0; k<iterations; k++) {
+ for (uint i=0; i<n/MLP; i++) {
+ for (uint m=0; m<MLP; m++) {
loc[m] = a[loc[m]];
}
}
}
- for (int m=0; m<MLP; m++) {
+ for (uint m=0; m<MLP; m++) {
if (loc[m] < 0) {
//printf("woah\n");
}
@@ -59,14 +60,33 @@ void RandGenBench(int n) {
}
+void clogMem(uint len, uint step, uint its)
+{
+ uint arr[len];
+ uint j = its;
+ while(j > 0) {
+ for (uint i = 0; i < len; i += step) {
+ uint idx = i % len;
+ arr[idx] = arr[idx] + 1;
+ }
+ j -= 1;
+ }
+}
+
+void thread_entry(int cid, int nc)
+{
+ while (cid != 0) {
+ clogMem(1<<18, 64<<3,1<<7);
+ }
+}
int main(int argc, char* argv[]) {
-
- int num_iters = 1;
- int length = 1<<12;
- int randomize = 1;
- int stream[length];
+ uint num_iters = 1;
+ uint length = 1<<18;
+ uint randomize = 0;
+
+ uint stream[length];
InitStream(stream, length);
if (randomize) {