llvm-capstone/flang/runtime/matmul.h
peter klausler 5e1421b22f [flang] Implement MATMUL in the runtime
Define an API for the transformational intrinsic function MATMUL,
implement it, and add some basic unit tests.  The large number of
possible argument type combinations are covered by a set of
generalized templates that are instantiated for each valid
pair of possible argument types.

Places where BLAS-2/3 routines could be called for acceleration
are marked with TODOs.  Handling for other special cases (e.g.,
known-shape 3x3 matrices and vectors) are deferred.

Some minor tweaks were made to the recent related implementation
of DOT_PRODUCT to reflect lessons learned.

Differential Revision: https://reviews.llvm.org/D102652
2021-05-18 10:59:52 -07:00

30 lines
1.2 KiB
C++

//===-- runtime/matmul.h ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// API for the transformational intrinsic function MATMUL.
#ifndef FORTRAN_RUNTIME_MATMUL_H_
#define FORTRAN_RUNTIME_MATMUL_H_
#include "entry-names.h"
namespace Fortran::runtime {
class Descriptor;
extern "C" {
// The most general MATMUL. All type and shape information is taken from the
// arguments' descriptors, and the result is dynamically allocated.
void RTNAME(Matmul)(Descriptor &, const Descriptor &, const Descriptor &,
const char *sourceFile = nullptr, int line = 0);
// A non-allocating variant; the result's descriptor must be established
// and have a valid base address.
void RTNAME(MatmulDirect)(const Descriptor &, const Descriptor &,
const Descriptor &, const char *sourceFile = nullptr, int line = 0);
} // extern "C"
} // namespace Fortran::runtime
#endif // FORTRAN_RUNTIME_MATMUL_H_