forked from OSchip/llvm-project
[mlir] Fix the names of exported functions
The names of the functions that are supposed to be exported do not match the implementations. This is due in part to cac7aabbd8
.
This change makes the implementations and declarations match and adds a couple missing declarations.
The new names follow the pattern of the existing `verify` functions where the prefix is maintained as `_mlir_ciface_` but the suffix follows the new naming convention.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D124891
This commit is contained in:
parent
45643cfcc1
commit
d4555698f8
|
@ -341,49 +341,54 @@ int64_t verifyMemRef(UnrankedMemRefType<T> &actual,
|
|||
// Currently exposed C API.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefShapeI8(UnrankedMemRefType<int8_t> *m);
|
||||
_mlir_ciface_printMemrefShapeI8(UnrankedMemRefType<int8_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefShapeI32(UnrankedMemRefType<int32_t> *m);
|
||||
_mlir_ciface_printMemrefShapeI32(UnrankedMemRefType<int32_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefShapeI64(UnrankedMemRefType<int64_t> *m);
|
||||
_mlir_ciface_printMemrefShapeI64(UnrankedMemRefType<int64_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefShapeF32(UnrankedMemRefType<float> *m);
|
||||
_mlir_ciface_printMemrefShapeF32(UnrankedMemRefType<float> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefShapeF64(UnrankedMemRefType<double> *m);
|
||||
_mlir_ciface_printMemrefShapeF64(UnrankedMemRefType<double> *m);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefI8(UnrankedMemRefType<int8_t> *m);
|
||||
_mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefI32(UnrankedMemRefType<int32_t> *m);
|
||||
_mlir_ciface_printMemrefI32(UnrankedMemRefType<int32_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefF32(UnrankedMemRefType<float> *m);
|
||||
_mlir_ciface_printMemrefI64(UnrankedMemRefType<int64_t> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemrefF64(UnrankedMemRefType<double> *m);
|
||||
_mlir_ciface_printMemrefF32(UnrankedMemRefType<float> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
_mlir_ciface_printMemrefF64(UnrankedMemRefType<double> *m);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t _mlir_ciface_nanoTime();
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefI32(int64_t rank, void *ptr);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefI64(int64_t rank, void *ptr);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefF32(int64_t rank, void *ptr);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefF64(int64_t rank, void *ptr);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void printCString(char *str);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemref0dF32(StridedMemRefType<float, 0> *m);
|
||||
_mlir_ciface_printMemref0dF32(StridedMemRefType<float, 0> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemref1dF32(StridedMemRefType<float, 1> *m);
|
||||
_mlir_ciface_printMemref1dF32(StridedMemRefType<float, 1> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemref2dF32(StridedMemRefType<float, 2> *m);
|
||||
_mlir_ciface_printMemref2dF32(StridedMemRefType<float, 2> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemref3dF32(StridedMemRefType<float, 3> *m);
|
||||
_mlir_ciface_printMemref3dF32(StridedMemRefType<float, 3> *m);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void
|
||||
mlirCifacePrintMemref4dF32(StridedMemRefType<float, 4> *m);
|
||||
_mlir_ciface_printMemref4dF32(StridedMemRefType<float, 4> *m);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void mlirCifacePrintMemrefVector4x4xf32(
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_printMemrefVector4x4xf32(
|
||||
StridedMemRefType<Vector2D<4, 4, float>, 2> *m);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t mlirCifaceVerifyMemRefI32(
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t _mlir_ciface_verifyMemRefI32(
|
||||
UnrankedMemRefType<int32_t> *actual, UnrankedMemRefType<int32_t> *expected);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t mlirCifaceVerifyMemRefF32(
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t _mlir_ciface_verifyMemRefF32(
|
||||
UnrankedMemRefType<float> *actual, UnrankedMemRefType<float> *expected);
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t mlirCifaceVerifyMemRefF64(
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t _mlir_ciface_verifyMemRefF64(
|
||||
UnrankedMemRefType<double> *actual, UnrankedMemRefType<double> *expected);
|
||||
|
||||
extern "C" MLIR_RUNNERUTILS_EXPORT int64_t verifyMemRefI32(int64_t rank,
|
||||
|
|
|
@ -45,9 +45,8 @@ extern "C" void printClose() { fputs(" )", stdout); }
|
|||
extern "C" void printComma() { fputs(", ", stdout); }
|
||||
extern "C" void printNewline() { fputc('\n', stdout); }
|
||||
|
||||
extern "C" MLIR_CRUNNERUTILS_EXPORT void
|
||||
memrefCopy(int64_t elemSize, UnrankedMemRefType<char> *srcArg,
|
||||
UnrankedMemRefType<char> *dstArg) {
|
||||
extern "C" void memrefCopy(int64_t elemSize, UnrankedMemRefType<char> *srcArg,
|
||||
UnrankedMemRefType<char> *dstArg) {
|
||||
DynamicMemRefType<char> src(*srcArg);
|
||||
DynamicMemRefType<char> dst(*dstArg);
|
||||
|
||||
|
@ -104,7 +103,7 @@ memrefCopy(int64_t elemSize, UnrankedMemRefType<char> *srcArg,
|
|||
}
|
||||
|
||||
/// Prints GFLOPS rating.
|
||||
extern "C" void print_flops(double flops) {
|
||||
extern "C" void printFlops(double flops) {
|
||||
fprintf(stderr, "%lf GFLOPS\n", flops / 1.0E9);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,67 +18,65 @@
|
|||
|
||||
// NOLINTBEGIN(*-identifier-naming)
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_shape_i8(UnrankedMemRefType<int8_t> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefShapeI8(UnrankedMemRefType<int8_t> *M) {
|
||||
std::cout << "Unranked Memref ";
|
||||
printMemRefMetaData(std::cout, DynamicMemRefType<int8_t>(*M));
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_shape_i32(UnrankedMemRefType<int32_t> *M) {
|
||||
_mlir_ciface_printMemrefShapeI32(UnrankedMemRefType<int32_t> *M) {
|
||||
std::cout << "Unranked Memref ";
|
||||
printMemRefMetaData(std::cout, DynamicMemRefType<int32_t>(*M));
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_shape_i64(UnrankedMemRefType<int64_t> *M) {
|
||||
_mlir_ciface_printMemrefShapeI64(UnrankedMemRefType<int64_t> *M) {
|
||||
std::cout << "Unranked Memref ";
|
||||
printMemRefMetaData(std::cout, DynamicMemRefType<int64_t>(*M));
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_shape_f32(UnrankedMemRefType<float> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefShapeF32(UnrankedMemRefType<float> *M) {
|
||||
std::cout << "Unranked Memref ";
|
||||
printMemRefMetaData(std::cout, DynamicMemRefType<float>(*M));
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_shape_f64(UnrankedMemRefType<double> *M) {
|
||||
_mlir_ciface_printMemrefShapeF64(UnrankedMemRefType<double> *M) {
|
||||
std::cout << "Unranked Memref ";
|
||||
printMemRefMetaData(std::cout, DynamicMemRefType<double>(*M));
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_vector_4x4xf32(
|
||||
extern "C" void _mlir_ciface_printMemrefVector4x4xf32(
|
||||
StridedMemRefType<Vector2D<4, 4, float>, 2> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_i8(UnrankedMemRefType<int8_t> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_i32(UnrankedMemRefType<int32_t> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefI32(UnrankedMemRefType<int32_t> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_i64(UnrankedMemRefType<int64_t> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefI64(UnrankedMemRefType<int64_t> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_f32(UnrankedMemRefType<float> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefF32(UnrankedMemRefType<float> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" void _mlir_ciface_print_memref_f64(UnrankedMemRefType<double> *M) {
|
||||
extern "C" void _mlir_ciface_printMemrefF64(UnrankedMemRefType<double> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
extern "C" int64_t _mlir_ciface_nano_time() {
|
||||
extern "C" int64_t _mlir_ciface_nanoTime() {
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
auto duration = now.time_since_epoch();
|
||||
auto nanoseconds =
|
||||
|
@ -86,46 +84,41 @@ extern "C" int64_t _mlir_ciface_nano_time() {
|
|||
return nanoseconds.count();
|
||||
}
|
||||
|
||||
extern "C" void print_memref_i32(int64_t rank, void *ptr) {
|
||||
extern "C" void printMemrefI32(int64_t rank, void *ptr) {
|
||||
UnrankedMemRefType<int32_t> descriptor = {rank, ptr};
|
||||
_mlir_ciface_print_memref_i32(&descriptor);
|
||||
_mlir_ciface_printMemrefI32(&descriptor);
|
||||
}
|
||||
|
||||
extern "C" void print_memref_i64(int64_t rank, void *ptr) {
|
||||
extern "C" void printMemrefI64(int64_t rank, void *ptr) {
|
||||
UnrankedMemRefType<int64_t> descriptor = {rank, ptr};
|
||||
_mlir_ciface_print_memref_i64(&descriptor);
|
||||
_mlir_ciface_printMemrefI64(&descriptor);
|
||||
}
|
||||
|
||||
extern "C" void print_memref_f32(int64_t rank, void *ptr) {
|
||||
extern "C" void printMemrefF32(int64_t rank, void *ptr) {
|
||||
UnrankedMemRefType<float> descriptor = {rank, ptr};
|
||||
_mlir_ciface_print_memref_f32(&descriptor);
|
||||
_mlir_ciface_printMemrefF32(&descriptor);
|
||||
}
|
||||
|
||||
extern "C" void print_memref_f64(int64_t rank, void *ptr) {
|
||||
extern "C" void printMemrefF64(int64_t rank, void *ptr) {
|
||||
UnrankedMemRefType<double> descriptor = {rank, ptr};
|
||||
_mlir_ciface_print_memref_f64(&descriptor);
|
||||
_mlir_ciface_printMemrefF64(&descriptor);
|
||||
}
|
||||
|
||||
extern "C" void print_c_string(char *str) { printf("%s", str); }
|
||||
extern "C" void printCString(char *str) { printf("%s", str); }
|
||||
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_0d_f32(StridedMemRefType<float, 0> *M) {
|
||||
extern "C" void _mlir_ciface_printMemref0dF32(StridedMemRefType<float, 0> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_1d_f32(StridedMemRefType<float, 1> *M) {
|
||||
extern "C" void _mlir_ciface_printMemref1dF32(StridedMemRefType<float, 1> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_2d_f32(StridedMemRefType<float, 2> *M) {
|
||||
extern "C" void _mlir_ciface_printMemref2dF32(StridedMemRefType<float, 2> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_3d_f32(StridedMemRefType<float, 3> *M) {
|
||||
extern "C" void _mlir_ciface_printMemref3dF32(StridedMemRefType<float, 3> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
extern "C" void
|
||||
_mlir_ciface_print_memref_4d_f32(StridedMemRefType<float, 4> *M) {
|
||||
extern "C" void _mlir_ciface_printMemref4dF32(StridedMemRefType<float, 4> *M) {
|
||||
impl::printMemRef(*M);
|
||||
}
|
||||
|
||||
|
|
|
@ -423,8 +423,8 @@ func.func @main() {
|
|||
// CHECK-NEXT: %[[dC:.*]] = memref.cast %[[C]] : memref<f32> to memref<*xf32>
|
||||
%res2 = tensor.cast %res: tensor<f32> to tensor<*xf32>
|
||||
|
||||
// CHECK-NEXT: call @print_memref_f32(%[[dC]]) : (memref<*xf32>) -> ()
|
||||
call @print_memref_f32(%res2) : (tensor<*xf32>) -> ()
|
||||
// CHECK-NEXT: call @printMemrefF32(%[[dC]]) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%res2) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK-DAG: memref.dealloc %[[A]] : memref<64xf32>
|
||||
// CHECK-DAG: memref.dealloc %[[B]] : memref<64xf32>
|
||||
|
@ -433,8 +433,8 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
// CHECK: func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @print_memref_f32(tensor<*xf32>)
|
||||
// CHECK: func private @printMemrefF32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(tensor<*xf32>)
|
||||
|
||||
// -----
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: mlir-opt %s -convert-linalg-to-std | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// CHECK: func private @linalg_fill_f32_viewsxsxf32(f32, memref<?x?xf32, {{.*}}>) attributes {llvm.emit_c_interface}
|
||||
// CHECK: func private @linalg_matmul_viewsxsxf32_viewsxsxf32_viewsxsxf32(memref<?x?xf32, {{.*}}>, memref<?x?xf32, {{.*}}>, memref<?x?xf32, {{.*}}>) attributes {llvm.emit_c_interface}
|
||||
|
|
|
@ -80,7 +80,7 @@ func.func @entry() {
|
|||
|
||||
// CHECK: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
|
||||
%U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %LHS10: memref<1x10xf32>
|
||||
memref.dealloc %RHS10: memref<1x10xf32>
|
||||
|
@ -130,5 +130,5 @@ func.func @entry() {
|
|||
|
||||
func.func private @rtclock() -> f64
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -102,7 +102,7 @@ func.func @entry() {
|
|||
|
||||
// CHECK: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
|
||||
%U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %LHS10: memref<1x10xf32>
|
||||
memref.dealloc %RHS10: memref<1x10xf32>
|
||||
|
@ -152,5 +152,5 @@ func.func @entry() {
|
|||
|
||||
func.func private @rtclock() -> f64
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -83,7 +83,7 @@ func.func @entry() {
|
|||
memref.store %3, %A[%i] : memref<9xf32>
|
||||
}
|
||||
// CHECK: [0, 1, 2, 3, 4, 5, 6, 7, 8]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
scf.parallel (%i) = (%lb) to (%ub) step (%c1) {
|
||||
memref.store %c0, %A[%i] : memref<9xf32>
|
||||
|
@ -98,7 +98,7 @@ func.func @entry() {
|
|||
memref.store %3, %A[%i] : memref<9xf32>
|
||||
}
|
||||
// CHECK: [0, 0, 2, 0, 4, 0, 6, 0, 8]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
scf.parallel (%i) = (%lb) to (%ub) step (%c1) {
|
||||
memref.store %c0, %A[%i] : memref<9xf32>
|
||||
|
@ -117,7 +117,7 @@ func.func @entry() {
|
|||
memref.store %5, %A[%3] : memref<9xf32>
|
||||
}
|
||||
// CHECK: [-20, 0, 0, -17, 0, 0, -14, 0, 0]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
// 4. Check that loop with zero iterations doesn't crash at runtime.
|
||||
%lb1 = call @zero(): () -> (index)
|
||||
|
@ -132,4 +132,4 @@ func.func @entry() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -84,7 +84,7 @@ func.func @entry() {
|
|||
// CHECK-NEXT: [40, 41, 42, 43, 44, 45, 46, 47]
|
||||
// CHECK-NEXT: [48, 49, 50, 51, 52, 53, 54, 55]
|
||||
// CHECK-NEXT: [56, 57, 58, 59, 60, 61, 62, 63]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) {
|
||||
memref.store %c0, %A[%i, %j] : memref<8x8xf32>
|
||||
|
@ -109,7 +109,7 @@ func.func @entry() {
|
|||
// CHECK-NEXT: [0, 0, 0, 0, 0, 0, 0, 0]
|
||||
// CHECK-NEXT: [48, 49, 50, 51, 52, 53, 54, 55]
|
||||
// CHECK-NEXT: [0, 0, 0, 0, 0, 0, 0, 0]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) {
|
||||
memref.store %c0, %A[%i, %j] : memref<8x8xf32>
|
||||
|
@ -134,11 +134,11 @@ func.func @entry() {
|
|||
// CHECK-NEXT: [40, 0, 42, 0, 44, 0, 46, 0]
|
||||
// CHECK-NEXT: [48, 0, 50, 0, 52, 0, 54, 0]
|
||||
// CHECK-NEXT: [56, 0, 58, 0, 60, 0, 62, 0]
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %A : memref<8x8xf32>
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
func.func @matmul(%A: memref<?x?xf32>, %B: memref<?x?xf32>) -> (memref<?x?xf32>) {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -60,7 +60,7 @@ func.func @main() {
|
|||
}
|
||||
}
|
||||
%C2_ = memref.cast %C2 : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%C2_) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%C2_) : (memref<*xf32>) -> ()
|
||||
memref.dealloc %C1 : memref<?x?xf32>
|
||||
memref.dealloc %C2 : memref<?x?xf32>
|
||||
return
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
func.func @main() {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -21,11 +21,11 @@ func.func @main() {
|
|||
%B = memref.subview %A[%c1, 0][1, %c2][1, 1] : memref<?x?xf32> to memref<?xf32, offset: ?, strides: [1]>
|
||||
%C = memref.subview %A[0, %c1][%c2, 1][1, 1] : memref<?x?xf32> to memref<?xf32, offset: ?, strides: [?]>
|
||||
%A_ = memref.cast %A : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%A_) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%A_) : (memref<*xf32>) -> ()
|
||||
%B_ = memref.cast %B : memref<?xf32, offset: ?, strides: [1]> to memref<*xf32>
|
||||
call @print_memref_f32(%B_) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%B_) : (memref<*xf32>) -> ()
|
||||
%C_ = memref.cast %C : memref<?xf32, offset: ?, strides: [?]> to memref<*xf32>
|
||||
call @print_memref_f32(%C_) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%C_) : (memref<*xf32>) -> ()
|
||||
memref.dealloc %A : memref<?x?xf32>
|
||||
return
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ func.func @main() {
|
|||
%dynamic = tensor.cast %const: tensor<2x2x3x2xf32> to tensor<2x?x?x?xf32>
|
||||
%collapsed = call @collapse_dynamic_shape(%dynamic) : (tensor<2x?x?x?xf32>) -> (tensor<2x?x?xf32>)
|
||||
%unranked = tensor.cast %collapsed: tensor<2x?x?xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 3 offset = 0 sizes = [2, 6, 2] strides = [12, 2, 1] data =
|
||||
// CHECK-NEXT{LITERAL}: [[[-3.9058, 0.9072],
|
||||
|
@ -30,7 +30,7 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
||||
func.func @collapse_dynamic_shape(%arg0 : tensor<2x?x?x?xf32>) -> tensor<2x?x?xf32> {
|
||||
%0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3]]: tensor<2x?x?x?xf32> into tensor<2x?x?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns a 1-D buffer of size %s1 filled with the value %f
|
||||
func.func @alloc_1d_filled_f32(%s1 : index, %f : f32) -> memref<?xf32> {
|
||||
|
@ -39,7 +39,7 @@ func.func @main() {
|
|||
memref.store %f10, %in1D[%c3] : memref<?xf32>
|
||||
call @conv_1d(%in1D, %filter1D, %out1D) : (memref<?xf32>, memref<?xf32>, memref<?xf32>) -> ()
|
||||
%out1D_ = memref.cast %out1D : memref<?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out1D_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out1D_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter1D : memref<?xf32>
|
||||
memref.dealloc %in1D : memref<?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
|
||||
func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref<?x?x?xf32> {
|
||||
|
@ -43,7 +43,7 @@ func.func @main() {
|
|||
memref.store %f10, %in1D_nwc[%c0, %c3, %c0] : memref<?x?x?xf32>
|
||||
call @conv_1d_nwc_wcf(%in1D_nwc, %filter1D_nwc, %out1D_nwc) : (memref<?x?x?xf32>, memref<?x?x?xf32>, memref<?x?x?xf32>) -> ()
|
||||
%out1D_nwc_ = memref.cast %out1D_nwc : memref<?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out1D_nwc_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out1D_nwc_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter1D_nwc : memref<?x?x?xf32>
|
||||
memref.dealloc %in1D_nwc : memref<?x?x?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns a 2-D buffer of size (%s1, %s2) filled with the value %f
|
||||
func.func @alloc_2d_filled_f32(%s1 : index, %s2 : index, %f : f32) -> memref<?x?xf32> {
|
||||
|
@ -41,7 +41,7 @@ func.func @main() {
|
|||
memref.store %f10, %in2D[%c0, %c3] : memref<?x?xf32>
|
||||
call @conv_2d(%in2D, %filter2D, %out2D) : (memref<?x?xf32>, memref<?x?xf32>, memref<?x?xf32>) -> ()
|
||||
%out2D_ = memref.cast %out2D : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out2D_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out2D_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter2D : memref<?x?xf32>
|
||||
memref.dealloc %in2D : memref<?x?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns 4-D buffer of size (%s1, %s2, %s3, %s4) filled with the value %f
|
||||
func.func @alloc_4d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> memref<?x?x?x?xf32> {
|
||||
|
@ -43,7 +43,7 @@ func.func @main() {
|
|||
memref.store %f10, %in2D_nhwc[%c0, %c0, %c3, %c0] : memref<?x?x?x?xf32>
|
||||
call @conv_2d_nhwc_hwcf(%in2D_nhwc, %filter2D_nhwc, %out2D_nhwc) : (memref<?x?x?x?xf32>, memref<?x?x?x?xf32>, memref<?x?x?x?xf32>) -> ()
|
||||
%out2D_nhwc_ = memref.cast %out2D_nhwc : memref<?x?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out2D_nhwc_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out2D_nhwc_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter2D_nhwc : memref<?x?x?x?xf32>
|
||||
memref.dealloc %in2D_nhwc : memref<?x?x?x?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
|
||||
func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref<?x?x?xf32> {
|
||||
|
@ -41,7 +41,7 @@ func.func @main() {
|
|||
memref.store %f10, %in3D[%c0, %c0, %c3] : memref<?x?x?xf32>
|
||||
call @conv_3d(%in3D, %filter3D, %out3D) : (memref<?x?x?xf32>, memref<?x?x?xf32>, memref<?x?x?xf32>) -> ()
|
||||
%out3D_ = memref.cast %out3D : memref<?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out3D_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out3D_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter3D : memref<?x?x?xf32>
|
||||
memref.dealloc %in3D : memref<?x?x?xf32>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
// Creates and returns 5-D buffer of size (%s1, %s2, %s3, %s4, %s5) filled with the value %f
|
||||
func.func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref<?x?x?x?x?xf32> {
|
||||
|
@ -44,7 +44,7 @@ func.func @main() {
|
|||
memref.store %f10, %in3D_ndhwc[%c0, %c0, %c0, %c3, %c0] : memref<?x?x?x?x?xf32>
|
||||
call @conv_3d_ndhwc_dhwcf(%in3D_ndhwc, %filter3D_ndhwc, %out3D_ndhwc) : (memref<?x?x?x?x?xf32>, memref<?x?x?x?x?xf32>, memref<?x?x?x?x?xf32>) -> ()
|
||||
%out3D_ndhwc_ = memref.cast %out3D_ndhwc : memref<?x?x?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%out3D_ndhwc_): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%out3D_ndhwc_): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %filter3D_ndhwc : memref<?x?x?x?x?xf32>
|
||||
memref.dealloc %in3D_ndhwc : memref<?x?x?x?x?xf32>
|
||||
|
|
|
@ -13,11 +13,11 @@ func.func @main() {
|
|||
|
||||
%addf = arith.addf %a, %b : tensor<3xf32>
|
||||
%addf_unranked = tensor.cast %addf : tensor<3xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%addf_unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%addf_unranked) : (tensor<*xf32>) -> ()
|
||||
// CHECK: Unranked Memref base@ = {{.*}} rank = 1 offset = 0 sizes = [3] strides = [1] data =
|
||||
// CHECK-NEXT: [11, 22, 33]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -12,7 +12,7 @@ func.func @main() {
|
|||
%dynamic = tensor.cast %const: tensor<2x6x2xf32> to tensor<2x?x?xf32>
|
||||
%expanded = call @expand_dynamic_shape(%dynamic) : (tensor<2x?x?xf32>) -> (tensor<2x2x?x1x?xf32>)
|
||||
%unranked = tensor.cast %expanded: tensor<2x2x?x1x?xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 5 offset = 0 sizes = [2, 2, 3, 1, 2] strides = [12, 6, 2, 2, 1] data =
|
||||
|
@ -31,7 +31,7 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
||||
func.func @expand_dynamic_shape(%arg0 : tensor<2x?x?xf32>) -> tensor<2x2x?x1x?xf32> {
|
||||
%0 = tensor.expand_shape %arg0 [[0], [1, 2, 3], [4]]: tensor<2x?x?xf32> into tensor<2x2x?x1x?xf32>
|
||||
|
|
|
@ -30,7 +30,7 @@ func.func @init_and_dot(%arg0: tensor<64xf32>, %arg1: tensor<64xf32>, %arg2: ten
|
|||
}
|
||||
|
||||
// %B = tensor.cast %3 : tensor<?x2xf32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%B) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%B) : (tensor<*xf32>) -> ()
|
||||
|
||||
%4 = affine.apply #map0(%c0, %c64)[%c2]
|
||||
%5 = linalg.init_tensor [%4, 2] : tensor<?x2xf32>
|
||||
|
@ -47,10 +47,10 @@ func.func @init_and_dot(%arg0: tensor<64xf32>, %arg1: tensor<64xf32>, %arg2: ten
|
|||
}
|
||||
|
||||
// %A = tensor.cast %6 : tensor<?x2xf32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%A) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%A) : (tensor<*xf32>) -> ()
|
||||
|
||||
// %C = tensor.cast %0 : tensor<f32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%C) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%C) : (tensor<*xf32>) -> ()
|
||||
|
||||
%7 = scf.for %arg3 = %c0 to %c64 step %c2 iter_args(%arg4 = %0) -> (tensor<f32>) {
|
||||
%8 = tensor.extract_slice %arg0[%arg3] [2] [1] : tensor<64xf32> to tensor<2xf32>
|
||||
|
@ -64,11 +64,11 @@ func.func @init_and_dot(%arg0: tensor<64xf32>, %arg1: tensor<64xf32>, %arg2: ten
|
|||
%16 = linalg.dot ins(%13, %15 : tensor<2xf32>, tensor<2xf32>) outs(%arg4 : tensor<f32>) -> tensor<f32>
|
||||
|
||||
// %AA = tensor.cast %13 : tensor<2xf32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%AA) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%AA) : (tensor<*xf32>) -> ()
|
||||
// %BB = tensor.cast %15 : tensor<2xf32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%BB) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%BB) : (tensor<*xf32>) -> ()
|
||||
// %CC = tensor.cast %16 : tensor<f32> to tensor<*xf32>
|
||||
// call @print_memref_f32(%CC) : (tensor<*xf32>) -> ()
|
||||
// call @printMemrefF32(%CC) : (tensor<*xf32>) -> ()
|
||||
|
||||
scf.yield %16 : tensor<f32>
|
||||
}
|
||||
|
@ -94,9 +94,9 @@ func.func @main() {
|
|||
|
||||
// CHECK: Unranked Memref base@ = {{.*}} rank = 0 offset = 0 sizes = [] strides = [] data =
|
||||
// CHECK-NEXT: [128]
|
||||
call @print_memref_f32(%res2) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%res2) : (tensor<*xf32>) -> ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(tensor<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(tensor<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -18,7 +18,7 @@ func.func @main() {
|
|||
tensor.yield %cst : f32
|
||||
} : tensor<1x?x3xf32> to tensor<1x?x?xf32>
|
||||
%unranked = tensor.cast %out: tensor<1x?x?xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 3 offset = 0 sizes = [1, 4, 5] strides = [20, 5, 1] data =
|
||||
|
@ -30,4 +30,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -18,14 +18,14 @@ func.func @main() {
|
|||
%inserted_at_position_1 = tensor.insert_slice %insert_val into %const[1][1][1] : tensor<1xf32> into tensor<2xf32>
|
||||
|
||||
%unranked_at_position_0 = tensor.cast %inserted_at_position_0 : tensor<2xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked_at_position_0) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_at_position_0) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 0 sizes = [2] strides = [1] data =
|
||||
// CHECK-NEXT: [20, 10]
|
||||
|
||||
%unranked_at_position_1 = tensor.cast %inserted_at_position_1 : tensor<2xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked_at_position_1) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_at_position_1) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 0 sizes = [2] strides = [1] data =
|
||||
|
@ -34,4 +34,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -12,7 +12,7 @@ func.func @main() {
|
|||
%inserted = tensor.insert_slice %insert_val into %const[0][1][1] : tensor<1xf32> into tensor<2xf32>
|
||||
|
||||
%unranked = tensor.cast %inserted : tensor<2xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 0 sizes = [2] strides = [1] data =
|
||||
|
@ -21,4 +21,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -14,13 +14,13 @@ func.func @main() {
|
|||
%0 = call @foo() : () -> tensor<4xf32>
|
||||
|
||||
// Instead of relying on tensor_store which introduces aliasing, we rely on
|
||||
// the conversion of print_memref_f32(tensor<*xf32>) to
|
||||
// print_memref_f32(memref<*xf32>).
|
||||
// the conversion of printMemrefF32(tensor<*xf32>) to
|
||||
// printMemrefF32(memref<*xf32>).
|
||||
// Note that this is skipping a step and we would need at least some function
|
||||
// attribute to declare that this conversion is valid (e.g. when we statically
|
||||
// know that things will play nicely at the C ABI boundary).
|
||||
%unranked = tensor.cast %0 : tensor<4xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 0 sizes = [4] strides = [1] data =
|
||||
|
@ -33,4 +33,4 @@ func.func @main() {
|
|||
// Note that this is skipping a step and we would need at least some function
|
||||
// attribute to declare that this conversion is valid (e.g. when we statically
|
||||
// know that things will play nicely at the C ABI boundary).
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -26,7 +26,7 @@ func.func @main() {
|
|||
outs(%C: tensor<2x4xf32>) -> tensor<2x4xf32>
|
||||
|
||||
%unranked = tensor.cast %D : tensor<2x4xf32> to tensor<*xf32>
|
||||
call @print_memref_f32(%unranked) : (tensor<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (tensor<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 2 offset = 0 sizes = [2, 4] strides = [4, 1] data =
|
||||
|
@ -36,4 +36,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : tensor<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : tensor<*xf32>)
|
||||
|
|
|
@ -15,7 +15,7 @@ func.func @main() {
|
|||
/// Subview with only leading operands.
|
||||
%1 = memref.subview %0[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, offset: 6, strides: [3, 1]>
|
||||
%unranked = memref.cast %1 : memref<3x3xf32, offset: 6, strides: [3, 1]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked) : (memref<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 2 offset = 6 sizes = [3, 3] strides = [3, 1] data =
|
||||
|
@ -28,7 +28,7 @@ func.func @main() {
|
|||
/// Regular subview.
|
||||
%2 = memref.subview %0[0, 2][5, 1][1, 1]: memref<5x3xf32> to memref<5x1xf32, offset: 2, strides: [3, 1]>
|
||||
%unranked2 = memref.cast %2 : memref<5x1xf32, offset: 2, strides: [3, 1]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked2) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked2) : (memref<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 2 offset = 2 sizes = [5, 1] strides = [3, 1] data =
|
||||
|
@ -43,7 +43,7 @@ func.func @main() {
|
|||
/// Rank-reducing subview.
|
||||
%3 = memref.subview %0[0, 2][5, 1][1, 1]: memref<5x3xf32> to memref<5xf32, offset: 2, strides: [3]>
|
||||
%unranked3 = memref.cast %3 : memref<5xf32, offset: 2, strides: [3]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked3) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked3) : (memref<*xf32>) -> ()
|
||||
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 2 sizes = [5] strides = [3] data =
|
||||
|
@ -52,7 +52,7 @@ func.func @main() {
|
|||
/// Rank-reducing subview with only leading operands.
|
||||
%4 = memref.subview %0[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, offset: 3, strides: [1]>
|
||||
%unranked4 = memref.cast %4 : memref<3xf32, offset: 3, strides: [1]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked4) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked4) : (memref<*xf32>) -> ()
|
||||
// CHECK: Unranked Memref base@ = {{0x[-9a-f]*}}
|
||||
// CHECK-SAME: rank = 1 offset = 3 sizes = [3] strides = [1] data =
|
||||
// CHECK-NEXT: [3, 4, 5]
|
||||
|
@ -60,4 +60,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#map0 = affine_map<(d0, d1) -> (d1, d0)>
|
||||
#map1 = affine_map<(d0, d1) -> (d1)>
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
func.func @alloc_2d_filled_f32(%arg0: index, %arg1: index) -> memref<?x?xf32> {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -40,7 +40,7 @@ func.func @main() {
|
|||
%cst = arith.constant -4.2e+01 : f32
|
||||
%0 = call @alloc_2d_filled_f32(%c6, %c6) : (index, index) -> memref<?x?xf32>
|
||||
%converted = memref.cast %0 : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%converted): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%converted): (memref<*xf32>) -> ()
|
||||
// CHECK: Unranked{{.*}}data =
|
||||
// CHECK: [
|
||||
// CHECK-SAME: [0, 100, 200, 300, 400, 500],
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// RUN: mlir-opt %s -pass-pipeline="func.func(test-vector-to-forloop)" | FileCheck %s -check-prefix=TRANSFORM
|
||||
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
||||
func.func @alloc_1d_filled_inc_f32(%arg0: index, %arg1: f32) -> memref<?xf32> {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -50,7 +50,7 @@ func.func @main() {
|
|||
%acc = arith.addf %a, %b: vector<64xf32>
|
||||
vector.transfer_write %acc, %out[%c0]: vector<64xf32>, memref<?xf32>
|
||||
%converted = memref.cast %out : memref<?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%converted): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%converted): (memref<*xf32>) -> ()
|
||||
// CHECK: Unranked{{.*}}data =
|
||||
// CHECK: [
|
||||
// CHECK-SAME: 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27,
|
||||
|
|
|
@ -63,7 +63,7 @@ func.func @main() {
|
|||
}
|
||||
|
||||
// Print the memref after computation.
|
||||
call @print_memref_f32(%3) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%3) : (memref<*xf32>) -> ()
|
||||
// CHECK: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
// CHECK-NEXT: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
// CHECK-NEXT: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
|
@ -83,4 +83,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
|
|
@ -51,7 +51,7 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
// Print the memref after computation.
|
||||
call @print_memref_f32(%33) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%33) : (memref<*xf32>) -> ()
|
||||
// CHECK: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
// CHECK-NEXT: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
// CHECK-NEXT: [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
|
||||
|
@ -71,4 +71,4 @@ func.func @main() {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
|
|
@ -60,11 +60,11 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_i32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
// CHECK: [0, 2]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
||||
|
|
|
@ -60,11 +60,11 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_i32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
// CHECK: [16, 11]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
||||
|
|
|
@ -60,11 +60,11 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_i32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
// CHECK: [0, 2]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ func.func @main() {
|
|||
memref.store %sum, %dst[%tz, %ty, %tx] : memref<?x?x?xf32>
|
||||
gpu.terminator
|
||||
}
|
||||
call @print_memref_f32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -60,11 +60,11 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_i32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
// CHECK: [31, 15]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ func.func @main() {
|
|||
memref.store %res, %dst[%tx] : memref<?xf32>
|
||||
gpu.terminator
|
||||
}
|
||||
call @print_memref_f32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
|
|
@ -60,11 +60,11 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_i32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> ()
|
||||
// CHECK: [31, 1]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ func.func @main() {
|
|||
|
||||
async.await %t3 : !async.token
|
||||
// CHECK: [84, 84]
|
||||
call @print_memref_i32(%h0_unranked) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%h0_unranked) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(memref<*xi32>)
|
||||
func.func private @printMemrefI32(memref<*xi32>)
|
||||
|
|
|
@ -31,13 +31,13 @@ func.func @main() {
|
|||
%22 = memref.cast %arg0 : memref<5xf32> to memref<?xf32>
|
||||
%23 = memref.cast %22 : memref<?xf32> to memref<*xf32>
|
||||
gpu.host_register %23 : memref<*xf32>
|
||||
call @print_memref_f32(%23) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%23) : (memref<*xf32>) -> ()
|
||||
%24 = arith.constant 1.0 : f32
|
||||
call @other_func(%24, %22) : (f32, memref<?xf32>) -> ()
|
||||
call @print_memref_f32(%23) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%23) : (memref<*xf32>) -> ()
|
||||
%val1 = vector.transfer_read %arg0[%c0], %v0: memref<5xf32>, vector<2xf32>
|
||||
vector.print %val1: vector<2xf32>
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -65,13 +65,13 @@ func.func @main() {
|
|||
gpu.terminator
|
||||
}
|
||||
|
||||
call @print_memref_f32(%cast_sum) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast_sum) : (memref<*xf32>) -> ()
|
||||
// CHECK: [31, 39]
|
||||
|
||||
call @print_memref_f32(%cast_mul) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast_mul) : (memref<*xf32>) -> ()
|
||||
// CHECK: [0, 27720]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
|
|
|
@ -32,8 +32,8 @@ func.func @main() {
|
|||
memref.store %value, %dst[%tx] : memref<?xf32>
|
||||
gpu.terminator
|
||||
}
|
||||
call @print_memref_f32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -29,8 +29,8 @@ func.func @main() {
|
|||
memref.store %t0, %dst[%tx] : memref<?xi32>
|
||||
gpu.terminator
|
||||
}
|
||||
call @print_memref_i32(%cast_dst) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_dst) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i32(%memref : memref<*xi32>)
|
||||
func.func private @printMemrefI32(%memref : memref<*xi32>)
|
||||
|
|
|
@ -28,13 +28,13 @@ func.func @main() {
|
|||
%cast = memref.cast %22 : memref<?xf32> to memref<*xf32>
|
||||
gpu.host_register %cast : memref<*xf32>
|
||||
%23 = memref.cast %22 : memref<?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%23) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%23) : (memref<*xf32>) -> ()
|
||||
%24 = arith.constant 1.0 : f32
|
||||
%25 = call @mgpuMemGetDeviceMemRef1dFloat(%22) : (memref<?xf32>) -> (memref<?xf32>)
|
||||
call @other_func(%24, %25) : (f32, memref<?xf32>) -> ()
|
||||
call @print_memref_f32(%23) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%23) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -30,9 +30,9 @@ func.func @main() {
|
|||
memref.store %t0, %dst_device[%tx] : memref<?xi32>
|
||||
gpu.terminator
|
||||
}
|
||||
call @print_memref_i32(%cast_dst) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%cast_dst) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @mgpuMemGetDeviceMemRef1dInt32(%ptr : memref<?xi32>) -> (memref<?xi32>)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @printMemrefI32(%ptr : memref<*xi32>)
|
||||
|
|
|
@ -51,9 +51,9 @@ func.func @main() {
|
|||
%11 = call @mgpuMemGetDeviceMemRef1dFloat(%5) : (memref<?xf32>) -> (memref<?xf32>)
|
||||
|
||||
call @vecadd(%9, %10, %11) : (memref<?xf32>, memref<?xf32>, memref<?xf32>) -> ()
|
||||
call @print_memref_f32(%8) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%8) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -81,13 +81,13 @@ func.func @main() {
|
|||
|
||||
// CHECK: [1.23, 2.46, 2.46, 1.23]
|
||||
call @vectransferx2(%24, %26) : (memref<?xf32>, memref<?xf32>) -> ()
|
||||
call @print_memref_f32(%cast1) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast1) : (memref<*xf32>) -> ()
|
||||
|
||||
// CHECK: [2.46, 2.46, 2.46, 2.46]
|
||||
call @vectransferx4(%24, %26) : (memref<?xf32>, memref<?xf32>) -> ()
|
||||
call @print_memref_f32(%cast1) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%cast1) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref<?xf32>) -> (memref<?xf32>)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
|
|
|
@ -51,7 +51,7 @@ func.func @main() {
|
|||
// CHECK: Unranked Memref
|
||||
// CHECK-SAME: rank = 0 offset = 0 sizes = [] strides = []
|
||||
// CHECK-NEXT: [0.25]
|
||||
call @print_memref_f32(%7): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%7): (memref<*xf32>) -> ()
|
||||
|
||||
// ------------------------------------------------------------------------ //
|
||||
// Memref passed as async.execute operand.
|
||||
|
@ -67,12 +67,12 @@ func.func @main() {
|
|||
// CHECK: Unranked Memref
|
||||
// CHECK-SAME: rank = 0 offset = 0 sizes = [] strides = []
|
||||
// CHECK-NEXT: [0.5]
|
||||
call @print_memref_f32(%7): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%7): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %6 : memref<f32>
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @printMemrefF32(memref<*xf32>)
|
||||
attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -23,20 +23,20 @@ func.func @main() {
|
|||
|
||||
// CHECK: [0, 0, 0, 0]
|
||||
%U = memref.cast %A : memref<4xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
// CHECK: Current thread id: [[MAIN:.*]]
|
||||
// CHECK: [1, 0, 0, 0]
|
||||
memref.store %c1, %A[%i0]: memref<4xf32>
|
||||
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
%outer = async.execute {
|
||||
// CHECK: Current thread id: [[THREAD0:.*]]
|
||||
// CHECK: [1, 2, 0, 0]
|
||||
memref.store %c2, %A[%i1]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
// No op async region to create a token for testing async dependency.
|
||||
%noop = async.execute {
|
||||
|
@ -50,7 +50,7 @@ func.func @main() {
|
|||
// CHECK: [1, 2, 3, 0]
|
||||
memref.store %c3, %A[%i2]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
async.yield
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ func.func @main() {
|
|||
// CHECK: [1, 2, 3, 4]
|
||||
memref.store %c4, %A[%i3]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
async.yield
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func.func @main() {
|
|||
// CHECK: Current thread id: [[MAIN]]
|
||||
// CHECK: [1, 2, 3, 4]
|
||||
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %A : memref<4xf32>
|
||||
|
||||
|
@ -78,4 +78,4 @@ func.func @main() {
|
|||
|
||||
func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -22,7 +22,7 @@ func.func @main() -> () {
|
|||
memref.store %val_f32, %input[%i, %j] : memref<2x3xf32>
|
||||
}
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
|
||||
// CHECK-NEXT: [0, 1, 2]
|
||||
// CHECK-NEXT: [3, 4, 5]
|
||||
|
@ -30,7 +30,7 @@ func.func @main() -> () {
|
|||
%copy = memref.alloc() : memref<2x3xf32>
|
||||
memref.copy %input, %copy : memref<2x3xf32> to memref<2x3xf32>
|
||||
%unranked_copy = memref.cast %copy : memref<2x3xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_copy) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_copy) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
|
||||
// CHECK-NEXT: [0, 1, 2]
|
||||
// CHECK-NEXT: [3, 4, 5]
|
||||
|
@ -40,7 +40,7 @@ func.func @main() -> () {
|
|||
: memref<3x2xf32> to memref<2x3xf32, offset: 0, strides: [1, 2]>
|
||||
memref.copy %input, %copy_two_casted : memref<2x3xf32> to memref<2x3xf32, offset: 0, strides: [1, 2]>
|
||||
%unranked_copy_two = memref.cast %copy_two : memref<3x2xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_copy_two) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_copy_two) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1]
|
||||
// CHECK-NEXT: [0, 3]
|
||||
// CHECK-NEXT: [1, 4]
|
||||
|
@ -62,7 +62,7 @@ func.func @main() -> () {
|
|||
%scalar_copy = memref.alloc() : memref<f32>
|
||||
memref.copy %scalar, %scalar_copy : memref<f32> to memref<f32>
|
||||
%unranked_scalar_copy = memref.cast %scalar_copy : memref<f32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_scalar_copy) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_scalar_copy) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 0 offset = 0 sizes = [] strides = []
|
||||
// CHECK-NEXT [42]
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefI32(memref<*xi32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printNewline() -> ()
|
||||
|
||||
memref.global "private" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]>
|
||||
|
@ -13,7 +13,7 @@ func.func @test1DMemref() {
|
|||
// CHECK: sizes = [4]
|
||||
// CHECK: strides = [1]
|
||||
// CHECK: [0, 1, 2, 3]
|
||||
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U) : (memref<*xf32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
|
||||
// Overwrite some of the elements.
|
||||
|
@ -28,7 +28,7 @@ func.func @test1DMemref() {
|
|||
// CHECK: sizes = [4]
|
||||
// CHECK: strides = [1]
|
||||
// CHECK: [4, 1, 5, 3]
|
||||
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U) : (memref<*xf32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func.func @testConstantMemref() {
|
|||
// CHECK: [0, 1]
|
||||
// CHECK: [2, 3]
|
||||
// CHECK: [4, 5]
|
||||
call @print_memref_i32(%U) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%U) : (memref<*xi32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func.func @test2DMemref() {
|
|||
// CHECK: [2, 3]
|
||||
// CHECK: [4, 5]
|
||||
// CHECK: [6, 7]
|
||||
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U) : (memref<*xf32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
|
||||
// Overwrite the 1.0 (at index [0, 1]) with 10.0
|
||||
|
@ -77,7 +77,7 @@ func.func @test2DMemref() {
|
|||
// CHECK: [2, 3]
|
||||
// CHECK: [4, 5]
|
||||
// CHECK: [6, 7]
|
||||
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U) : (memref<*xf32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ func.func @testScalarMemref() {
|
|||
// CHECK: sizes = []
|
||||
// CHECK: strides = []
|
||||
// CHECK: [11]
|
||||
call @print_memref_i32(%U) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%U) : (memref<*xi32>) -> ()
|
||||
call @printNewline() : () -> ()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -21,7 +21,7 @@ func.func @main() -> () {
|
|||
memref.store %val_f32, %input[%i, %j] : memref<2x3xf32>
|
||||
}
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
|
||||
// CHECK-NEXT: [0, 1, 2]
|
||||
// CHECK-NEXT: [3, 4, 5]
|
||||
|
@ -42,7 +42,7 @@ func.func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
|||
|
||||
%unranked_output = memref.cast %output
|
||||
: memref<6x1xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [6, 1] strides = [1, 1] data =
|
||||
// CHECK-NEXT: [0],
|
||||
// CHECK-NEXT: [1],
|
||||
|
@ -63,7 +63,7 @@ func.func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
|||
|
||||
%unranked_output = memref.cast %output
|
||||
: memref<?x?xf32, offset: ?, strides: [?, ?]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [1, 6] strides = [6, 1] data =
|
||||
// CHECK-NEXT: [0, 1, 2, 3, 4, 5]
|
||||
return
|
||||
|
@ -77,7 +77,7 @@ func.func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
|||
|
||||
%unranked_output = memref.cast %output
|
||||
: memref<6x1xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [6, 1] strides = [1, 1] data =
|
||||
// CHECK-NEXT: [0],
|
||||
// CHECK-NEXT: [1],
|
||||
|
@ -99,7 +99,7 @@ func.func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
|||
|
||||
%unranked_output = memref.cast %output
|
||||
: memref<?x?xf32, offset: ?, strides: [?, ?]> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [1, 6] strides = [6, 1] data =
|
||||
// CHECK-NEXT: [0, 1, 2, 3, 4, 5]
|
||||
return
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// RUN: | FileCheck %s
|
||||
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -22,7 +22,7 @@ func.func @main() -> () {
|
|||
memref.store %val_f32, %input[%i, %j] : memref<2x3xf32>
|
||||
}
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
|
||||
// CHECK-NEXT: [0, 1, 2]
|
||||
// CHECK-NEXT: [3, 4, 5]
|
||||
|
@ -54,7 +54,7 @@ func.func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
|
|||
: (memref<2x3xf32>, memref<2xindex>) -> memref<?x?xf32>
|
||||
|
||||
%unranked_output = memref.cast %output : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
|
||||
// CHECK: [0, 1],
|
||||
// CHECK: [2, 3],
|
||||
|
@ -69,7 +69,7 @@ func.func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
|
|||
: (memref<2x3xf32>, memref<2xindex>) -> memref<?x?xf32>
|
||||
|
||||
%unranked_output = memref.cast %output : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
|
||||
// CHECK: [0, 1],
|
||||
// CHECK: [2, 3],
|
||||
|
@ -83,7 +83,7 @@ func.func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
|
|||
%output = memref.reshape %input(%dyn_size_shape)
|
||||
: (memref<2x3xf32>, memref<?xindex>) -> memref<*xf32>
|
||||
|
||||
call @print_memref_f32(%output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
|
||||
// CHECK: [0, 1],
|
||||
// CHECK: [2, 3],
|
||||
|
@ -98,7 +98,7 @@ func.func @reshape_unranked_memref_to_unranked(%input : memref<2x3xf32>,
|
|||
%output = memref.reshape %input(%dyn_size_shape)
|
||||
: (memref<2x3xf32>, memref<?xindex>) -> memref<*xf32>
|
||||
|
||||
call @print_memref_f32(%output) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%output) : (memref<*xf32>) -> ()
|
||||
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
|
||||
// CHECK: [0, 1],
|
||||
// CHECK: [2, 3],
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
|
||||
llvm.mlir.global internal constant @str_global("String to print\0A")
|
||||
llvm.func @print_c_string(!llvm.ptr<i8>)
|
||||
llvm.func @printCString(!llvm.ptr<i8>)
|
||||
|
||||
func.func @main() {
|
||||
%0 = llvm.mlir.addressof @str_global : !llvm.ptr<array<16 x i8>>
|
||||
%1 = llvm.mlir.constant(0 : index) : i64
|
||||
%2 = llvm.getelementptr %0[%1, %1]
|
||||
: (!llvm.ptr<array<16 x i8>>, i64, i64) -> !llvm.ptr<i8>
|
||||
llvm.call @print_c_string(%2) : (!llvm.ptr<i8>) -> ()
|
||||
llvm.call @printCString(%2) : (!llvm.ptr<i8>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func.func @main() {
|
|||
%num_flops_i = arith.index_cast %num_flops : index to i16
|
||||
%num_flops_f = arith.sitofp %num_flops_i : i16 to f64
|
||||
%flops = arith.divf %num_flops_f, %t : f64
|
||||
call @print_flops(%flops) : (f64) -> ()
|
||||
call @printFlops(%flops) : (f64) -> ()
|
||||
|
||||
memref.dealloc %A : memref<16x16xf32>
|
||||
memref.dealloc %B : memref<16x16xf32>
|
||||
|
@ -72,5 +72,5 @@ func.func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_flops(f64)
|
||||
func.func private @printFlops(f64)
|
||||
func.func private @rtclock() -> f64
|
||||
|
|
|
@ -44,25 +44,25 @@ func.func @main() -> () {
|
|||
%V = memref.cast %A : memref<10x3xf32, 0> to memref<?x?xf32>
|
||||
linalg.fill ins(%f10 : f32) outs(%V : memref<?x?xf32, 0>)
|
||||
%U = memref.cast %A : memref<10x3xf32, 0> to memref<*xf32>
|
||||
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U) : (memref<*xf32>) -> ()
|
||||
|
||||
%V2 = memref.cast %U : memref<*xf32> to memref<?x?xf32>
|
||||
linalg.fill ins(%f5 : f32) outs(%V2 : memref<?x?xf32, 0>)
|
||||
%U2 = memref.cast %V2 : memref<?x?xf32, 0> to memref<*xf32>
|
||||
call @print_memref_f32(%U2) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U2) : (memref<*xf32>) -> ()
|
||||
|
||||
%V3 = memref.cast %V2 : memref<?x?xf32> to memref<*xf32>
|
||||
%V4 = memref.cast %V3 : memref<*xf32> to memref<?x?xf32>
|
||||
linalg.fill ins(%f2 : f32) outs(%V4 : memref<?x?xf32, 0>)
|
||||
%U3 = memref.cast %V2 : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U3) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U3) : (memref<*xf32>) -> ()
|
||||
|
||||
// 122 is ASCII for 'z'.
|
||||
%i8_z = arith.constant 122 : i8
|
||||
%I8 = memref.alloc() : memref<i8>
|
||||
memref.store %i8_z, %I8[]: memref<i8>
|
||||
%U4 = memref.cast %I8 : memref<i8> to memref<*xi8>
|
||||
call @print_memref_i8(%U4) : (memref<*xi8>) -> ()
|
||||
call @printMemrefI8(%U4) : (memref<*xi8>) -> ()
|
||||
|
||||
memref.dealloc %U4 : memref<*xi8>
|
||||
memref.dealloc %A : memref<10x3xf32, 0>
|
||||
|
@ -73,16 +73,16 @@ func.func @main() -> () {
|
|||
return
|
||||
}
|
||||
|
||||
func.func private @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefI8(memref<*xi8>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func.func @return_two_var_memref_caller() {
|
||||
%0 = memref.alloca() : memref<4x3xf32>
|
||||
%c0f32 = arith.constant 1.0 : f32
|
||||
linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>)
|
||||
%1:2 = call @return_two_var_memref(%0) : (memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>)
|
||||
call @print_memref_f32(%1#0) : (memref<*xf32>) -> ()
|
||||
call @print_memref_f32(%1#1) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%1#0) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%1#1) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ func.func @return_var_memref_caller() {
|
|||
%c0f32 = arith.constant 1.0 : f32
|
||||
linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>)
|
||||
%1 = call @return_var_memref(%0) : (memref<4x3xf32>) -> memref<*xf32>
|
||||
call @print_memref_f32(%1) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%1) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ func.func @print_0d() {
|
|||
%A = memref.alloc() : memref<f32>
|
||||
memref.store %f, %A[]: memref<f32>
|
||||
%U = memref.cast %A : memref<f32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
memref.dealloc %A : memref<f32>
|
||||
return
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func.func @print_1d() {
|
|||
%B = memref.cast %A: memref<16xf32> to memref<?xf32>
|
||||
linalg.fill ins(%f : f32) outs(%B : memref<?xf32>)
|
||||
%U = memref.cast %B : memref<?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
memref.dealloc %A : memref<16xf32>
|
||||
return
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func.func @print_3d() {
|
|||
%c2 = arith.constant 2 : index
|
||||
memref.store %f4, %B[%c2, %c2, %c2]: memref<?x?x?xf32>
|
||||
%U = memref.cast %B : memref<?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
memref.dealloc %A : memref<3x4x5xf32>
|
||||
return
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func.func @print_3d() {
|
|||
// PRINT-3D-NEXT: 2, 2, 4, 2, 2
|
||||
// PRINT-3D-NEXT: 2, 2, 2, 2, 2
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
!vector_type_C = type vector<4x4xf32>
|
||||
!matrix_type_CC = type memref<1x1x!vector_type_C>
|
||||
|
@ -61,7 +61,7 @@ func.func @vector_splat_2d() {
|
|||
memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC
|
||||
|
||||
%CC = memref.cast %C: !matrix_type_CC to memref<?x?x!vector_type_C>
|
||||
call @print_memref_vector_4x4xf32(%CC): (memref<?x?x!vector_type_C>) -> ()
|
||||
call @printMemrefVector4x4xf32(%CC): (memref<?x?x!vector_type_C>) -> ()
|
||||
|
||||
memref.dealloc %C : !matrix_type_CC
|
||||
return
|
||||
|
@ -70,4 +70,4 @@ func.func @vector_splat_2d() {
|
|||
// PRINT-VECTOR-SPLAT-2D: Memref base@ = {{.*}} rank = 2 offset = 0 sizes = [1, 1] strides = [1, 1] data =
|
||||
// PRINT-VECTOR-SPLAT-2D-NEXT: [((10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10))]
|
||||
|
||||
func.func private @print_memref_vector_4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefVector4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -23,16 +23,16 @@ func.func @main() {
|
|||
linalg.fill ins(%c0 : f32) outs(%A : memref<4xf32>)
|
||||
|
||||
%U = memref.cast %A : memref<4xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.store %c1, %A[%i0]: memref<4xf32>
|
||||
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
%outer = async.execute {
|
||||
memref.store %c2, %A[%i1]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
// No op async region to create a token for testing async dependency.
|
||||
%noop = async.execute {
|
||||
|
@ -43,7 +43,7 @@ func.func @main() {
|
|||
%inner = async.execute [%noop] {
|
||||
memref.store %c3, %A[%i2]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
async.yield
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ func.func @main() {
|
|||
|
||||
memref.store %c4, %A[%i3]: memref<4xf32>
|
||||
func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
func.call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
func.call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
async.yield
|
||||
}
|
||||
async.await %outer : !async.token
|
||||
|
||||
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
|
||||
call @print_memref_f32(%U): (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%U): (memref<*xf32>) -> ()
|
||||
|
||||
memref.dealloc %A : memref<4xf32>
|
||||
|
||||
|
@ -67,4 +67,4 @@ func.func @main() {
|
|||
|
||||
func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
|
|
@ -58,10 +58,10 @@ module attributes {
|
|||
blocks in (%one, %one, %one) threads in (%one, %one, %one)
|
||||
args(%input : memref<6xi32>, %output : memref<6xi32>)
|
||||
%result = memref.cast %output : memref<6xi32> to memref<*xi32>
|
||||
call @print_memref_i32(%result) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%result) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
func.func private @fillI32Buffer(%arg0 : memref<?xi32>, %arg1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @printMemrefI32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
|
|
@ -51,11 +51,11 @@ module attributes {
|
|||
blocks in (%one, %one, %one) threads in (%one, %one, %one)
|
||||
args(%input1 : memref<3xf32>, %input2 : memref<3x3xf32>, %output : memref<3x3x3xf32>)
|
||||
%result = memref.cast %output : memref<3x3x3xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%result) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%result) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillF32Buffer1D(%arg0 : memref<?xf32>, %arg1 : f32)
|
||||
func.func private @fillF32Buffer2D(%arg0 : memref<?x?xf32>, %arg1 : f32)
|
||||
func.func private @fillF32Buffer3D(%arg0 : memref<?x?x?xf32>, %arg1 : f32)
|
||||
func.func private @print_memref_f32(%arg0 : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%arg0 : memref<*xf32>)
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ module attributes {
|
|||
blocks in (%cst8, %cst1, %cst1) threads in (%cst1, %cst1, %cst1)
|
||||
args(%arg0 : memref<8xf32>, %arg1 : memref<8xf32>, %arg2 : memref<8xf32>)
|
||||
%arg6 = memref.cast %arg5 : memref<?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,12 +40,12 @@ module attributes {
|
|||
blocks in (%cst8, %cst8, %cst8) threads in (%cst1, %cst1, %cst1)
|
||||
args(%arg0 : memref<8xi32>, %arg1 : memref<8x8xi32>, %arg2 : memref<8x8x8xi32>)
|
||||
%arg6 = memref.cast %arg5 : memref<?x?x?xi32> to memref<*xi32>
|
||||
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%arg6) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
|
||||
func.func private @fillResource2DInt(%0 : memref<?x?xi32>, %1 : i32)
|
||||
func.func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @printMemrefI32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ module attributes {
|
|||
blocks in (%cst8, %cst8, %cst8) threads in (%cst1, %cst1, %cst1)
|
||||
args(%arg0 : memref<8xi8>, %arg1 : memref<8x8xi8>, %arg2 : memref<8x8x8xi32>)
|
||||
%arg6 = memref.cast %arg5 : memref<?x?x?xi32> to memref<*xi32>
|
||||
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
|
||||
call @printMemrefI32(%arg6) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillResource1DInt8(%0 : memref<?xi8>, %1 : i8)
|
||||
func.func private @fillResource2DInt8(%0 : memref<?x?xi8>, %1 : i8)
|
||||
func.func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @printMemrefI32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ module attributes {
|
|||
blocks in (%cst4, %cst4, %cst1) threads in(%cst1, %cst1, %cst1)
|
||||
args(%arg0 : memref<4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<4x4xf32>)
|
||||
%arg6 = memref.cast %arg5 : memref<?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ module attributes {
|
|||
blocks in (%cst8, %cst4, %cst4) threads in (%cst1, %cst1, %cst1)
|
||||
args(%arg0 : memref<8x4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<8x4x4xf32>)
|
||||
%arg6 = memref.cast %arg5 : memref<?x?x?xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func.func private @fillResource3DFloat(%0 : memref<?x?x?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
|
|
@ -51,6 +51,6 @@ module attributes {
|
|||
return
|
||||
}
|
||||
func.func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @printMemrefF32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
|
|
@ -335,10 +335,10 @@ def testSharedLibLoad():
|
|||
%cst42 = arith.constant 42.0 : f32
|
||||
memref.store %cst42, %arg0[%c0] : memref<1xf32>
|
||||
%u_memref = memref.cast %arg0 : memref<1xf32> to memref<*xf32>
|
||||
call @print_memref_f32(%u_memref) : (memref<*xf32>) -> ()
|
||||
call @printMemrefF32(%u_memref) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
} """)
|
||||
arg0 = np.array([0.0]).astype(np.float32)
|
||||
|
||||
|
@ -367,16 +367,16 @@ def testNanoTime():
|
|||
module = Module.parse("""
|
||||
module {
|
||||
func.func @main() attributes { llvm.emit_c_interface } {
|
||||
%now = call @nano_time() : () -> i64
|
||||
%now = call @nanoTime() : () -> i64
|
||||
%memref = memref.alloca() : memref<1xi64>
|
||||
%c0 = arith.constant 0 : index
|
||||
memref.store %now, %memref[%c0] : memref<1xi64>
|
||||
%u_memref = memref.cast %memref : memref<1xi64> to memref<*xi64>
|
||||
call @print_memref_i64(%u_memref) : (memref<*xi64>) -> ()
|
||||
call @printMemrefI64(%u_memref) : (memref<*xi64>) -> ()
|
||||
return
|
||||
}
|
||||
func.func private @nano_time() -> i64 attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_i64(memref<*xi64>) attributes { llvm.emit_c_interface }
|
||||
func.func private @nanoTime() -> i64 attributes { llvm.emit_c_interface }
|
||||
func.func private @printMemrefI64(memref<*xi64>) attributes { llvm.emit_c_interface }
|
||||
}""")
|
||||
|
||||
execution_engine = ExecutionEngine(
|
||||
|
|
Loading…
Reference in New Issue