LLVM 22.0.0git
TensorSpec.cpp File Reference
#include "llvm/ADT/STLExtras.h"
#include "llvm/Config/config.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/TensorSpec.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <cassert>
#include <numeric>

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Macros

#define TFUTILS_GETDATATYPE_IMPL(T, E)
#define TFUTILS_GETNAME_IMPL(T, _)
#define PARSE_TYPE(T, E)
#define _IMR_DBG_PRINTER(T, N)

Functions

StringRef llvm::toString (TensorType TT)
LLVM_ABI std::optional< TensorSpecllvm::getTensorSpecFromJSON (LLVMContext &Ctx, const json::Value &Value)
 Construct a TensorSpec from a JSON dictionary of the form: { "name": <string>, "port": <int>, "type": <string.
LLVM_ABI std::string llvm::tensorValueToString (const char *Buffer, const TensorSpec &Spec)
 For debugging.

Variables

static std::array< std::string, static_cast< size_t >(TensorType::Total)> llvm::TensorTypeNames

Macro Definition Documentation

◆ _IMR_DBG_PRINTER

#define _IMR_DBG_PRINTER ( T,
N )
Value:
case TensorType::N: { \
const T *TypedBuff = reinterpret_cast<const T *>(Buffer); \
auto R = llvm::make_range(TypedBuff, TypedBuff + Spec.getElementCount()); \
return llvm::join( \
llvm::map_range(R, [](T V) { return std::to_string(V); }), ","); \
}
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto map_range(ContainerTy &&C, FuncTy F)
Definition STLExtras.h:366
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.

Referenced by llvm::tensorValueToString().

◆ PARSE_TYPE

#define PARSE_TYPE ( T,
E )
Value:
if (TensorType == #T) \
return TensorSpec::createSpec<T>(TensorName, TensorShape, TensorPort);
static TensorSpec createSpec(const std::string &Name, const std::vector< int64_t > &Shape, int Port=0)
Definition TensorSpec.h:66
TensorType
Definition TensorSpec.h:55

Referenced by llvm::getTensorSpecFromJSON().

◆ TFUTILS_GETDATATYPE_IMPL

#define TFUTILS_GETDATATYPE_IMPL ( T,
E )
Value:
template <> TensorType TensorSpec::getDataType<T>() { return TensorType::E; }

Definition at line 32 of file TensorSpec.cpp.

◆ TFUTILS_GETNAME_IMPL

#define TFUTILS_GETNAME_IMPL ( T,
_ )
Value:
#T,