Skip to content

PartitionViewOp needs to define shape twice, this is redundant #31

@learning-chip

Description

@learning-chip

For example in sync.py and most of other examples:

The shape is first declared in pto.PartitionTensorViewType.get(shape=[32, 32], element_type=f32)

https://github.com/zhangstevenunity/PTOAS/blob/2c8d83ea0ea1ca748ce53d178bef6878e644d113/test/samples/Sync/sync.py#L17

But again in

https://github.com/zhangstevenunity/PTOAS/blob/2c8d83ea0ea1ca748ce53d178bef6878e644d113/test/samples/Sync/sync.py#L46-L47

The generated IR also have both [%c32, %c32] and <32x32xf32>. This is redundant information.

    %2 = pto.partition_view %0, offsets = [%c0, %c0], sizes = [%c32, %c32] : !pto.tensor_view<?x?xf32> -> !pto.partition_tensor_view<32x32xf32>
    %3 = pto.partition_view %1, offsets = [%c0, %c0], sizes = [%c32, %c32] : !pto.tensor_view<?x?xf32> -> !pto.partition_tensor_view<32x32xf32>

Better be like tv2_f32 = pto.TensorViewType.get(shape_or_rank=2, element_type=f32) that only specifies rank
https://github.com/zhangstevenunity/PTOAS/blob/2c8d83ea0ea1ca748ce53d178bef6878e644d113/test/samples/Sync/sync.py#L16

Then the IR is less redundant

    %0 = pto.make_tensor_view %arg0, shape = [%c32, %c32] strides = [%c32, %c1] : !pto.tensor_view<?x?xf32>
    %1 = pto.make_tensor_view %arg1, shape = [%c32, %c32] strides = [%c32, %c1] : !pto.tensor_view<?x?xf32>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions