MLIR  20.0.0git
Macros | Functions
VectorToSPIRV.cpp File Reference
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallVectorExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include <cassert>
#include <cstdint>
#include <numeric>

Go to the source code of this file.

Macros

#define INT_AND_FLOAT_CASE(kind, iop, fop)
 
#define INT_OR_FLOAT_CASE(kind, fop)
 
#define INT_OR_FLOAT_CASE(kind, fop)
 
#define CL_INT_MAX_MIN_OPS    spirv::CLUMaxOp, spirv::CLUMinOp, spirv::CLSMaxOp, spirv::CLSMinOp
 
#define GL_INT_MAX_MIN_OPS    spirv::GLUMaxOp, spirv::GLUMinOp, spirv::GLSMaxOp, spirv::GLSMinOp
 
#define CL_FLOAT_MAX_MIN_OPS   spirv::CLFMaxOp, spirv::CLFMinOp
 
#define GL_FLOAT_MAX_MIN_OPS   spirv::GLFMaxOp, spirv::GLFMinOp
 

Functions

static uint64_t getFirstIntValue (ValueRange values)
 Returns the integer value from the first valid input element, assuming Value inputs are defined by a constant index ops and Attribute inputs are integer attributes. More...
 
static uint64_t getFirstIntValue (ArrayRef< Attribute > attr)
 
static uint64_t getFirstIntValue (ArrayAttr attr)
 
static uint64_t getFirstIntValue (ArrayRef< OpFoldResult > foldResults)
 
static int getNumBits (Type type)
 Returns the number of bits for the given scalar/vector type. More...
 

Macro Definition Documentation

◆ CL_FLOAT_MAX_MIN_OPS

#define CL_FLOAT_MAX_MIN_OPS   spirv::CLFMaxOp, spirv::CLFMinOp

Definition at line 950 of file VectorToSPIRV.cpp.

◆ CL_INT_MAX_MIN_OPS

#define CL_INT_MAX_MIN_OPS    spirv::CLUMaxOp, spirv::CLUMinOp, spirv::CLSMaxOp, spirv::CLSMinOp

Definition at line 944 of file VectorToSPIRV.cpp.

◆ GL_FLOAT_MAX_MIN_OPS

#define GL_FLOAT_MAX_MIN_OPS   spirv::GLFMaxOp, spirv::GLFMinOp

Definition at line 951 of file VectorToSPIRV.cpp.

◆ GL_INT_MAX_MIN_OPS

#define GL_INT_MAX_MIN_OPS    spirv::GLUMaxOp, spirv::GLUMinOp, spirv::GLSMaxOp, spirv::GLSMinOp

Definition at line 947 of file VectorToSPIRV.cpp.

◆ INT_AND_FLOAT_CASE

#define INT_AND_FLOAT_CASE (   kind,
  iop,
  fop 
)
Value:
case vector::CombiningKind::kind: \
if (llvm::isa<IntegerType>(resultType)) { \
result = rewriter.create<spirv::iop>(loc, resultType, result, next); \
} else { \
assert(llvm::isa<FloatType>(resultType)); \
result = rewriter.create<spirv::fop>(loc, resultType, result, next); \
} \
break

◆ INT_OR_FLOAT_CASE [1/2]

#define INT_OR_FLOAT_CASE (   kind,
  fop 
)
Value:
case vector::CombiningKind::kind: \
result = rewriter.create<fop>(loc, resultType, result, next); \
break

◆ INT_OR_FLOAT_CASE [2/2]

#define INT_OR_FLOAT_CASE (   kind,
  fop 
)
Value:
case vector::CombiningKind::kind: \
result = rewriter.create<fop>(loc, resultType, result, next); \
break

Function Documentation

◆ getFirstIntValue() [1/4]

static uint64_t getFirstIntValue ( ArrayAttr  attr)
static

Definition at line 49 of file VectorToSPIRV.cpp.

◆ getFirstIntValue() [2/4]

static uint64_t getFirstIntValue ( ArrayRef< Attribute attr)
static

Definition at line 46 of file VectorToSPIRV.cpp.

◆ getFirstIntValue() [3/4]

static uint64_t getFirstIntValue ( ArrayRef< OpFoldResult foldResults)
static

Definition at line 52 of file VectorToSPIRV.cpp.

References getFirstIntValue().

◆ getFirstIntValue() [4/4]

static uint64_t getFirstIntValue ( ValueRange  values)
static

Returns the integer value from the first valid input element, assuming Value inputs are defined by a constant index ops and Attribute inputs are integer attributes.

Definition at line 43 of file VectorToSPIRV.cpp.

Referenced by getFirstIntValue().

◆ getNumBits()

static int getNumBits ( Type  type)
static

Returns the number of bits for the given scalar/vector type.

Definition at line 61 of file VectorToSPIRV.cpp.

References mlir::Type::getIntOrFloatBitWidth().