llvm-project
51a1aab6 - [mlir][math] Add `clampf` and clean math `ExpandOps` API (#151153)

Commit
237 days ago
[mlir][math] Add `clampf` and clean math `ExpandOps` API (#151153) This patch adds the `clampf` operation to the math dialect. The semantics op are defined as: ``` clampf(x, min_v, max_v) = max(min(x, min_v), max_v) ``` The reasoning behind adding this operation is that some GPU vendors offer specialized intrinsics for this operation, or subsets of this operation. For example, [__saturatef](https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/group__CUDA__MATH__INTRINSIC__SINGLE.html#group__cuda__math__intrinsic__single_1ga2c84f08e0db7117a14509d21c3aec04e) in NVIDIA GPUs, or `__builtin_amdgcn_fmed3f` in AMD GPUs. This patch also removes `test-expand-math` in favor of `math-expand-ops`. Finally, it removes individual expansion population API calls like `populateExpandCoshPattern` in favor of: ```C++ void populateExpansionPatterns(RewritePatternSet &patterns, ArrayRef<StringRef> opMnemonics = {}); ```
Author
Parents
Loading