ATLang is the ATLAS-owned, simulator-only implementation of the programming interface shared with the TileLang frontend. It avoids TileLang, TVM, and TIR runtime dependencies while preserving the operator programming model needed by ATLAS. The implementation is divided into four ownership layers: public language, neutral IR, AST capture, and simulator backend.
frontend/ops/atlang operator source
-> frontend/atlang/language public objects and calls
-> frontend/atlang/capture Python AST replay
-> frontend/atlang/ir SimulatorMetadataSnapshot / AtlangKernel
-> frontend/atlang/simulator cloud or edge extraction
-> data_placement.yaml + operator_description.yaml + simulator logs
-> atlasim cycle simulation
@A.main starts this flow. It parses the decorated function, builds an
AtlangKernel shell, and runs extraction immediately when a captured
system_config is present. Final latency, energy, generated paths, placement,
task, and communication fields are attached to that shell.
frontend/atlang/language/ owns syntax visible to operator authors:
entry.py:A.mainand the parser entry.objects.py:Tensor,Buffer,CoreArray,SPMD,MPMD, andKernelcontext objects.control.py:Serialand host-range handling.memory.py:alloc,copy,fill, andclear.gemm.py: matrix-compute calls.vector.pyandreduction.py: element-wise, scalar, and reduction helpers.communication.py:sendandrecv.math.py: symbolic helpers such asceildivandinfinity.__init__.py: the supportedimport frontend.atlang.language as Asurface.
Add or change user-visible call signatures here. Reject unsupported arguments at this boundary instead of silently storing backend-only metadata.
frontend/atlang/ir/ defines structures shared by capture and extraction:
dtype.py: dtype registry and byte-size semantics.expr.py: symbols, calls, arithmetic, comparisons, and substitution/walk helpers for captured expressions.nodes.py: tensor declarations/accesses, actions, loops, kernel regions, operator regions, core-array contexts, metadata snapshots, and extraction result fields.kernel.py: theAtlangKernelshell and extraction-result attachment.
New simulator-independent semantics belong in this layer. Keep backend paths, YAML formatting, and cloud/edge policy out of neutral IR dataclasses.
frontend/atlang/capture/ converts inspectable Python source into the neutral
IR:
source.pyloads and validates decorated function source.parser.pyis the public parse orchestration entry.replay.pyevaluates supported expressions and statements in source order.frame.pymaintains active core-array/operator/kernel/loop state, validates declarations, and constructs the kernel snapshot.access.pynormalizes tensor and local-buffer windows intoTensorAccess.actions.pylowers memory, compute, reduction, and communication calls intoOpActionrecords.
When adding syntax, decide whether it creates a value/expression, a structural region, or a modeled action. Extend replay and the corresponding normalization module, then emit neutral IR; do not invoke simulator code from the parser.
frontend/atlang/simulator/ translates captured IR into current ATLAS
simulator inputs:
extract.pyselects cloud, edge, or general extraction.io.pyprovides plain-YAML conversion, process-output redirection, and safe multiprocessing helpers.common/owns shared symbolic evaluation, tensor layout, DRAM/NoC task helpers, system checks, general task materialization, and general autotune.cloud/owns cloud placement, GEMM, decode attention, communication, task descriptions, and final kernel execution/aggregation.edge/owns edge placement, GEMM cache/DSE, task descriptions, softmax and channel overheads, and final kernel execution/aggregation.
Cloud- or edge-specific behavior should remain in its respective directory.
Only semantics genuinely shared by both paths belong in common/.
frontend/ops/atlang/ is the source of truth for user programs:
cloud.py: transformer-layer execution on the 4x4 cloud mesh.edge.py: edge GEMM/attention execution and channel behavior.general_spmd.py: fixed and autotuned general SPMD examples.general_mpmd.py: fixed and autotuned static core-group MPMD examples.
tests/inference_test_atlang.py is the end-to-end regression entry.
- Add the user-facing object or function under
language/and export it fromlanguage/__init__.py. - Add neutral IR fields or node types under
ir/only when existing records cannot represent the new semantics. - Teach
capture/replay.py,capture/access.py, orcapture/actions.pyto lower the source construct without backend dependencies. - Materialize the new IR in
simulator/common/,simulator/cloud/, orsimulator/edge/according to ownership. - Add a focused operator example under
frontend/ops/atlang/and validate it through the appropriate inference test. - Keep source semantics explicit. Do not repair an incorrectly described operator with extractor-side name remapping or hidden aliases.