Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,4 @@ not architecture authority; current meaning remains in the owning ASL/NDF.

### Tile
- [ADR-0044](docs/status/decisions/0044-public-integer-conversion-result-subset.md): Public integer conversion result subset
- [ADR-0103](docs/status/decisions/0103-private-cube-vector-and-cell-rearrangement.md): Private CUBE vector execution and CELL rearrangement
2 changes: 1 addition & 1 deletion asl/arch/overview/encoding-ownership.asl

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions asl/block/model/dispatch/cell-rearrangement-schema.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// PTO-UNIT: {"id":"PTO-BLOCK-MODEL-DISPATCH-CELL-REARRANGEMENT-SCHEMA","surface":"block","classification":["model","dispatch","cell-rearrangement-schema"],"depends_on":["PTO-BLOCK-MODEL-DISPATCH-TILE-SCHEMA"]}

func ResolveBundleCellRearrangementDestination() => boolean
begin
var destination_binding: BundleTileBindingIndex = 0;
var destination_seen = FALSE;
var source: TileIndex = 0;
var source_seen = FALSE;
for binding = 0 to PTO_BUNDLE_TILE_BINDING_COUNT - 1 looplimit 16 do
if _BundleTileBindings[[binding]].valid then
if !destination_seen &&
_BundleTileBindings[[binding]].destination_valid then
destination_binding = binding as BundleTileBindingIndex;
destination_seen = TRUE;
end;
if !source_seen &&
_BundleTileBindings[[binding]].source0_valid then
source = BundleTileSourceIndex(
binding as BundleTileBindingIndex, FALSE);
source_seen = TRUE;
elsif !source_seen &&
_BundleTileBindings[[binding]].source1_valid then
source = BundleTileSourceIndex(
binding as BundleTileBindingIndex, TRUE);
source_seen = TRUE;
end;
end;
end;
if !destination_seen || !source_seen ||
!TileCubeDescriptorLegal(_Tiles[[source]]) then
SetFault(Fault_TileLegality, ReadTPC());
return FALSE;
end;
let binding = _BundleTileBindings[[destination_binding]];
let source_tile = _Tiles[[source]];
let capacity_bytes = BundleLocalDestinationAllocationBytes(
destination_binding);
if !TileCubeDescriptorShapeLegal(capacity_bytes,
source_tile.valid_rows, source_tile.valid_columns,
source_tile.data_type, source_tile.layout) then
SetFault(Fault_TileAllocation, ReadTPC());
return FALSE;
end;
let hand = UInt(binding.destination_hand);
var resolved: TileIndex = 0;
var found = FALSE;
for offset = 0 to 15 looplimit 16 do
let raw_index = hand * 16 + offset;
if !found && !_Tiles[[raw_index]].allocated then
resolved = raw_index as TileIndex;
found = TRUE;
end;
end;
if !found || !LocalTileAllocationFitsExcept(
resolved, binding.pe_mask, capacity_bytes) then
SetFault(Fault_TileAllocation, ReadTPC());
return FALSE;
end;
let configured = ConfigureCubeTileForMask(
resolved, capacity_bytes, source_tile.valid_rows,
source_tile.valid_columns, source_tile.data_type,
source_tile.layout, TileLocation_Matrix, binding.pe_mask);
if !configured then
SetFault(Fault_TileAllocation, ReadTPC());
return FALSE;
end;
_BundleTileBindings[[destination_binding]].destination = resolved;
_BundleTileBindings[[destination_binding]].destination_allocated_by_bundle =
TRUE;
return TRUE;
end;

pure func TileOperationUsesCellRearrangementSchema(
operation: integer {0..PTO_TILE_OPERATION_COUNT-1}) => boolean
begin
let decoded = TileOperationOfIndex(operation);
return decoded == TileOperation_TPERMUTE ||
decoded == TileOperation_TSHUF ||
decoded == TileOperation_TPACK ||
decoded == TileOperation_TUNPACK;
end;

