forked from OSchip/llvm-project
[mlir] Fix integration tests
This commit is contained in:
parent
5c0164890c
commit
9cbef8c905
|
@ -209,6 +209,12 @@ extern "C" MLIR_CRUNNERUTILS_EXPORT void printClose();
|
|||
extern "C" MLIR_CRUNNERUTILS_EXPORT void printComma();
|
||||
extern "C" MLIR_CRUNNERUTILS_EXPORT void printNewline();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Small runtime support library for timing execution and printing GFLOPS
|
||||
//===----------------------------------------------------------------------===//
|
||||
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_flops(double flops);
|
||||
extern "C" MLIR_CRUNNERUTILS_EXPORT double rtclock();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Small runtime support library for sparse tensors.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: mlir-cpu-runner -O3 -e main -entry-point-result=void \
|
||||
// Activate to dump assembly
|
||||
// R_UN: -dump-object-file -object-filename=/tmp/a.o \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext | \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
|
||||
// Use tee to both print to stderr and FileCheck
|
||||
// RUN: tee -a /dev/stderr | FileCheck %s
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// RUN: mlir-cpu-runner -O3 -e main -entry-point-result=void \
|
||||
// Activate to dump assembly
|
||||
// R_UN: -dump-object-file -object-filename=/tmp/a.o \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext | \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
|
||||
// Use tee to both print to stderr and FileCheck
|
||||
// RUN: tee -a /dev/stderr | FileCheck %s
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// RUN: mlir-cpu-runner -O3 -e main -entry-point-result=void \
|
||||
// Activate to dump assembly
|
||||
// R_UN: -dump-object-file -object-filename=/tmp/a.o \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext | \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
|
||||
// Use tee to both print to stderr and FileCheck
|
||||
// RUN: tee -a /dev/stderr | FileCheck %s
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// RUN: mlir-cpu-runner -O3 -e main -entry-point-result=void \
|
||||
// Activate to dump assembly
|
||||
// R_UN: -dump-object-file -object-filename=/tmp/a.o \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext | \
|
||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
|
||||
// Use tee to both print to stderr and FileCheck
|
||||
// RUN: tee -a /dev/stderr | FileCheck %s
|
||||
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
|
||||
#include "mlir/ExecutionEngine/CRunnerUtils.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <cinttypes>
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -32,4 +36,23 @@ extern "C" void printClose() { fputs(" )", stdout); }
|
|||
extern "C" void printComma() { fputs(", ", stdout); }
|
||||
extern "C" void printNewline() { fputc('\n', stdout); }
|
||||
|
||||
/// Prints GFLOPS rating.
|
||||
extern "C" void print_flops(double flops) {
|
||||
fprintf(stderr, "%lf GFLOPS\n", flops / 1.0E9);
|
||||
}
|
||||
|
||||
/// Returns the number of seconds since Epoch 1970-01-01 00:00:00 +0000 (UTC).
|
||||
extern "C" double rtclock() {
|
||||
#ifndef _WIN32
|
||||
struct timeval tp;
|
||||
int stat = gettimeofday(&tp, NULL);
|
||||
if (stat != 0)
|
||||
fprintf(stderr, "Error returning time from gettimeofday: %d\n", stat);
|
||||
return (tp.tv_sec + tp.tv_usec * 1.0e-6);
|
||||
#else
|
||||
fprintf(stderr, "Timing utility not implemented on Windows\n");
|
||||
return 0.0;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
#endif // MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
|
||||
#include "mlir/ExecutionEngine/RunnerUtils.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif // _WIN32
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_vector_4x4xf32(
|
||||
StridedMemRefType<Vector2D<4, 4, float>, 2> *M) {
|
||||
impl::printMemRef(*M);
|
||||
|
@ -84,22 +80,3 @@ extern "C" void
|
|||
_mlir_ciface_print_memref_4d_f32(StridedMemRefType<float, 4> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
/// Prints GFLOPS rating.
|
||||
extern "C" void print_flops(double flops) {
|
||||
fprintf(stderr, "%lf GFLOPS\n", flops / 1.0E9);
|
||||
}
|
||||
|
||||
/// Returns the number of seconds since Epoch 1970-01-01 00:00:00 +0000 (UTC).
|
||||
extern "C" double rtclock() {
|
||||
#ifndef _WIN32
|
||||
struct timeval tp;
|
||||
int stat = gettimeofday(&tp, NULL);
|
||||
if (stat != 0)
|
||||
fprintf(stderr, "Error returning time from gettimeofday: %d\n", stat);
|
||||
return (tp.tv_sec + tp.tv_usec * 1.0e-6);
|
||||
#else
|
||||
fprintf(stderr, "Timing utility not implemented on Windows\n");
|
||||
return 0.0;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue