LLVM 20.0.0git
Namespaces | Macros | Functions | Variables
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)    template <> TensorType TensorSpec::getDataType<T>() { return TensorType::E; }
 
#define TFUTILS_GETNAME_IMPL(T, _)   #T,
 
#define PARSE_TYPE(T, E)
 
#define _IMR_DBG_PRINTER(T, N)
 

Functions

StringRef llvm::toString (TensorType TT)
 
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.
 
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:377

◆ PARSE_TYPE

#define PARSE_TYPE (   T,
  E 
)
Value:
if (TensorType == #T) \
return TensorSpec::createSpec<T>(TensorName, TensorShape, TensorPort);
TensorType
Definition: TensorSpec.h:54

◆ TFUTILS_GETDATATYPE_IMPL

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

Definition at line 32 of file TensorSpec.cpp.

◆ TFUTILS_GETNAME_IMPL

#define TFUTILS_GETNAME_IMPL (   T,
  _ 
)    #T,