Note: hexadecimal integer literals are not allowed in tensor type declarations
to avoid confusion between `0xf32` and `0 x f32`. Zero sizes are allowed in
tensors and treated as other sizes, e.g., `tensor<0 x 1 x i32>` and `tensor<1 x
-0 x i32>` are different types. Since zero sizes are not allowed in other types,
-such tensors should be optimized away before lowering tensors to memrefs.
+0 x i32>` are different types. Since zero sizes are not allowed in some other
+types, such tensors should be optimized away before lowering tensors to vectors.
Examples:
pointer, but more powerful). The buffer pointed to by a memref can be allocated,
aliased and deallocated. A memref can be used to read and write data from/to the
memory region which it references. Memref types use the same shape specifier as
-tensor types, but do not allow unknown rank nor zero sizes.
+tensor types, but do not allow unknown rank. Note that `memref<f32>`, `memref<0
+x f32>`, `memref<1 x 0 x f32>`, and `memref<0 x 1 x f32>` are all different
+types.
The memory space of a memref is specified by a target-specific integer index. If
no memory space is specified, then the default memory space (0) is used. The
};
/// MemRef types represent a region of memory that have a shape with a fixed
-/// number of dimensions. Each shape element can be a positive integer or
+/// number of dimensions. Each shape element can be a non-negative integer or
/// unknown (represented by any negative integer). MemRef types also have an
/// affine map composition, represented as an array AffineMap pointers.
class MemRefType
for (int64_t s : shape) {
// Negative sizes are not allowed except for `-1` that means dynamic size.
- if (s <= 0 && s != -1) {
+ if (s < -1) {
if (location)
context->emitError(*location, "invalid memref size");
return {};
// -----
-// expected-error @+1 {{invalid memref size}}
-func @zero_memref_type() -> memref<0xi32>
-
-// -----
-
-// expected-error @+1 {{invalid memref size}}
-func @zero_in_memref_type() -> memref<1x0xi32>
-
-// -----
-
// expected-error @+1 {{expected dimension size in vector type}}
func @negative_vector_size() -> vector<-1xi32>