readonly func SelectedBundleCellRearrangementSchemaLegal(
operation: integer {0..PTO_TILE_OPERATION_COUNT-1}) => boolean
begin
if !TileOperationUsesCellRearrangementSchema(operation) then return TRUE; end;
if SelectedBundleTileMaskIsZero() then return TRUE; end;
let decoded = TileOperationOfIndex(operation);
if decoded == TileOperation_TPERMUTE then
if BundleTileBindingCount() != 2 || BundleSharedBindingCount() != 0 ||
_BundleScalarBindings[[0]].valid then return FALSE; end;
let first = _BundleTileBindings[[0]];
let second = _BundleTileBindings[[1]];
return !first.destination_valid && first.source0_valid &&
first.source1_valid && !first.last && second.destination_valid &&
!second.destination_allocated_by_bundle && second.source0_valid &&
!second.source1_valid && second.last &&
second.source0 != first.source0 &&
second.source0 != first.source1 &&
BundleTileDestinationSizeLegal(1);
end;
if BundleTileBindingCount() != 1 || BundleSharedBindingCount() != 0 ||
!_BundleScalarBindings[[0]].valid ||
_BundleScalarBindings[[0]].source1 != 0 ||
_BundleScalarBindings[[0]].source2 != 0 ||
_BundleScalarBindings[[0]].destination != 0 then
return FALSE;
end;
let binding = _BundleTileBindings[[0]];
if !binding.destination_valid || binding.destination_allocated_by_bundle ||
!BundleTileDestinationSizeLegal(0) || !binding.last then
return FALSE;
end;
if decoded == TileOperation_TUNPACK then
return binding.source0_valid && !binding.source1_valid;
end;
return binding.source0_valid && binding.source1_valid;
end;
12 changes: 8 additions & 4 deletions asl/block/model/dispatch/destination-shape.asl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// PTO-UNIT: {"id":"PTO-BLOCK-MODEL-DISPATCH-DESTINATION-SHAPE","surface":"block","classification":["model","dispatch","destination-shape"],"depends_on":["PTO-BLOCK-MODEL-DISPATCH-DESTINATION-AUXILIARY","PTO-BLOCK-MODEL-DISPATCH-EXPANSION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-HISTOGRAM-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-NUMERIC-CONTROL","PTO-BLOCK-MODEL-DISPATCH-QUANTIZATION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-REDUCTION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-SORTING-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TCVT-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TILE-SCALAR-SCHEMA","PTO-TILE-MODEL-STATE-SHARED-REGISTERS"]}
// PTO-UNIT: {"id":"PTO-BLOCK-MODEL-DISPATCH-DESTINATION-SHAPE","surface":"block","classification":["model","dispatch","destination-shape"],"depends_on":["PTO-BLOCK-MODEL-DISPATCH-CELL-REARRANGEMENT-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-DESTINATION-AUXILIARY","PTO-BLOCK-MODEL-DISPATCH-EXPANSION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-HISTOGRAM-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-NUMERIC-CONTROL","PTO-BLOCK-MODEL-DISPATCH-QUANTIZATION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-REDUCTION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-SORTING-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TCVT-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TILE-SCALAR-SCHEMA","PTO-TILE-MODEL-STATE-SHARED-REGISTERS"]}

readonly func BundleDestinationValidRows(shape_source_valid: boolean,
shape_source: TileIndex)
Expand All @@ -17,7 +17,6 @@ begin
return 1;
end;
end;

readonly func BundleDestinationValidColumns(shape_source_valid: boolean,
shape_source: TileIndex)
=> integer {0..65535}
Expand All @@ -35,7 +34,6 @@ begin
return 1;
end;
end;

readonly func BundleDestinationPhysicalColumns(shape_source_valid: boolean,
shape_source: TileIndex)
=> integer {0..65535}
Expand All @@ -53,7 +51,6 @@ begin
return BundleDestinationValidColumns(FALSE, 0);
end;
end;

