The complete ASL owner is shown directly below.
12
3456789
10111213141516
1718192021222324
25readonly func BundleLocalGenerationReplay(26 slot: integer {0..63}, offset_cells: integer {0..2047},27 writer_cells: integer {1..2048}, instance: Word,28 execution_domain_token: integer) => boolean29begin30 for prior = 0 to _LocalGenerations[[slot]].writer_count - 131 looplimit 16 do32 if _LocalGenerations[[slot]].writers[[prior]].valid &&33 _LocalGenerations[[slot]].writers[[prior]].offset_cells == offset_cells &&34 _LocalGenerations[[slot]].writers[[prior]].cell_count == writer_cells then35 return _LocalGenerations[[slot]].writers[[prior]].identity36 .instruction_instance == instance &&37 _LocalGenerations[[slot]].writers[[prior]].identity38 .execution_domain_token == execution_domain_token;39 end;40 end;41 return FALSE;42end;43
44readonly func BundleLocalGenerationPublicationEligible(45 slot: integer {0..63}) => boolean46begin47 if !_LocalGenerations[[slot]].last_seen ||48 !_LocalGenerations[[slot]].parent_descriptor.valid then49 return FALSE;50 end;51 let required = _LocalGenerations[[slot]].parent_cell_count;52 if required == 0 || required > 2048 then return FALSE; end;53 for cell = 0 to 2047 do54 if cell < required &&55 (_LocalGenerations[[slot]].covered_cells[cell] == '0' ||56 _LocalGenerations[[slot]].ready_cells[cell] == '0') then57 return FALSE;58 end;59 end;60 return TRUE;61end;62
63readonly func BundleLocalGenerationSlotForSource(source: TileIndex)64 => integer {0..64}65begin66 for slot = 0 to 63 do67 68 69 70 if (_LocalGenerations[[slot]].committed_valid &&71 _LocalGenerations[[slot]].committed_destination == source) ||72 (_LocalGenerations[[slot]].closed &&73 _LocalGenerations[[slot]].working_destination == source) then74 return slot;75 end;76 end;77 return 64;78end;79
80func BundleConsumerDependencyRequiredRange(81 slot: integer {0..63}, source: TileIndex, offset: Word,82 size_code: integer {0..12}, whole: boolean,83 consumer_instance: Word) => boolean84begin85 let raw_offset = UInt(offset);86 if raw_offset > 2047 then return FALSE; end;87 let offset_cells = raw_offset as integer {0..2047};88 let parent_cells = _LocalGenerations[[slot]].parent_cell_count;89 if parent_cells == 0 || parent_cells > 2048 then return FALSE; end;90 var required: bits(2048) = Zeros{2048};91 var required_count: integer = 0;92 if whole then93 for cell = 0 to 2047 do94 if cell < parent_cells then95 required[cell] = '1';96 required_count = required_count + 1;97 end;98 end;99 else100 if size_code == 0 then return FALSE; end;101 let selected = BundleLocalGenerationCellCount(102 size_code as integer {1..12});103 var end_cell: integer = 2048;104 if offset_cells + selected < parent_cells then105 end_cell = offset_cells + selected;106 elsif parent_cells < 2048 then107 end_cell = parent_cells;108 end;109 for cell = 0 to 2047 do110 if cell >= offset_cells && cell < end_cell then111 required[cell] = '1';112 required_count = required_count + 1;113 end;114 end;115 end;116 var found = FALSE;117 for index = 0 to _LocalGenerations[[slot]].consumer_count - 1118 looplimit 16 do119 if _LocalGenerations[[slot]].consumers[[index]].valid &&120 _LocalGenerations[[slot]].consumers[[index]]121 .consumer_instruction_instance == consumer_instance &&122 _LocalGenerations[[slot]].consumers[[index]]123 .generation_instance ==124 _LocalGenerations[[slot]].generation_instance &&125 _LocalGenerations[[slot]].consumers[[index]]126 .execution_domain_token == _BundleExecutionDomainToken &&127 _LocalGenerations[[slot]].consumers[[index]].source == source &&128 _LocalGenerations[[slot]].consumers[[index]].required_cells ==129 required then130 found = TRUE;131 if _LocalGenerations[[slot]].consumers[[index]].state ==132 BundleConsumerDependency_Waiting then133 var ready = TRUE;134 for cell = 0 to 2047 do135 if required[cell] == '1' &&136 _LocalGenerations[[slot]].ready_cells[cell] == '0' then137 ready = FALSE;138 end;139 end;140 if ready then141 _LocalGenerations[[slot]].consumers[[index]].state =142 BundleConsumerDependency_Eligible;143 end;144 end;145 return _LocalGenerations[[slot]].consumers[[index]].state !=146 BundleConsumerDependency_Waiting;147 end;148 end;149 if !found && _LocalGenerations[[slot]].consumer_count < 16 then150 let index = _LocalGenerations[[slot]].consumer_count;151 _LocalGenerations[[slot]].consumers[[index]].valid = TRUE;152 _LocalGenerations[[slot]].consumers[[index]].source = source;153 _LocalGenerations[[slot]].consumers[[index]].generation_instance =154 _LocalGenerations[[slot]].generation_instance;155 _LocalGenerations[[slot]].consumers[[index]].execution_domain_token =156 _BundleExecutionDomainToken;157 _LocalGenerations[[slot]].consumers[[index]].mode = if whole then158 BundleConsumerDependency_WholeParent159 else BundleConsumerDependency_Range;160 _LocalGenerations[[slot]].consumers[[index]].required_cells = required;161 _LocalGenerations[[slot]].consumers[[index]].required_cell_count =162 required_count as integer {0..16};163 _LocalGenerations[[slot]].consumers[[index]].after_last = TRUE;164 _LocalGenerations[[slot]].consumers[[index]]165 .consumer_instruction_instance = consumer_instance;166 _LocalGenerations[[slot]].consumer_count = (index + 1)167 as integer {0..16};168 var ready = TRUE;169 for cell = 0 to 2047 do170 if required[cell] == '1' &&171 _LocalGenerations[[slot]].ready_cells[cell] == '0' then172 ready = FALSE;173 end;174 end;175 _LocalGenerations[[slot]].consumers[[index]].state = if ready then176 BundleConsumerDependency_Eligible177 else BundleConsumerDependency_Waiting;178 return ready;179 end;180 return FALSE;181end;182
183func BundlePrepareConsumerSource(184 source: TileIndex, modifier_valid: boolean, offset: Word,185 size_code: integer {0..12}) => boolean186begin187 let slot = BundleLocalGenerationSlotForSource(source);188 if slot == 64 || !_LocalGenerations[[slot]].last_seen then return TRUE; end;189 190 191 if !_LocalGenerations[[slot]].closed then return TRUE; end;192 return BundleConsumerDependencyRequiredRange(193 slot as integer {0..63}, source, offset, size_code,194 !modifier_valid, ReadBPC());195end;196
197func PrepareBundleConsumerDependencies() => boolean198begin199 for binding = 0 to PTO_BUNDLE_TILE_BINDING_COUNT - 1 do200 if _BundleTileBindings[[binding]].valid then201 if _BundleTileBindings[[binding]].source0_valid &&202 !BundlePrepareConsumerSource(203 _BundleTileBindings[[binding]].source0,204 _BundleTileBindings[[binding]].source0_subview.valid,205 _BundleTileBindings[[binding]].source0_subview.offset,206 _BundleTileBindings[[binding]].source0_subview.size_code) then207 return FALSE;208 end;209 if _BundleTileBindings[[binding]].source1_valid &&210 !BundlePrepareConsumerSource(211 _BundleTileBindings[[binding]].source1,212 _BundleTileBindings[[binding]].source1_subview.valid,213 _BundleTileBindings[[binding]].source1_subview.offset,214 _BundleTileBindings[[binding]].source1_subview.size_code) then215 return FALSE;216 end;217 end;218 end;219 return TRUE;220end;221
222func RetireBundleConsumerDependencies()223begin224 for slot = 0 to 63 do225 if _LocalGenerations[[slot]].consumer_count > 0 then226 for index = 0 to _LocalGenerations[[slot]].consumer_count - 1227 looplimit 16 do228 if _LocalGenerations[[slot]].consumers[[index]].valid &&229 _LocalGenerations[[slot]].consumers[[index]].state ==230 BundleConsumerDependency_Eligible then231 _LocalGenerations[[slot]].consumers[[index]].state =232 BundleConsumerDependency_Retired;233 _LocalGenerations[[slot]].consumers[[index]].valid = FALSE;234 end;235 end;236 end;237 end;238end;239
240241242243244245func CompleteBundleLocalGenerationWriterEvent(246 slot: integer {0..63}, execution_domain_token: integer,247 offset_cells: integer {0..2047}, cell_count: integer {1..2048})248 => boolean249begin250 var matched = FALSE;251 for writer = 0 to _LocalGenerations[[slot]].writer_count - 1252 looplimit 16 do253 if _LocalGenerations[[slot]].writers[[writer]].valid &&254 _LocalGenerations[[slot]].writers[[writer]].identity255 .execution_domain_token == execution_domain_token &&256 _LocalGenerations[[slot]].writers[[writer]].offset_cells ==257 offset_cells &&258 _LocalGenerations[[slot]].writers[[writer]].cell_count ==259 cell_count then260 _LocalGenerations[[slot]].writers[[writer]].ready = TRUE;261 matched = TRUE;262 end;263 end;264 if !matched then return FALSE; end;265
266 267 268 var ready = Zeros{2048};269 for writer = 0 to _LocalGenerations[[slot]].writer_count - 1270 looplimit 16 do271 if _LocalGenerations[[slot]].writers[[writer]].valid &&272 _LocalGenerations[[slot]].writers[[writer]].ready then273 for cell = 0 to 2047 do274 if cell < _LocalGenerations[[slot]].writers[[writer]].cell_count &&275 _LocalGenerations[[slot]].writers[[writer]].offset_cells +276 cell < 2048 then277 ready[_LocalGenerations[[slot]].writers[[writer]].offset_cells +278 cell] = '1';279 end;280 end;281 end;282 end;283 _LocalGenerations[[slot]].ready_cells = ready;284 for index = 0 to _LocalGenerations[[slot]].consumer_count - 1285 looplimit 16 do286 if _LocalGenerations[[slot]].consumers[[index]].valid &&287 _LocalGenerations[[slot]].consumers[[index]].state ==288 BundleConsumerDependency_Waiting then289 var complete = TRUE;290 for cell = 0 to 2047 do291 if _LocalGenerations[[slot]].consumers[[index]]292 .required_cells[cell] == '1' && ready[cell] == '0' then293 complete = FALSE;294 end;295 end;296 if complete then297 _LocalGenerations[[slot]].consumers[[index]].state =298 BundleConsumerDependency_Eligible;299 end;300 end;301 end;302 if _LocalGenerations[[slot]].closed &&303 !_LocalGenerations[[slot]].published &&304 BundleLocalGenerationPublicationEligible(slot) then305 306 307 _LocalGenerations[[slot]].open = FALSE;308 _LocalGenerations[[slot]].published = TRUE;309 _LocalGenerations[[slot]].published_destination =310 _LocalGenerations[[slot]].working_destination;311 _LocalGenerations[[slot]].committed_destination =312 _LocalGenerations[[slot]].working_destination;313 _LocalGenerations[[slot]].committed_valid = TRUE;314 end;315 return TRUE;316end;317
318func SquashBundleExecutionDomain(domain: integer)319begin320 for slot = 0 to 63 do321 var covered: bits(2048) = Zeros{2048};322 var ready: bits(2048) = Zeros{2048};323 var writers_left: integer {0..16} = 0;324 for writer = 0 to _LocalGenerations[[slot]].writer_count - 1325 looplimit 16 do326 if _LocalGenerations[[slot]].writers[[writer]].valid &&327 _LocalGenerations[[slot]].writers[[writer]].identity328 .execution_domain_token == domain then329 _LocalGenerations[[slot]].writers[[writer]].valid = FALSE;330 _LocalGenerations[[slot]].writers[[writer]].ready = FALSE;331 end;332 end;333 for writer = 0 to _LocalGenerations[[slot]].writer_count - 1334 looplimit 16 do335 if _LocalGenerations[[slot]].writers[[writer]].valid then336 writers_left = (writers_left + 1) as integer {0..16};337 for cell = 0 to 2047 do338 if cell < _LocalGenerations[[slot]].writers[[writer]]339 .cell_count then340 let index = _LocalGenerations[[slot]].writers[[writer]]341 .offset_cells + cell;342 if index < 2048 then343 covered[index] = '1';344 if _LocalGenerations[[slot]].writers[[writer]].ready then345 ready[index] = '1';346 end;347 end;348 end;349 end;350 end;351 end;352 _LocalGenerations[[slot]].covered_cells = covered;353 _LocalGenerations[[slot]].ready_cells = ready;354 _LocalGenerations[[slot]].writer_count = writers_left as integer {0..16};355 for index = 0 to _LocalGenerations[[slot]].consumer_count - 1356 looplimit 16 do357 if _LocalGenerations[[slot]].consumers[[index]].valid &&358 _LocalGenerations[[slot]].consumers[[index]]359 .execution_domain_token == domain then360 _LocalGenerations[[slot]].consumers[[index]].state =361 BundleConsumerDependency_Cancelled;362 _LocalGenerations[[slot]].consumers[[index]].valid = FALSE;363 end;364 end;365 if writers_left == 0 && _LocalGenerations[[slot]].open then366 AbortBundleLocalGeneration(367 _LocalGenerations[[slot]].destination_hand,368 _LocalGenerations[[slot]].participant_mask);369 end;370 end;371end;372
373374375376377378func EnterBundleExecutionDomainSquashEvent(domain: integer)379begin380 SquashBundleExecutionDomain(domain);381end;382
383func BundleHasAssembleModifier() => boolean384begin385 for binding = 0 to PTO_BUNDLE_TILE_BINDING_COUNT - 1 do386 if _BundleTileBindings[[binding]].valid &&387 _BundleTileBindings[[binding]].destination_assemble.valid then388 return TRUE;389 end;390 end;391 return FALSE;392end;393
394pure func BundleProducerEffectClassOfHandler(395 handler: TileSemanticHandler) => BundleProducerEffectClass396begin397 case handler of398 when TileHandler_ExecuteTileBinary,399 TileHandler_ExecuteTileCompare,400 TileHandler_ExecuteTileCompareScalar,401 TileHandler_ExecuteTileExpand,402 TileHandler_ExecuteTileFillScalar,403 TileHandler_ExecuteTileReduction,404 TileHandler_ExecuteTileScalar,405 TileHandler_ExecuteTileSelect,406 TileHandler_ExecuteTileSelectScalar,407 TileHandler_ExecuteTileUnary,408 TileHandler_GMOV,409 TileHandler_MGATHER,410 TileHandler_MGATHER_MASK,411 TileHandler_TCI,412 TileHandler_TCONCAT,413 TileHandler_TCVT,414 TileHandler_TDEQUANT,415 TileHandler_TEXTRACT,416 TileHandler_TFMA,417 TileHandler_TGATHER,418 TileHandler_THISTOGRAM,419 TileHandler_TIMG2COL,420 TileHandler_TINSERT,421 TileHandler_TLOAD,422 TileHandler_TMOV,423 TileHandler_TMRGSORT,424 TileHandler_TQUANT,425 TileHandler_TSORT,426 TileHandler_TPERMUTE,427 TileHandler_TSHUF,428 TileHandler_TPACK,429 TileHandler_TUNPACK,430 TileHandler_TTRI =>431 return BundleProducerEffect_RollbackSafe;432 when TileHandler_MGATHER_CAS,433 TileHandler_MSCATTER,434 TileHandler_MSCATTER_MASK,435 TileHandler_TPREFETCH,436 TileHandler_TSCATTER,437 TileHandler_TSTORE =>438 return BundleProducerEffect_NonRollbackAuxiliary;439 when TileHandler_TGEMV, TileHandler_TGEMV_ACC,440 TileHandler_TGEMV_BIAS, TileHandler_TGEMV_MX,441 TileHandler_TGEMV_MX_ACC, TileHandler_TGEMV_MX_BIAS,442 TileHandler_TMATMUL, TileHandler_TMATMUL_ACC,443 TileHandler_TMATMUL_BIAS, TileHandler_TMATMUL_MX,444 TileHandler_TMATMUL_MX_ACC, TileHandler_TMATMUL_MX_BIAS =>445 return BundleProducerEffect_AtomicAuxiliary;446 end;447end;448
449pure func BundleProducerEffectClassOfOperation(450 operation: integer {0..PTO_TILE_OPERATION_COUNT-1})451 => BundleProducerEffectClass452begin453 return BundleProducerEffectClassOfHandler(TileHandlerOfIndex(operation));454end;455
456func BundleProducerEffectEligible(457 operation: integer {0..PTO_TILE_OPERATION_COUNT-1}) => boolean458begin459 if !BundleHasAssembleModifier() then return TRUE; end;460 if BundleProducerEffectClassOfOperation(operation) ==461 BundleProducerEffect_NonRollbackAuxiliary then462 SetFault(Fault_TileLegality, ReadTPC());463 return FALSE;464 end;465 return TRUE;466end;467