diff options
Diffstat (limited to 'mlir/g3doc/ConversionToLLVMDialect.md')
-rw-r--r-- | mlir/g3doc/ConversionToLLVMDialect.md | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/mlir/g3doc/ConversionToLLVMDialect.md b/mlir/g3doc/ConversionToLLVMDialect.md index 2703542606c..ffc47baff4c 100644 --- a/mlir/g3doc/ConversionToLLVMDialect.md +++ b/mlir/g3doc/ConversionToLLVMDialect.md @@ -57,15 +57,17 @@ converted to a descriptor that is only dependent on the rank of the memref. The descriptor contains: 1. the pointer to the data buffer, followed by -2. a lowered `index`-type integer containing the distance between the beginning +2. the pointer to properly aligned data payload that the memref indexes, + followed by +3. a lowered `index`-type integer containing the distance between the beginning of the buffer and the first element to be accessed through the memref, followed by -3. an array containing as many `index`-type integers as the rank of the memref: +4. an array containing as many `index`-type integers as the rank of the memref: the array represents the size, in number of elements, of the memref along the given dimension. For constant MemRef dimensions, the corresponding size entry is a constant whose runtime value must match the static value, followed by -4. a second array containing as many 64-bit integers as the rank of the MemRef: +5. a second array containing as many 64-bit integers as the rank of the MemRef: the second array represents the "stride" (in tensor abstraction sense), i.e. the number of consecutive elements of the underlying buffer. @@ -73,19 +75,19 @@ For constant memref dimensions, the corresponding size entry is a constant whose runtime value matches the static value. This normalization serves as an ABI for the memref type to interoperate with externally linked functions. In the particular case of rank `0` memrefs, the size and stride arrays are omitted, -resulting in a struct containing a pointer + offset. +resulting in a struct containing two pointers + offset. Examples: ```mlir {.mlir} -memref<f32> -> !llvm.type<"{ float*, i64 }"> -memref<1 x f32> -> !llvm.type<"{ float*, i64, [1 x i64], [1 x i64] }"> -memref<? x f32> -> !llvm.type<"{ float*, i64, [1 x i64], [1 x i64] }"> -memref<10x42x42x43x123 x f32> -> !llvm.type<"{ float*, i64, [5 x i64], [5 x i64] }"> -memref<10x?x42x?x123 x f32> -> !llvm.type<"{ float*, i64, [5 x i64], [5 x i64] }"> +memref<f32> -> !llvm.type<"{ float*, float*, i64 }"> +memref<1 x f32> -> !llvm.type<"{ float*, float*, i64, [1 x i64], [1 x i64] }"> +memref<? x f32> -> !llvm.type<"{ float*, float*, i64, [1 x i64], [1 x i64] }"> +memref<10x42x42x43x123 x f32> -> !llvm.type<"{ float*, float*, i64, [5 x i64], [5 x i64] }"> +memref<10x?x42x?x123 x f32> -> !llvm.type<"{ float*, float*, i64, [5 x i64], [5 x i64] }"> // Memref types can have vectors as element types -memref<1x? x vector<4xf32>> -> !llvm.type<"{ <4 x float>*, i64, [1 x i64], [1 x i64] }"> +memref<1x? x vector<4xf32>> -> !llvm.type<"{ <4 x float>*, <4 x float>*, i64, [1 x i64], [1 x i64] }"> ``` ### Function Types |