[Mlir-commits] [mlir] [mlir][vector][spirv] Lower vector.maskedload and vector.maskedstore to SPIR-V (PR #74834)

Hsiangkai Wang llvmlistbot at llvm.org
Tue Dec 12 01:26:35 PST 2023


Hsiangkai wrote:

> > My goal is to convert all the dialects into spirv dialect in some stage. What is the rational way to lower vector.maskedload to spirv.load?
> 
> I'd say that the following would be preferred:
> 
> 1. `vector.gather` --> `vector.load` + `scf.if` (already there)
> 2. `vector.transfer_read`/`transfer_write` --> `vector.load`/`store`, `vector.maskedload`/`maskedstore`
> 3. `vector.maskedload`/`maskedstore` --> `vector.load`/`store` + `scf.if`
> 4. `vector.`/`memref.` / `load`/`store` --> ConvertVectorToSPIRV/ConvertMemRefToSPIRV (already there)
> 5. `scf.if` --> ConvertSCFToSPIRV (already there)
> 
> (or `memref.load`/`store`, I don't think there's much difference?)
> 
> Unless there's something that we could do much better by going directly to SPIR-V.

Thanks for your answering. It's very helpful.
About item 3, I can come out 2 different ways to do conversion.

1. `vector.maskedload` ---> `vector.load` + `arith.select`
2. `vector.maskedload` ---> `spirv.load` + `spirv.select` (I already use this pattern in this patch.)

Which way is better?

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


More information about the Mlir-commits mailing list