[PATCH] D78974: [mlir][StandardToSPIRV] Emulate bitwidths not supported for load op.

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 09:38:48 PDT 2020


antiagainst added a comment.

In D78974#2009336 <https://reviews.llvm.org/D78974#2009336>, @mehdi_amini wrote:

> Isn't this the kind of legalization that can be made on the std dialect itself as a pre-pass before the conversion to SPIRV? That would make all this logic reusable.


Good question! But whether to do a specific type conversion is determined by the SPIR-V target environment and it can be quite nuanced. For example, if we only have `StorageBuffer16Acesss` capability then `memref<i16, 0>` will be fine but `memref<i8,0>`/`memref<i16, 4>`/etc. needs to be adjusted. There are many other similar capabilities like `UniformAndStorageBuffer16BitAccess`, `*8BitAccess`, `{Int|Float}{8|16|64}`, etc. This kind of information is only available when converting to SPIR-V and hide behind `SPIRVTypeConverter`. If this is to be implemented as a pre-pass operating on standard types, it's not quite clear to me how to solve the phase-ordering issue and rope the configuration there.
But regarding code reuse, I guess we might be able to extract some of the index adjusting logic out and change them to templated ones so one can also plug in std and other dialect ops to reuse.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78974/new/

https://reviews.llvm.org/D78974





More information about the llvm-commits mailing list