Skip to content

Tensors at the addresses tog_tensor_addrs.txt gives (version 1.1.0) - #70

Merged
student-Jungmin merged 2 commits into
mainfrom
pr/tog-tensor-addrs
Nov 10, 2026
Merged

student-Jungmin merged 2 commits into
mainfrom
pr/tog-tensor-addrs

Conversation

@student-Jungmin

Copy link
Copy Markdown
Collaborator

Summary

A launch's tensors sit in TOGSim's DRAM at the addresses PyTorchSim's device allocator gave them, read from tog_tensor_addrs.txt beside tog.so, instead of being laid out back to back. Version goes to 1.1.0, and the sidecar files beside tog.so are renamed for what they hold; an older name is refused rather than silently ignored.

Commits

  • A launch's tensors sit at the addresses tog_tensor_addrs.txt gives, and the version is 1.1.0
  • The sidecars beside tog.so are named for what they hold, and the old names are refused

Order

Merge first: PyTorchSim-Triton-Backend's tensor-placement PR pins this, and PyTorchSim's DRAM-placement PR needs both.

… gives, and the version is 1.1.0

Every launch laid its tensor arguments out from address 0 in argument order (tog_tensor_bases), again for each
launch. In one session two tensors then shared an address, a value one kernel wrote showed up at another address
in the next kernel, and the DRAM channel hashing and the L2 saw a layout no device has.

tog_tensor_addrs.txt beside tog.so now gives each tensor argument its DRAM base: one line per argument, in
argument order, "name addr bytes align role", addr in bytes. TOGSim takes column 2 as the base (and as a tiled
tensor's TensorTiling base). It refuses a file whose line count or bytes disagree with tog_tensors.txt, or a
malformed line, and warns once when a tiled tensor's padded footprint reaches another listed tensor its own
bytes do not already overlap (arguments aliasing one storage overlap by their bytes, which is not this). Without
the file the layout from 0 is kept. Each launch logs which layout it used at info level.

tog_tensors.txt keeps its one column, so older producers and parsers read it as before.

The version goes to 1.1.0, and Simulator --version prints it alone and exits 0, so a producer can refuse a
TOGSim that would ignore the file. TOGs and records of 1.0.0 are still accepted (same MAJOR, not newer);
tests/abi pins that, and its newer-minor refusal moves to 1.2.0.

tests/placement pins the contract: two kernels of one session with X at one address in both files, every request
in its tensor's range and the second kernel reading exactly the addresses the first wrote; the layout from 0
without the file; the three refusals; the footprint warning and its quiet control; --version. Built at 1f05af9,
7 of these 8 fail (the quiet control passes; the layout from 0 fails for its log line alone). The info
line is added to examples/hello/expected.txt and the two tests/outputs goldens, and the expected version in
the runtime attribute refusals is now VERSION. tests/run.py: 306 of 306 pass.

The docs (compatibility.md, tog-abi.md, examples/README.md) still say 1.0.0 and do not list the new file.

PyTorchSim writes the file per launch from its device allocator (branch feat/tensor-placement), and needs this.
… the old names are refused

Four of the files a TOG directory carries said only that they belong to the TOG, not what is in them:

  tog_shape.txt   -> tog_shape_args.txt    the shape_args togsim_kernel is handed (grid extents, then scalars)
  tog_tensors.txt -> tog_tensor_bytes.txt  each tensor argument's byte size
  tog_cycles.tsv  -> tog_tile_cycles.tsv   each tile's cycles and overlapping cycles
  tog_units.tsv   -> tog_unit_table.tsv    the --unit_table rows

tog.so, tog_tensor_shapes.txt and tog_tensor_addrs.txt keep their names. A directory that still has a file under
its old name and not under the new one is refused before it is loaded (refuse_renamed_sidecars, exit 1), naming
both, so a producer that has not moved is told why instead of running without its table or its sizes. This ships
in 1.1.0 with tog_tensor_addrs.txt; the version is not moved again.

The examples' files are renamed, and every source, test, document and README line that names them follows, since
tests/examples checks that the documents quote the examples. tests/placement old_sidecar_name_refused pins the
refusal: a directory with tog_units.tsv and no tog_unit_table.tsv. tests/run.py: 307 of 307 pass.

PyTorchSim and PyTorchSim-Triton-Backend write and read the new names on their dram-trace branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant