1 //===- RunnerUtils.cpp - Utils for MLIR exec on targets with a C++ runtime ===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file implements basic functions to debug structured MLIR types at 10 // runtime. Entities in this file may not be compatible with targets without a 11 // C++ runtime. These may be progressively migrated to CRunnerUtils.cpp over 12 // time. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #include "mlir/ExecutionEngine/RunnerUtils.h" 17 18 extern "C" void _mlir_ciface_print_memref_vector_4x4xf32( 19 StridedMemRefType<Vector2D<4, 4, float>, 2> *M) { 20 impl::printMemRef(*M); 21 } 22 23 extern "C" void _mlir_ciface_print_memref_i8(UnrankedMemRefType<int8_t> *M) { 24 impl::printMemRef(*M); 25 } 26 27 extern "C" void _mlir_ciface_print_memref_i32(UnrankedMemRefType<int32_t> *M) { 28 impl::printMemRef(*M); 29 } 30 31 extern "C" void _mlir_ciface_print_memref_i64(UnrankedMemRefType<int64_t> *M) { 32 impl::printMemRef(*M); 33 } 34 35 extern "C" void _mlir_ciface_print_memref_f32(UnrankedMemRefType<float> *M) { 36 impl::printMemRef(*M); 37 } 38 39 extern "C" void _mlir_ciface_print_memref_f64(UnrankedMemRefType<double> *M) { 40 impl::printMemRef(*M); 41 } 42 43 extern "C" void print_memref_i32(int64_t rank, void *ptr) { 44 UnrankedMemRefType<int32_t> descriptor = {rank, ptr}; 45 _mlir_ciface_print_memref_i32(&descriptor); 46 } 47 48 extern "C" void print_memref_i64(int64_t rank, void *ptr) { 49 UnrankedMemRefType<int64_t> descriptor = {rank, ptr}; 50 _mlir_ciface_print_memref_i64(&descriptor); 51 } 52 53 extern "C" void print_memref_f32(int64_t rank, void *ptr) { 54 UnrankedMemRefType<float> descriptor = {rank, ptr}; 55 _mlir_ciface_print_memref_f32(&descriptor); 56 } 57 58 extern "C" void print_memref_f64(int64_t rank, void *ptr) { 59 UnrankedMemRefType<double> descriptor = {rank, ptr}; 60 _mlir_ciface_print_memref_f64(&descriptor); 61 } 62 63 extern "C" void 64 _mlir_ciface_print_memref_0d_f32(StridedMemRefType<float, 0> *M) { 65 impl::printMemRef(*M); 66 } 67 extern "C" void 68 _mlir_ciface_print_memref_1d_f32(StridedMemRefType<float, 1> *M) { 69 impl::printMemRef(*M); 70 } 71 extern "C" void 72 _mlir_ciface_print_memref_2d_f32(StridedMemRefType<float, 2> *M) { 73 impl::printMemRef(*M); 74 } 75 extern "C" void 76 _mlir_ciface_print_memref_3d_f32(StridedMemRefType<float, 3> *M) { 77 impl::printMemRef(*M); 78 } 79 extern "C" void 80 _mlir_ciface_print_memref_4d_f32(StridedMemRefType<float, 4> *M) { 81 impl::printMemRef(*M); 82 } 83