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

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 16:07:02 PDT 2020


antiagainst accepted this revision.
antiagainst marked an inline comment as done.
antiagainst added a comment.

Awesome, thanks Hanhan!



================
Comment at: mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp:100
 
+/// Returns the offset of input value in `targetBits` integer representation.
+/// For example, if `elementBits` equals to 8 and `targetBits` equals to 32, the
----------------
hanchung wrote:
> antiagainst wrote:
> > What about:
> > 
> > Assuming `index` is an index into a 1-D array with each element having `sourceBits`, returns the adjusted `index` by treating the 1-D array as having elements of `targetBits`? 
> > 
> > This means renaming `lastDim` to `index`. 
> I think the method is not to adjust the index. Instead, it's calculating the offset of value from loaded value. When accessing the value from target 1-D array, multiple values are loaded in the same time. In this context, the method returns the offset where the `srcIdx` locates in the value. In the example, it's (x % 4) * 8, not (x % 4).
> 
> I add more comments here, please take a look.
Oh yeah good point. :)


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