[llvm] [NVPTX] Add IR pass for FMA transformation in the llc pipeline (PR #154735)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 22 02:22:29 PDT 2025


arsenm wrote:

> 1. Currently, the SLPVectorizer is invoked within the opt pipeline. Introducing it in llc solely for FMA vectorisation may not be justified, especially if its scope remains limited to that functionality.

FMA vectorization isn't special. It's just another one of many vectorizable operations 

> 2. The NVPTXIRPeephole pass will synthesize FMAs during llc. For the SLPVectorizer to recognize and act on these FMAs, it must be scheduled after this pass. Otherwise, it won't have visibility into the transformed instructions.

llc is just a testing utility, it doesn't mean anything on its own. The placement of the vectorizer in late middle end or early codegen is fairly arbitrary. 

> 3. As far as I understand, SLPVectorizer performs vectorization that benefits multiple backends. However, it's unclear which other targets would gain from FMA-specific vectorization. Even for NVPTX, the benefits of this transformation are not universally guaranteed.

This isn't a unique property, and that's what the cost model is for. The solution to cost model questions isn't reimplement a new vectorizer for every operation x every backend 

https://github.com/llvm/llvm-project/pull/154735


More information about the llvm-commits mailing list