Repository navigation
[CI] The base image is the compiler's published image at the pin, plus the test stack - #332
Merged
Merged
Conversation
…s the test stack PyTorchSim-Triton-Backend publishes an image per commit (images.yml: ghcr.io/psal-postech/pytorchsim-triton-backend:<sha>), built on the vcix-accelerator environment image -- Ubuntu 22.04 with python3.11, the RISC-V toolchain, pk, Spike, gem5 -- with LLVM, Triton and the torchsim backend, the model, the compiler, its dialect and extension, doctor and smoke passed. This repository's CI ignored it: Dockerfile.ptb cloned the compiler at the pin and ran toolchain.sh llvm triton vcixenv vcix dialect ext, building all of that again from source, on top of a base image that itself installed python3.11 and torch on a bare Ubuntu. A moved pin cost an hour of toolchain build before the first test could run, and the clone needed a token for the private repository, which is what stopped #331's first gated run. Dockerfile.base is now FROM the compiler's image at the pin, adding only `python`, boost, PyTorch 2.14 / torchvision 0.29 (CPU) and the packages the tests import, and the environment the compiler route reads (TORCHSIM_COMPILE_DIR, the Triton source tree on PYTHONPATH, the extension, gem5). Its tag hashes the compiler pin as well, so a moved pin rebuilds it; nothing of the compiler is built here. Dockerfile.ptb and ptb_base_pin.sh go, as do the "Check PTB access" job and every use of a token: the compiler's package grants this repository read access, and the default Actions token pulls it. The app image removes the compiler's PyTorchSim checkout before copying the tree under test to the same path, so the compiler's trace producer reads this tree's TOGSim headers. The base job moves to the big self-hosted runner, where a ~10 GB image fits. pytorchsim_triton_backend.yml gates PRs into pytorchsim-triton-backend as well, and watches Dockerfile.base in place of Dockerfile.ptb.
student-Jungmin
force-pushed
the
ci-ptb-token
branch
from
October 9, 2026 16:29
12b74bf to
c46dfd4
Compare
A missing image and a denied one print the same one-line error; docker's own message (manifest unknown vs denied) tells them apart, so it is shown.
The compiler's image is pushed by buildx in OCI format, and the big runner's docker CLI answers docker manifest inspect with "parsing manifest blob" on it -- which read as "not in the registry" although the image was there and readable. The propagation wait already uses imagetools inspect; both existence checks do now, the base image's included, since build-push-action pushes OCI too and the check would have rebuilt a base that existed.
torch.hub.load asks on stdin whether ultralytics/yolov5 may be downloaded the first time a machine sees it; a CI container has no stdin and the test died with EOFError before compiling anything (the box this was written on had already answered once). trust_repo=True is the answer.
… tail on failure It was sent to /dev/null, so a failing run_cycle.sh left "exit code 1" and nothing else in the job log.
The compiler's failure report names the reason as the failing tool's last output line. For an MLIR diagnostic that line is the caret under the source, so Inductor reported "command failed with exit code 1: ^" and nothing else (the cycle-validation job's gemm 256 in CI). The stderr block the report prints below is where the diagnostic is; its lines that look like one (error:, *Error, Assertion, a refusal) now follow the reason line, at most two of them.
PyTorchSim-Triton-Backend compiles with Triton 3.8 unmodified, whose frontend refuses any block tensor over TRITON_MAX_TENSOR_NUMEL (1 << 20 elements) before MLIR exists. The mm tile candidates were bounded by the scratchpad alone, and on the 256x256 tpuv6e machine half the scratchpad holds blocks of 4M and 8M elements: test_gpt2's addmm (BLOCK_N=4096 x BLOCK_K=1024) and test_mistral's mm (8388608 elements) failed in CI with "numel exceeds triton maximum tensor numel". They passed on the development machine only because its Triton checkout carries a local edit raising the limit to 1 << 26 (2026-10-08, for the v6e rig). The limit is read from the Triton the route compiles with (triton._utils), so a toolchain that raised it is followed. Three places honour it: the mm tile candidates drop any tile whose A, B or C block exceeds it; fixed_config_for caps a reduction block so that the product of all pinned blocks fits (a bf16 reduction of 8192 on 256 lanes is 2M elements); and the compile retry loop treats the refusal as a tile too big, so a kernel that still exceeds it tries the next smaller tile instead of failing. Persistent reductions are unaffected: the persistence check already admits only blocks of 512 or less. Verified under the stock limit (a Triton overlay with 1 << 20 in a toolchain prefix overlay): test_gpt2 and test_mistral fail without this commit the way CI did and pass with it (gpt2 55 s, mistral 93 s); test_gpt2's addmm now picks BLOCK_N=4096 x BLOCK_K=256. With the local 1 << 26 the candidates are unchanged.
Every push leaves another torchsim-test:<sha> image (and every moved pin
another torchsim_base tag) on each self-hosted runner that pulled or built
it, and nothing removed them. In run 37981364816 a small runner reached 87 MB
of free disk and test_transformer failed before the test started: the pull
died with exit 125 ("writing blob: adding layer ... processing tar file").
The run before it lost test_transformer on the same config the same way.
Each test job, the cycle-validation job and the three image-build jobs now
remove this repository's images other than the one they are about to use
(the test image for a test job, the base image for a build), prune dangling
layers and print the free space. Images of other repositories on the runner
are left alone; an image in use by another container is refused by rmi and
kept.
…ost path returns every out tensor test_yolov5 failed on every config in the gate with "Object of type 'Tensor' is not an instance of 'sequence'" from an eager max_pool2d: YOLOv5's SPPF wraps its pooling in warnings.catch_warnings(), dynamo breaks the graph there, and the pooling runs eagerly on a tensor the compiled graph produced. Dynamo's frame hook then met the Python kernel registered for aten::max_pool2d_with_indices.out and, since it is not a torch frame, traced it as user code (TORCH_LOGS=trace_source shows the wrapper's lines as frame 1/0). Inside a traced frame torch.compiler.is_compiling() is a constant True, so the compile-in-flight guard chose the host path and dynamo compiled THAT: copies to the CPU, the op on the CPU, copies back. A CPU fallback for every eager op reached from a compiled model, and for this two-output op a single Tensor returned where the dispatcher expects both outputs, which is the error. The same guard was green on the development machine because the sweep that validated it predates the guard's commit. The kernel is now torch.compiler.disable'd: dynamo leaves it alone, it runs eagerly, the guard evaluates the real flag (True only inside a compile session, which is the constant-folding case it was written for), and the op compiles through dummy_graph as before. The host path writes and returns every out tensor the schema names (out and indices for max_pool2d, max and max_values for max.dim) instead of the first. Verified with the frontend's torch 2.14.0 and the compiler at a901c55: test_yolov5 on the 256x256 and 32x32 configs, test_swinv2 (the constant folded during compile that motivated the guard), test_mlp, test_eager, test_eager_to_compile_recursion and test_expert_mask pass; a module with the SPPF pattern compiles its pooling as an npu kernel.
…e loses every unused image Removing this repository's older images was not enough: in run 37994502339 node n01 still had 14 GB free afterwards (210 of 223 GB used by images of other repositories and leftovers of pulls that had already failed for lack of space), test_convnextv2's pull died at 3 MB free, and test_diffusion on the same node ended after 42 minutes with no log at all. When fewer than 40 GB are free after the repository's own cleanup, the job now also prunes every stopped container and every unused image on the runner, whatever repository they belong to; an image in use by a running container is kept. The step prints the free space and the largest images left so the next log says what occupies a node.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI builds its base image FROM the compiler's own published image at the pin (
ghcr.io/psal-postech/pytorchsim-triton-backend:<sha>, one tag per commit from PyTorchSim-Triton-Backend'simages.yml), adding only PyTorch and the test stack. Nothing of the compiler, LLVM, Triton, Spike or gem5 is built here any more.Before:
Dockerfile.ptbcloned the compiler at the pin and rantoolchain.sh llvm triton vcixenv vcix dialect extfrom source on top of a base that installed python3.11 and torch on bare Ubuntu -- about an hour before the first test, and a token for the private clone (which is what stopped #331's first gated run).Now:
Dockerfile.base:FROM ${PTB_IMAGE}+python, boost, torch 2.14 / torchvision 0.29 (CPU), the test packages, and the route's environment variables;doctorat the end. Tag = hash of the compiler pin + this file +github-releases.json, so a moved pin rebuilds it.Dockerfile: removes the compiler's own PyTorchSim checkout before copying the tree under test to/workspace/PyTorchSim(the compiler reads TOGSim headers from there when building a trace producer).Check PTB accessjob and the toolchain-layer job are gone from all three;ensure-baseruns on the big self-hosted runner (the compiler image is ~10 GB) and checks that the compiler has published an image for the pin before building. No token anywhere: the compiler's package grants this repository read access.pytorchsim_triton_backend.ymlalso gates PRs intopytorchsim-triton-backend.To verify here: this PR's own run. First
ensure-basebuilds the new base once (pull + pip, minutes), then the app image and the 43-test matrix.What the first gated run found
The first run on the new base (26a0e43) built both images on the compiler's image and ran the matrix. Two frontend fixes came out of it, in this PR because the gate is what found them and what verifies them:
[Codegen] Blocks stay within what Triton accepts. test_gpt2 and test_mistral failed on the 256x256 config withnumel (4194304) exceeds triton maximum tensor numel (1048576): the mm tile candidates were bounded by the scratchpad alone, and the compiler's image runs Triton 3.8 unmodified. They passed locally only because the development machine's Triton checkout carries an uncommitted edit raising the limit to 1 << 26 (made 2026-10-08 for the v6e rig). The frontend now readsTRITON_MAX_TENSOR_NUMELfrom the Triton it compiles with and keeps every pinned block under it (mm tiles, reduction blocks, and the compile retry loop treats the refusal as a tile too big). Verified under the stock limit with a Triton overlay: both tests fail without the commit as CI did and pass with it. Whether PyTorchSim-Triton-Backend should raise Triton's limit in its ownsetup/triton.shso that the v6e tiles compile everywhere is a compiler-side decision this PR does not take.[Codegen] CompilerError carries the stage's stderr diagnostics. The cycle-validation job (not a gate) failed at gemm 256 with onlycommand failed with exit code 1: ^-- the compiler's reason line is the failing tool's last output line, a caret for an MLIR diagnostic. The error lines of the stderr block now follow it, so the next run names the failure.CI builds its base image FROM the compiler's own published image at the pin (ghcr.io/psal-postech/pytorchsim-triton-backend:<sha>, one tag per commit from PyTorchSim-Triton-Backend'simages.yml), adding only PyTorch and the test stack. Nothing of the compiler, LLVM, Triton, Spike or gem5 is built here any more.Before:
Dockerfile.ptbcloned the compiler at the pin and rantoolchain.sh llvm triton vcixenv vcix dialect extfrom source on top of a base that installed python3.11 and torch on bare Ubuntu -- about an hour before the first test, and a token for the private clone (which is what stopped #331's first gated run).Now:
Dockerfile.base:FROM ${PTB_IMAGE}+python, boost, torch 2.14 / torchvision 0.29 (CPU), the test packages, and the route's environment variables;doctorat the end. Tag = hash of the compiler pin + this file +github-releases.json, so a moved pin rebuilds it.Dockerfile: removes the compiler's own PyTorchSim checkout before copying the tree under test to/workspace/PyTorchSim(the compiler reads TOGSim headers from there when building a trace producer).Check PTB accessjob and the toolchain-layer job are gone from all three;ensure-baseruns on the big self-hosted runner (the compiler image is ~10 GB) and checks that the compiler has published an image for the pin before building. No token anywhere: the compiler's package grants this repository read access.pytorchsim_triton_backend.ymlalso gates PRs intopytorchsim-triton-backend.To verify here: this PR's own run. First
ensure-basebuilds the new base once (pull + pip, minutes), then the app image and the 43-test matrix.What the first gated run found
The first run on the new base (26a0e43) built both images on the compiler's image and ran the matrix. Two frontend fixes came out of it, in this PR because the gate is what found them and what verifies them:
[Codegen] Blocks stay within what Triton accepts. test_gpt2 and test_mistral failed on the 256x256 config withnumel (4194304) exceeds triton maximum tensor numel (1048576): the mm tile candidates were bounded by the scratchpad alone, and the compiler's image runs Triton 3.8 unmodified. They passed locally only because the development machine's Triton checkout carries an uncommitted edit raising the limit to 1 << 26 (made 2026-10-08 for the v6e rig). The frontend now readsTRITON_MAX_TENSOR_NUMELfrom the Triton it compiles with and keeps every pinned block under it (mm tiles, reduction blocks, and the compile retry loop treats the refusal as a tile too big). Verified under the stock limit with a Triton overlay: both tests fail without the commit as CI did and pass with it. Whether PyTorchSim-Triton-Backend should raise Triton's limit in its ownsetup/triton.shso that the v6e tiles compile everywhere is a compiler-side decision this PR does not take.[Codegen] CompilerError carries the stage's stderr diagnostics. The cycle-validation job (not a gate) failed at gemm 256 with onlycommand failed with exit code 1: ^-- the compiler's reason line is the failing tool's last output line, a caret for an MLIR diagnostic. The error lines of the stderr block now follow it, so the next run names the failure.[CI] A job removes this repository's older images from its runner first. The second run lost test_transformer on the 8x8 config before the test started: that small runner had 87 MB of disk left and the image pull died with exit 125. Every push leaves anothertorchsim-test:<sha>image on each runner that pulled or built it, and nothing removed them. Each test job, the cycle-validation job and the image-build jobs now remove this repository's images other than the one they are about to use and prune dangling layers; when fewer than 40 GB are free after that (node n01 still had 14 GB, mostly other repositories' images and leftovers of pulls that had already failed), they also prune every unused image and stopped container on the runner, then print the free space and the largest images left.[Device] Dynamo does not trace the eager_to_compile kernel, and the host path returns every out tensor. test_yolov5 failed on every config (Object of type 'Tensor' is not an instance of 'sequence'from an eager max_pool2d): SPPF's pooling sits underwarnings.catch_warnings(), dynamo breaks the graph there, and the pooling runs eagerly; dynamo's frame hook then traced the Python kernel registered formax_pool2d_with_indices.outas user code, wheretorch.compiler.is_compiling()is a constant True, so the compile-in-flight guard's host path was compiled into the graph -- a CPU fallback for every eager op reached from a compiled model, and a single Tensor returned for a two-output op. The kernel is nowtorch.compiler.disabled (the guard reads the real flag, True only inside a compile session), and the host path returns every out tensor the schema names. Verified: yolov5 on 256x256 and 32x32, swinv2, mlp, eager, eager_to_compile_recursion, expert_mask.Also: test_yolov5 passes
trust_repo=Truetotorch.hub.load(the hub's prompt read EOF under CI), and the cycle-validation step keepsrun_cycle.sh's log and shows its tail on failure.