MLIR  20.0.0git
SPIRVWebGPUTransforms.h
Go to the documentation of this file.
1 //===- SPIRVWebGPUTransforms.h - WebGPU-specific Transforms -*- C++ -----*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Defines SPIR-V transforms used when targetting WebGPU.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_SPIRV_TRANSFORMS_SPIRV_WEBGPU_TRANSFORMS_H
14 #define MLIR_DIALECT_SPIRV_TRANSFORMS_SPIRV_WEBGPU_TRANSFORMS_H
15 
16 #include "mlir/IR/PatternMatch.h"
17 
18 namespace mlir {
19 namespace spirv {
20 
21 /// Appends patterns to expand extended multiplication and adition ops into
22 /// regular arithmetic ops. Extended arithmetic ops are not supported by the
23 /// WebGPU Shading Language (WGSL).
25  RewritePatternSet &patterns);
26 
27 /// Appends patterns to expand non-finite arithmetic ops `IsNan` and `IsInf`.
28 /// These are not supported by the WebGPU Shading Language (WGSL). We follow
29 /// fast math assumptions and assume that all floating point values are finite.
31  RewritePatternSet &patterns);
32 
33 } // namespace spirv
34 } // namespace mlir
35 
36 #endif // MLIR_DIALECT_SPIRV_TRANSFORMS_SPIRV_WEBGPU_TRANSFORMS_H
void populateSPIRVExpandNonFiniteArithmeticPatterns(RewritePatternSet &patterns)
Appends patterns to expand non-finite arithmetic ops IsNan and IsInf.
void populateSPIRVExpandExtendedMultiplicationPatterns(RewritePatternSet &patterns)
Appends patterns to expand extended multiplication and adition ops into regular arithmetic ops.
Include the generated interface declarations.