readonly func BundleLocalDestinationCapacityGroupFits() => boolean
begin
var additional0: integer = 0;
Expand Down Expand Up @@ -366,6 +363,13 @@ begin
_BundleOperation.operation_class == BundleOperation_TileMatrix then
return TRUE;
end;
let decoded_operation = TileOperationOfIndex(operation);
if decoded_operation == TileOperation_TPERMUTE ||
decoded_operation == TileOperation_TSHUF ||
decoded_operation == TileOperation_TPACK ||
decoded_operation == TileOperation_TUNPACK then
return ResolveBundleCellRearrangementDestination();
end;
if TileOperationOfIndex(operation) == TileOperation_TIMG2COL then
let resolved = ResolveBundleTileDestinations();
if resolved then
Expand Down
113 changes: 0 additions & 113 deletions asl/block/model/dispatch/partial-schema.asl

This file was deleted.

20 changes: 16 additions & 4 deletions asl/block/model/dispatch/tile-execution.asl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// PTO-UNIT: {"id":"PTO-BLOCK-MODEL-DISPATCH-TILE-EXECUTION","surface":"block","classification":["model","dispatch","tile-execution"],"depends_on":["PTO-BLOCK-MODEL-DISPATCH-COMPARISON-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-CUBE-TMATMUL","PTO-BLOCK-MODEL-DISPATCH-EXPANSION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-GENERATION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-HISTOGRAM-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-PARTIAL-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-REDUCTION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-SORTING-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TILE-SCALAR-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TLSU-GMOV","PTO-BLOCK-MODEL-DISPATCH-TLSU-LAYOUT-CONVERSION","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER-CAS","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER-MASK","PTO-BLOCK-MODEL-DISPATCH-TLSU-MSCATTER","PTO-BLOCK-MODEL-DISPATCH-TLSU-MSCATTER-MASK","PTO-BLOCK-MODEL-DISPATCH-TLSU-PREFETCH","PTO-BLOCK-MODEL-DISPATCH-SHARED-TLSU","PTO-BLOCK-MODEL-OPERANDS-LOCAL-GENERATION","PTO-BLOCK-MODEL-OPERANDS-SHARED-GENERATION","PTO-BLOCK-MODEL-OPERANDS-PORTABLE-CARRIERS","PTO-BLOCK-MODEL-OPERANDS-SUBVIEW-DESCRIPTOR","PTO-TILE-MODEL-DISPATCH-TOP-LEVEL"]}
// PTO-UNIT: {"id":"PTO-BLOCK-MODEL-DISPATCH-TILE-EXECUTION","surface":"block","classification":["model","dispatch","tile-execution"],"depends_on":["PTO-BLOCK-MODEL-DISPATCH-CELL-REARRANGEMENT-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-COMPARISON-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-CUBE-TMATMUL","PTO-BLOCK-MODEL-DISPATCH-EXPANSION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-GENERATION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-HISTOGRAM-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-REDUCTION-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-SORTING-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TILE-SCALAR-SCHEMA","PTO-BLOCK-MODEL-DISPATCH-TLSU-GMOV","PTO-BLOCK-MODEL-DISPATCH-TLSU-LAYOUT-CONVERSION","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER-CAS","PTO-BLOCK-MODEL-DISPATCH-TLSU-MGATHER-MASK","PTO-BLOCK-MODEL-DISPATCH-TLSU-MSCATTER","PTO-BLOCK-MODEL-DISPATCH-TLSU-MSCATTER-MASK","PTO-BLOCK-MODEL-DISPATCH-TLSU-PREFETCH","PTO-BLOCK-MODEL-DISPATCH-SHARED-TLSU","PTO-BLOCK-MODEL-OPERANDS-LOCAL-GENERATION","PTO-BLOCK-MODEL-OPERANDS-SHARED-GENERATION","PTO-BLOCK-MODEL-OPERANDS-PORTABLE-CARRIERS","PTO-BLOCK-MODEL-OPERANDS-SUBVIEW-DESCRIPTOR","PTO-TILE-MODEL-DISPATCH-TOP-LEVEL"]}
readonly func BundleTileTypesMatch(
operation: integer {0..PTO_TILE_OPERATION_COUNT-1},
operands: TileInstructionOperands,
Expand All @@ -22,12 +22,12 @@ begin
return SelectedBundleClosedBinarySchemaLegal(operation) &&
SelectedBundleClosedUnarySchemaLegal(operation) &&
SelectedBundleClosedTFMASchemaLegal(operation) &&
SelectedBundleCellRearrangementSchemaLegal(operation) &&
SelectedBundleClosedQuantizationSchemaLegal(operation) &&
SelectedBundleClosedGenerationSchemaLegal(operation) &&
SelectedBundleClosedHistogramSchemaLegal(operation) &&
SelectedBundleClosedReductionSchemaLegal(operation) &&
SelectedBundleClosedSortingSchemaLegal(operation) &&
SelectedBundleClosedPartialSchemaLegal(operation) &&
SelectedBundleClosedExpansionSchemaLegal(operation) &&
SelectedBundleClosedTCVTSchemaLegal(operation) &&
SelectedBundleClosedTCMPSchemaLegal(operation) &&
Expand Down Expand Up @@ -65,7 +65,11 @@ begin
return FALSE;
end;
let matrix_selected = BundleCubeMatrixSelected();
if !matrix_selected && !PrepareSelectedBundleStage2() then
var stage2_prepared = TRUE;
if !matrix_selected then
stage2_prepared = PrepareSelectedBundleStage2();
end;
if !matrix_selected && !stage2_prepared then
DiscardBundleSubviewMaterializations();
return FALSE;
end;
Expand Down Expand Up @@ -151,6 +155,14 @@ begin
if !SelectedBundleTileDataAttributesLegal(operation) then
return FALSE;
end;
// Cell-rearrangement B.IOR/B.IOT shape is bundle structure. Report
// omitted or surplus controls as BundleControl before the generic closed
// schema maps a failed operand contract to TileLegality.
if TileOperationUsesCellRearrangementSchema(operation) &&
!SelectedBundleCellRearrangementSchemaLegal(operation) then
SetFault(Fault_BundleControl, ReadTPC());
return FALSE;
end;
if !SelectedBundleClosedSchemasLegal(operation) then
SetFault(Fault_TileLegality, ReadTPC());
return FALSE;
Expand All @@ -171,7 +183,7 @@ begin
let operands = BundleTileInstructionOperands(operation);
let (status, -) =
ExecuteTileInstructionWithoutTimeWithAcceptedApplicabilityRules(
rules, family, code, operands);
rules, family, code, operands);
if _LastFault != Fault_None || status != TileExecution_Executed then
RollBackBundleTileDestinations();
AbortBundleLocalGenerationsForBundle();
Expand Down
17 changes: 15 additions & 2 deletions asl/block/model/dispatch/tile-scalar-schema.asl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ begin
SelectedBundleComparisonShapeMatches(source);
end;

