Pick a representation (i.e. TensorRepr) from the set of possible representations. If there are multiple valid representations, then: 1. Prefer texture storage over buffer storage 2. Pick the first available memory layout.
(self)
| 962 | return list(self.valid_texture_layouts)[0] |
| 963 | |
| 964 | def make_tensor_repr(self) -> TensorRepr: |
| 965 | """ |
| 966 | Pick a representation (i.e. TensorRepr) from the set of possible representations. |
| 967 | If there are multiple valid representations, then: |
| 968 | 1. Prefer texture storage over buffer storage |
| 969 | 2. Pick the first available memory layout. |
| 970 | """ |
| 971 | if self.is_empty(): |
| 972 | # An empty repset typically means that it is associated with a weight tensor |
| 973 | # or non tensor argument. In this case, just return default storage and |
| 974 | # layout as placeholder. |
| 975 | return TensorRepr( |
| 976 | VkStorageType.DEFAULT_STORAGE, VkMemoryLayout.DEFAULT_LAYOUT |
| 977 | ) |
| 978 | |
| 979 | if self.texture_is_valid(): |
| 980 | return TensorRepr( |
| 981 | VkStorageType.TEXTURE_3D, self.first_valid_texture_layout() |
| 982 | ) |
| 983 | |
| 984 | else: |
| 985 | return TensorRepr(VkStorageType.BUFFER, self.first_valid_buffer_layout()) |
| 986 | |
| 987 | def is_constrained(self) -> bool: |
| 988 | """ |