Skip to content

Commit

Permalink
[apps] Introduce new ad-hoc 569JNRXZghikmswarming for fconv,fmatmul,j…
Browse files Browse the repository at this point in the history
…acobi
  • Loading branch information
mp-17 committed Nov 28, 2023
1 parent 4f11b13 commit 0055270
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 1 deletion.
9 changes: 9 additions & 0 deletions apps/benchmarks/benchmark/fconv3d.bmark
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ extern int64_t CH;
extern int64_t F;

void warm_caches(uint64_t heat) {
volatile double buf;

for (uint64_t k = 0; k < heat; ++k)
fconv3d_CHx7x7(o, i, f, M, N, CH, F);
// The following artificial warming ensures, with a larger cache,
// not to experience any cache misses
#ifdef AD_HOC_WARMING
for (uint64_t k = 0; k < F*F*CH; ++k)
buf = (volatile double) *(&(f[k]));
fconv3d_CHx7x7_warm(o, i, f, M, N, CH, F);
#endif
}

int main() {
Expand Down
2 changes: 2 additions & 0 deletions apps/benchmarks/benchmark/fmatmul.bmark
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ void warm_caches(uint64_t heat) {

for (uint64_t k = 0; k < heat; ++k)
fmatmul(c, a, b, M, N, P);
#ifdef AD_HOC_WARMING
// Vector stores have invalidated the A mtx cache lines!
// Fetch them again
for (int m = 0; m < M; ++m) {
buf = (volatile double) *a_;
a_ += N;
}
#endif
}

int main() {
Expand Down
9 changes: 8 additions & 1 deletion apps/benchmarks/benchmark/jacobi2d.bmark
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ extern DATA_TYPE A_s[] __attribute__((aligned(4 * NR_LANES), section(".l2")));
extern DATA_TYPE B_s[] __attribute__((aligned(4 * NR_LANES), section(".l2")));

void warm_caches(uint64_t heat, DATA_TYPE* A_fixed_v, DATA_TYPE* B_fixed_v) {

volatile double buf;

for (uint64_t k = 0; k < heat; ++k)
j2d_v(R, C, A_fixed_v, B_fixed_v, TSTEPS);
#ifdef AD_HOC_WARMING
for (uint64_t k = 0; k < R*C; ++k)
buf = (volatile double)* &(A_fixed_v[k]);
#endif
}

int main() {
Expand All @@ -117,7 +124,7 @@ int main() {

#ifndef SPIKE
// Warm-up caches
warm_caches(WARM_CACHES_ITER, A_fixed_s, B_fixed_s);
warm_caches(WARM_CACHES_ITER, A_fixed_v, B_fixed_s);
#endif

// Measure vector kernel execution
Expand Down
6 changes: 6 additions & 0 deletions apps/fconv3d/fconv3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ void fconv3d_CHx7x7(double *o, double *i, double *f, int64_t M, int64_t N,
void fconv3d_CHx7x7_block(double *o, double *i, double *f, int64_t M, int64_t N,
int64_t n_, int64_t C, int64_t F);

void fconv3d_CHx7x7_warm(double *o, double *i, double *f, int64_t M, int64_t N,
int64_t C, int64_t F);

void fconv3d_warm(double *o, double *i, double *f, int64_t M, int64_t N,
int64_t n_, int64_t C, int64_t F);

#define MIN(a, b) ((a) < (b) ? (a) : (b))

// Threshold for FP numbers comparison during the final check
Expand Down
Loading

0 comments on commit 0055270

Please sign in to comment.