readonly func SelectedBundleTileScalarElementwiseSourceLegal(
source: TileIndex,
data_type: TileDataType) => boolean
begin
return TileDescriptorLegal(source) &&
_Tiles[[source]].storage_kind == TileStorage_Numeric &&
_Tiles[[source]].data_type == data_type &&
TileElementwiseLayoutSupported(_Tiles[[source]].layout) &&
TileSourceContentsDefined(source) &&
TileSourceEncodingsValid(source) &&
SelectedBundleComparisonShapeMatches(source);
end;

readonly func SelectedBundleClosedTileScalarBinarySchemaLegal(
operation: integer {0..PTO_TILE_OPERATION_COUNT-1}) => boolean
begin
Expand Down Expand Up @@ -115,8 +128,8 @@ begin
CurrentBundleTileOperationDataTypeCode()
as TileDataTypeEncoding);
if !TileBinaryDataTypeSupported(binary, data_type) ||
CurrentBundleTileLayout() != TileLayout_RowMajor ||
!SelectedBundleTileScalarSourceLegal(
!TileElementwiseLayoutSupported(CurrentBundleTileLayout()) ||
!SelectedBundleTileScalarElementwiseSourceLegal(
binding.source0,
data_type) then
return FALSE;
Expand Down
Loading
Loading