Skip to content

Commit b54eded

Browse files
committed
address reviewer comments
1 parent ae9b69c commit b54eded

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

mlir/include/mlir/Dialect/Ptr/IR/PtrDialect.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def Ptr_PtrMetadata : Ptr_Type<"PtrMetadata", "ptr_metadata"> {
9393
let description = [{
9494
The `ptr_metadata` type represents an opaque-view of the metadata associated
9595
with a `ptr-like` object type.
96-
It's an error to get a `ptr_metadata` using `ptr-like` type with no
97-
metadata.
96+
97+
Note: It's a verification error to construct a `ptr_metadata` type using a
98+
`ptr-like` type with no metadata.
9899

99100
Example:
100101

mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def Ptr_FromPtrOp : Pointer_Op<"from_ptr", [
3939
Example:
4040

4141
```mlir
42-
%typed_ptr = ptr.from_ptr %ptr : !ptr.ptr<0> -> !my.ptr<f32, 0>
43-
%memref = ptr.from_ptr %ptr metadata %md : !ptr.ptr<0> -> memref<f32, 0>
42+
%typed_ptr = ptr.from_ptr %ptr : !ptr.ptr<#ptr.generic_space> -> !my.ptr<f32, #ptr.generic_space>
43+
%memref = ptr.from_ptr %ptr metadata %md : !ptr.ptr<#ptr.generic_space> -> memref<f32, #ptr.generic_space>
4444

4545
// Cast the `%ptr` to a memref without utilizing metadata.
46-
%memref = ptr.from_ptr %ptr : !ptr.ptr<0> -> memref<f32, 0>
46+
%memref = ptr.from_ptr %ptr : !ptr.ptr<#ptr.generic_space> -> memref<f32, #ptr.generic_space>
4747
```
4848
}];
4949

@@ -98,8 +98,8 @@ def Ptr_PtrAddOp : Pointer_Op<"ptr_add", [
9898
Example:
9999

100100
```mlir
101-
%x_off = ptr.ptr_add %x, %off : !ptr.ptr<0>, i32
102-
%x_off0 = ptr.ptr_add nusw %x, %off : !ptr.ptr<0>, i32
101+
%x_off = ptr.ptr_add %x, %off : !ptr.ptr<#ptr.generic_space>, i32
102+
%x_off0 = ptr.ptr_add nusw %x, %off : !ptr.ptr<#ptr.generic_space>, i32
103103
```
104104
}];
105105

@@ -134,8 +134,8 @@ def Ptr_ToPtrOp : Pointer_Op<"to_ptr", [Pure]> {
134134
Example:
135135

136136
```mlir
137-
%ptr0 = ptr.to_ptr %my_ptr : !my.ptr<f32, 0> -> !ptr.ptr<0>
138-
%ptr1 = ptr.to_ptr %memref : memref<f32, 0> -> !ptr.ptr<0>
137+
%ptr0 = ptr.to_ptr %my_ptr : !my.ptr<f32, #ptr.generic_space> -> !ptr.ptr<#ptr.generic_space>
138+
%ptr1 = ptr.to_ptr %memref : memref<f32, #ptr.generic_space> -> !ptr.ptr<#ptr.generic_space>
139139
```
140140
}];
141141

mlir/include/mlir/IR/BuiltinTypeInterfaces.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ def PtrLikeTypeInterface : TypeInterface<"PtrLikeTypeInterface"> {
119119
let description = [{
120120
A ptr-like type represents an object storing a memory address. This object
121121
is constituted by:
122-
- A memory address called the base pointer. The base pointer is an
123-
indivisible object.
122+
- A memory address called the base pointer. This pointer is treated as a
123+
bag of bits without any assumed structure. The bit-width of the base
124+
pointer must be a compile-time constant. However, the bit-width may remain
125+
opaque or unavailable during transformations that do not depend on the
126+
base pointer. Finally, it is considered indivisible in the sense that as
127+
a `PtrLikeTypeInterface` value, it has no metadata.
124128
- Optional metadata about the pointer. For example, the size of the memory
125129
region associated with the pointer.
126130

0 commit comments

Comments
 (0)