[Mlir-commits] [mlir] [mlir][Math][LLVMSPV] Add Math to LLVM-SPV conversion pass (PR #198370)
Md Abdullah Shahneous Bari
llvmlistbot at llvm.org
Mon Jun 8 07:54:13 PDT 2026
================
@@ -119,6 +123,76 @@ struct ConvertNativeFuncPattern final : public OpConversionPattern<Op> {
const StringRef nativeFunc;
};
+template <typename OpTy>
+static void populateOCLExtSetOpPatterns(const LLVMTypeConverter &converter,
+ RewritePatternSet &patterns,
+ PatternBenefit benefit,
+ StringRef opName) {
+ std::string prefix = "__spirv_ocl_";
+ std::string mangledName = "_Z" +
+ std::to_string(prefix.size() + opName.size()) +
+ prefix + opName.str();
+
----------------
mshahneo wrote:
For SPIR-V targeted vector lowering, the vector size should be SPIR-V spec compliant (2, 3, 4) and (8, 16 if vector16 Capability is enabled). I think it's better to check for it.
There is already a utility in this file `isSPIRVCompatibleFloatOrVec`: https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/MathToXeVM/MathToXeVM.cpp#L75
You can use that.
https://github.com/llvm/llvm-project/pull/198370
More information about the Mlir-commits
mailing list