#include "mlir/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include <array>
#include <cstdint>
namespace mlir {
namespace spirv {
#define GEN_PASS_DEF_SPIRVWEBGPUPREPAREPASS
#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
}
}
namespace mlir {
namespace spirv {
namespace {
static Attribute getScalarOrSplatAttr(Type type, int64_t value) { … }
static Value lowerExtendedMultiplication(Operation *mulOp,
PatternRewriter &rewriter, Value lhs,
Value rhs, bool signExtendArguments) { … }
template <typename MulExtendedOp, bool SignExtendArguments>
struct ExpandMulExtendedPattern final : OpRewritePattern<MulExtendedOp> { … };
ExpandSMulExtendedPattern;
ExpandUMulExtendedPattern;
struct ExpandAddCarryPattern final : OpRewritePattern<IAddCarryOp> { … };
struct ExpandIsInfPattern final : OpRewritePattern<IsInfOp> { … };
struct ExpandIsNanPattern final : OpRewritePattern<IsNanOp> { … };
struct WebGPUPreparePass final
: impl::SPIRVWebGPUPreparePassBase<WebGPUPreparePass> { … };
}
void populateSPIRVExpandExtendedMultiplicationPatterns(
RewritePatternSet &patterns) { … }
void populateSPIRVExpandNonFiniteArithmeticPatterns(
RewritePatternSet &patterns) { … }
}
}