1 //===- ArithToAMDGPU.h - Arith to AMDGPU dialect conversion ---*- 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 #ifndef MLIR_CONVERSION_ARITHTOAMDGPU_ARITHTOAMDGPU_H 10 #define MLIR_CONVERSION_ARITHTOAMDGPU_ARITHTOAMDGPU_H 11 12 #include "mlir/Dialect/AMDGPU/Utils/Chipset.h" 13 #include <memory> 14 #include <string> 15 16 namespace mlir { 17 18 class RewritePatternSet; 19 class Pass; 20 21 #define GEN_PASS_DECL_ARITHTOAMDGPUCONVERSIONPASS 22 #include "mlir/Conversion/Passes.h.inc" 23 24 namespace arith { 25 /// Add patterns for rewriting `arith.extf` and `arith.truncf` on FP8 types 26 /// to wrappers around AMDGPU--specific intrinsics. If `saturateFP8TruncF` 27 /// is set, values outside the range of the destination type are clamped 28 /// to the largest value of that type instead of being rewritten to Inf (aka 29 /// NaN). 30 void populateArithToAMDGPUConversionPatterns(RewritePatternSet &patterns, 31 bool convertFP8Arithmetic, 32 bool saturateFP8Truncf, 33 bool allowPackedF16Rtz, 34 amdgpu::Chipset chipset); 35 } // namespace arith 36 } // namespace mlir 37 38 #endif // MLIR_CONVERSION_ARITHTOAMDGPU_ARITHTOAMDGPU_H 39