Skip to content

Commit

Permalink
XeGPU 4kx4kx4k GEMM performance test case with prefetching enabaled.
Browse files Browse the repository at this point in the history
  • Loading branch information
charithaintc committed Dec 6, 2023
1 parent c05b357 commit efa1f09
Show file tree
Hide file tree
Showing 6 changed files with 523 additions and 12 deletions.
5 changes: 3 additions & 2 deletions include/imex/ExecutionEngine/ImexRunnerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ extern "C" IMEX_RUNNERUTILS_EXPORT void
_mlir_ciface_fillResource1DF32(MemRefDescriptor<float, 1> *ptr, // NOLINT
float value);
extern "C" IMEX_RUNNERUTILS_EXPORT void
_mlir_ciface_fillMatrixRandomBF16(MemRefDescriptor<bf16, 1> *ptr, // NOLINT
int nrows, int ncols);
_mlir_ciface_fillMatrixRandomBF16(MemRefDescriptor<bf16, 1> *ptr);
extern "C" IMEX_RUNNERUTILS_EXPORT void
_mlir_ciface_fillMatrixRandomF16(MemRefDescriptor<f16, 1> *ptr);

extern "C" IMEX_RUNNERUTILS_EXPORT void
_mlir_ciface_printMemrefBF16(UnrankedMemRefType<bf16> *m);
Expand Down
23 changes: 17 additions & 6 deletions lib/ExecutionEngine/ImexRunnerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,28 @@ _mlir_ciface_fillResource1DF16(MemRefDescriptor<f16, 1> *ptr, // NOLINT
std::fill_n(ptr->allocated, ptr->sizes[0], f16_val);
}

/// Fills the given 2D memref (i.e. matrix) passed as 1D memref
// with randomly generated values. Numbers of rows and cols needs to be
// specified and strides are assumed to be [ncols, 1]
/// Fills 1D memref of bf16 type with random values uniformly
/// distributed in the range (-0.5, 0.5)
extern "C" void
_mlir_ciface_fillMatrixRandomBF16(MemRefDescriptor<bf16, 1> *ptr, // NOLINT
int nrows, int ncols) {
_mlir_ciface_fillMatrixRandomBF16(MemRefDescriptor<bf16, 1> *ptr) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> dist(-0.5f, 0.5f);

for (int i = 0; i < nrows * ncols; i++) {
for (int i = 0; i < ptr->sizes[0]; i++) {
ptr->allocated[i] = dist(gen);
}
}

/// Fills 1D memref of f16 type with random values uniformly
/// distributed in the range (-0.5, 0.5)
extern "C" void
_mlir_ciface_fillMatrixRandomF16(MemRefDescriptor<f16, 1> *ptr) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> dist(-0.5f, 0.5f);

for (int i = 0; i < ptr->sizes[0]; i++) {
ptr->allocated[i] = dist(gen);
}
}
Expand Down
Loading

0 comments on commit efa1f09

Please sign in to comment.