tensorbench commited on
Commit
0e74d35
·
0 Parent(s):

tensorbench dataset

Browse files
Files changed (6) hide show
  1. .gitattributes +60 -0
  2. Dockerfile +52 -0
  3. README.md +123 -0
  4. croissant.json +264 -0
  5. run_tests.sh +68 -0
  6. tensorbench.json +0 -0
.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV TZ=Etc/UTC
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV PYTHONDONTWRITEBYTECODE=1
7
+
8
+ # System dependencies for C++ extension compilation
9
+ RUN apt-get update && apt-get install -y \
10
+ git \
11
+ patch \
12
+ build-essential \
13
+ g++ \
14
+ cmake \
15
+ libgomp1 \
16
+ ninja-build \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ RUN pip install --upgrade pip
20
+
21
+ WORKDIR /testbed
22
+
23
+ # Full clone of the `bench` branch — every dataset base_commit lives on
24
+ # this branch, and a full (non-treeless, non-shallow) clone guarantees
25
+ # their trees are all locally available. A treeless or shallow clone
26
+ # would force git to lazy-fetch on the harness's per-task
27
+ # `git reset --hard <base_commit>`, and that fetch is flaky enough in
28
+ # CI sandboxes to silently leave the working tree on the wrong commit.
29
+ RUN git clone --branch bench https://github.com/bobbyyyan/scorch.git .
30
+
31
+ # Pre-create venv with CPU-only PyTorch so setup.sh's `pip install -r
32
+ # requirements.txt` (unpinned `torch`) sees the requirement as already
33
+ # satisfied. The default Linux torch wheel pulls in ~3.8GiB of CUDA libs
34
+ # (nvidia/, triton/, libtorch_cuda.so) that the 2-CPU Daytona sandboxes
35
+ # never use — the CPU wheel skips all of that.
36
+ RUN python3 -m venv venv && \
37
+ venv/bin/pip install --no-cache-dir --upgrade pip && \
38
+ venv/bin/pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch
39
+
40
+ # Run setup.sh to install remaining requirements and build the C++
41
+ # extension; then drop the pip cache (~2.7GiB, only needed during install).
42
+ RUN bash setup.sh && \
43
+ rm -rf /root/.cache
44
+
45
+ # Activate venv for subsequent commands
46
+ ENV PATH="/testbed/venv/bin:$PATH"
47
+ ENV VIRTUAL_ENV="/testbed/venv"
48
+
49
+ COPY run_tests.sh /testbed/run_tests.sh
50
+ RUN chmod +x /testbed/run_tests.sh
51
+
52
+ CMD ["/testbed/run_tests.sh"]
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - benchmark
9
+ - code
10
+ - llm-evaluation
11
+ - feature-addition
12
+ - python
13
+ size_categories:
14
+ - n<1K
15
+ configs:
16
+ - config_name: default
17
+ data_files:
18
+ - split: test
19
+ path: tensorbench.json
20
+ ---
21
+
22
+ # TensorBench
23
+
24
+ Feature-addition benchmark for LLMs and coding agents, evaluated against the
25
+ [Scorch](https://github.com/bobbyyyan/scorch) codebase. Each task asks a model
26
+ to add a feature (or otherwise extend functionality) to Scorch. Success is
27
+ defined as the full pytest suite (original + any new tests the model adds)
28
+ passing after the patch is applied inside a Docker container.
29
+
30
+ This is the dataset artifact for the TensorBench paper (NeurIPS 2026
31
+ Evaluations & Datasets track, double-blind submission).
32
+
33
+ ## At a glance
34
+
35
+ | | |
36
+ |---|---|
37
+ | Tasks | 199 (194 feature-addition, 5 refactor) |
38
+ | Target codebase | [`bobbyyyan/scorch`](https://github.com/bobbyyyan/scorch) — a sparse+dense PyTorch compiler |
39
+ | Base commits | 5 distinct SHAs across the `bench` branch |
40
+ | Language | Python (with C++ extension) |
41
+ | Test runner | `pytest -v` inside Docker |
42
+
43
+ ## Files
44
+
45
+ | File | Purpose |
46
+ |---|---|
47
+ | `tensorbench.json` | Task list. JSON array of 199 task records. |
48
+ | `Dockerfile` | Eval image: `python:3.11-slim` + Scorch's C++ build deps + the upstream `bench` clone. |
49
+ | `run_tests.sh` | Container `CMD`: rebuilds the C++ extension and runs `pytest`. |
50
+ | `croissant.json` | Croissant metadata (core + RAI fields). |
51
+
52
+ ## Task schema
53
+
54
+ Each record in `tensorbench.json` has:
55
+
56
+ | Field | Type | Description |
57
+ |---|---|---|
58
+ | `instance_id` | string | e.g. `bobbyyyan__scorch-feature_kernel_fusion`. The `feature_*` / `refactor_*` suffix follows the original taxonomy; semantics for both is feature-addition. |
59
+ | `repo_id` | string | `bobbyyyan__scorch` for every task. |
60
+ | `repo_url` | string | Upstream Scorch URL. |
61
+ | `base_commit` | string | The SHA the task is anchored at. The harness `git reset --hard`s to this before applying patches. |
62
+ | `language` | string | `python`. |
63
+ | `setup_commands` | list[string] | Container-side setup hooks. |
64
+ | `test_command` | string | `/testbed/run_tests.sh`. |
65
+ | `test_timeout` | int | Seconds. Default 3000. |
66
+ | `refactor_type` | string | Mostly empty (legacy field from the original taxonomy). |
67
+ | `description` | string | Natural-language task prompt the model receives. |
68
+ | `files` | list[string] | Files relevant to the task. |
69
+ | `task_type` | string | `feature` or `refactor`. |
70
+ | `categories` | list[string] | Topical tags (kernel, codegen, format, etc.). |
71
+
72
+ ## Grading
73
+
74
+ Run with `pytest -v`; the grading strategy parses verbose lines (preserving
75
+ parametrized brackets like `[False]`) and uses a custom preservation rule:
76
+
77
+ ```
78
+ success ⇔ after.failed == 0
79
+ ```
80
+
81
+ This handles the common case where an agent adds new tests alongside new
82
+ code: if every test (original + agent-added) passes, the task is a success.
83
+ Default exact-match preservation would flag the new tests as "changed" and
84
+ produce false failures.
85
+
86
+ ## How to evaluate a model
87
+
88
+ The full evaluation harness (`codebench`) and the project-local benchmark
89
+ glue (`tensorbench`) are in the supplementary code submission.
90
+
91
+ ```bash
92
+ # 1. Install the harness and benchmark glue
93
+ git clone <tensorbench-repo> ~/tensorbench
94
+ git clone <codebench-repo> ~/codebench
95
+ pip install -e ~/codebench
96
+ pip install -r ~/tensorbench/requirements.txt
97
+
98
+ # 2. Build the eval image
99
+ cd ~/tensorbench
100
+ docker build -t scorch-eval -f dockerfiles/scorch/Dockerfile dockerfiles/scorch/
101
+
102
+ # 3. Generate predictions, then grade them
103
+ python run.py predict scorch sonnet-4.5
104
+ python run.py eval scorch sonnet-4.5
105
+ ```
106
+
107
+ Predictions land in `predictions/`; eval outputs in `evaluation_results/<run_id>/`.
108
+
109
+ ## Anonymity
110
+
111
+ This is a double-blind submission. Personally identifying information has
112
+ been scrubbed from the supplementary code. Reviewers should not attempt to
113
+ identify the authors via the target codebase URL or other public references.
114
+
115
+ ## License
116
+
117
+ MIT for the benchmark scaffolding (this dataset, Dockerfile, grading
118
+ strategy). The target Scorch codebase is governed by its own upstream
119
+ license.
120
+
121
+ ## Citation
122
+
123
+ (Anonymized for double-blind review. Citation will be added at camera-ready.)
croissant.json ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "@context": {
3
+ "@language": "en",
4
+ "@vocab": "https://schema.org/",
5
+ "citeAs": "cr:citeAs",
6
+ "column": "cr:column",
7
+ "conformsTo": "dct:conformsTo",
8
+ "cr": "http://mlcommons.org/croissant/",
9
+ "rai": "http://mlcommons.org/croissant/RAI/",
10
+ "data": {
11
+ "@id": "cr:data",
12
+ "@type": "@json"
13
+ },
14
+ "dataType": {
15
+ "@id": "cr:dataType",
16
+ "@type": "@vocab"
17
+ },
18
+ "dct": "http://purl.org/dc/terms/",
19
+ "equivalentProperty": {
20
+ "@id": "cr:equivalentProperty",
21
+ "@type": "@vocab"
22
+ },
23
+ "samplingRate": "cr:samplingRate",
24
+ "examples": {
25
+ "@id": "cr:examples",
26
+ "@type": "@json"
27
+ },
28
+ "extract": "cr:extract",
29
+ "field": "cr:field",
30
+ "fileProperty": "cr:fileProperty",
31
+ "fileObject": "cr:fileObject",
32
+ "fileSet": "cr:fileSet",
33
+ "format": "cr:format",
34
+ "includes": "cr:includes",
35
+ "isLiveDataset": "cr:isLiveDataset",
36
+ "jsonPath": "cr:jsonPath",
37
+ "key": "cr:key",
38
+ "md5": "cr:md5",
39
+ "parentField": "cr:parentField",
40
+ "path": "cr:path",
41
+ "recordSet": "cr:recordSet",
42
+ "references": "cr:references",
43
+ "regex": "cr:regex",
44
+ "repeated": "cr:repeated",
45
+ "replace": "cr:replace",
46
+ "sc": "https://schema.org/",
47
+ "separator": "cr:separator",
48
+ "source": "cr:source",
49
+ "subField": "cr:subField",
50
+ "transform": "cr:transform"
51
+ },
52
+ "@type": "sc:Dataset",
53
+ "conformsTo": "http://mlcommons.org/croissant/1.0",
54
+ "name": "TensorBench",
55
+ "description": "Feature-addition benchmark for LLMs and coding agents, evaluated against the Scorch codebase (a sparse+dense PyTorch compiler). Each task asks a model to add a feature; success is the full pytest suite passing after the patch is applied inside a Docker container. 199 tasks total (194 feature-addition, 5 refactor) across 5 base commits on the upstream `bench` branch.",
56
+ "url": "https://huggingface.co/datasets/tensorbench/tensorbench-1.0",
57
+ "license": "https://opensource.org/licenses/MIT",
58
+ "version": "1.0.0",
59
+ "citeAs": "(Anonymized for double-blind review.)",
60
+ "datePublished": "2026-05-06",
61
+ "keywords": [
62
+ "benchmark",
63
+ "code-generation",
64
+ "llm-evaluation",
65
+ "feature-addition",
66
+ "python",
67
+ "pytorch",
68
+ "sparse-tensors"
69
+ ],
70
+ "rai:dataCollection": "Each task is a natural-language prompt paired with a `base_commit` SHA from the upstream Scorch repository's `bench` branch. Prompts were drafted with LLM assistance against the target codebase and then reviewed and curated by the authors. The upstream codebase, tests, and SHAs are pre-existing artifacts of the Scorch project.",
71
+ "rai:annotationsPerItem": "Each task has a single author-curated description and a fixed `base_commit`. There are no per-item human annotations beyond the prompt itself; success is computed automatically by running the patched repo's pytest suite.",
72
+ "rai:dataLimitations": "All tasks target a single Python codebase (Scorch). Performance does not generalize across languages or unrelated repositories. Test suites authored by the agent are accepted at face value, which can permit a small number of vacuous tests; the paper's adversarial-behavior audit (see supplementary code) characterizes this rate. Container builds depend on a network clone of the upstream repository and may be affected by upstream availability.",
73
+ "rai:dataBiases": "All tasks were curated by the same set of authors. The category distribution skews toward runtime/dispatch, scheduler/loop transformations, linear-algebra ops, sparse formats, and IR/codegen surface area — i.e. the parts of a sparse-tensor compiler the authors found tractable to specify. Because prompts were drafted with LLM assistance, phrasing and structure also reflect the drafting model's stylistic patterns. The benchmark therefore measures a slice of `extend an existing PyTorch-extension codebase`-style work, not all of `software engineering with LLMs`.",
74
+ "rai:dataUseCases": "Evaluating coding agents and LLMs on extending a real, non-trivial Python+C++ codebase. Useful for: comparing agent frameworks (e.g. Claude Code, OpenAI Codex CLI, Gemini CLI, OpenHands), comparing model capabilities at fixed agent harness, and characterizing failure modes (test fail, patch apply fail, timeout, empty patch, vacuous added tests).",
75
+ "rai:personalSensitiveInformation": "None. Tasks describe code changes; no human-subject data is involved.",
76
+ "rai:dataSocialImpact": "The benchmark is intended for AI/ML research on code-generation evaluation. It does not target sensitive domains (medical, legal, financial). Like other code-evaluation benchmarks, it could in principle be used to filter or rank developers, which is not its intended use.",
77
+ "rai:hasSyntheticData": "Task prompts were drafted with LLM assistance against the target codebase and then reviewed and curated by the authors. The underlying `base_commit` SHAs, source code, and pytest infrastructure are pre-existing upstream artifacts and were not generated.",
78
+ "rai:dataReleaseMaintenancePlan": "The dataset will be made public under the authors' real names at the camera-ready deadline. Future revisions will be tagged via the `version` field. Bug reports and corrections will be tracked on the public repository.",
79
+ "distribution": [
80
+ {
81
+ "@type": "cr:FileObject",
82
+ "@id": "tensorbench.json",
83
+ "name": "tensorbench.json",
84
+ "description": "JSON array of 199 task records.",
85
+ "contentUrl": "https://huggingface.co/datasets/tensorbench/tensorbench-1.0/resolve/main/tensorbench.json",
86
+ "encodingFormat": "application/json",
87
+ "sha256": "41b9cf73e37f8458990584a21882575040c360d08935c135eedfc5f474d155f7"
88
+ },
89
+ {
90
+ "@type": "cr:FileObject",
91
+ "@id": "Dockerfile",
92
+ "name": "Dockerfile",
93
+ "description": "Eval image: python:3.11-slim plus Scorch's C++ build deps and a clone of the upstream `bench` branch.",
94
+ "contentUrl": "https://huggingface.co/datasets/tensorbench/tensorbench-1.0/resolve/main/Dockerfile",
95
+ "encodingFormat": "text/plain",
96
+ "sha256": "130e9738bd764e26f5b655d9e3b72fcfc4c7d9df9687cead2b7d53b930289873"
97
+ },
98
+ {
99
+ "@type": "cr:FileObject",
100
+ "@id": "run_tests.sh",
101
+ "name": "run_tests.sh",
102
+ "description": "Container CMD: rebuild the C++ extension and run pytest -v.",
103
+ "contentUrl": "https://huggingface.co/datasets/tensorbench/tensorbench-1.0/resolve/main/run_tests.sh",
104
+ "encodingFormat": "application/x-sh",
105
+ "sha256": "5bcab82be4065de1002995baea922492ba77063f52f4da191df2bf8d23096dc1"
106
+ }
107
+ ],
108
+ "recordSet": [
109
+ {
110
+ "@type": "cr:RecordSet",
111
+ "@id": "tasks",
112
+ "name": "tasks",
113
+ "description": "One record per benchmark task.",
114
+ "field": [
115
+ {
116
+ "@type": "cr:Field",
117
+ "@id": "tasks/instance_id",
118
+ "name": "instance_id",
119
+ "description": "Unique task id, e.g. bobbyyyan__scorch-feature_kernel_fusion. The feature_/refactor_ suffix follows the original taxonomy; semantics for both is feature-addition.",
120
+ "dataType": "sc:Text",
121
+ "source": {
122
+ "fileObject": {"@id": "tensorbench.json"},
123
+ "extract": {"jsonPath": "$[*].instance_id"}
124
+ }
125
+ },
126
+ {
127
+ "@type": "cr:Field",
128
+ "@id": "tasks/repo_id",
129
+ "name": "repo_id",
130
+ "description": "Always bobbyyyan__scorch — used by the grading registry to route to the project-specific strategy.",
131
+ "dataType": "sc:Text",
132
+ "source": {
133
+ "fileObject": {"@id": "tensorbench.json"},
134
+ "extract": {"jsonPath": "$[*].repo_id"}
135
+ }
136
+ },
137
+ {
138
+ "@type": "cr:Field",
139
+ "@id": "tasks/repo_url",
140
+ "name": "repo_url",
141
+ "description": "Git clone URL for the upstream Scorch repository. Identical for every task: https://github.com/bobbyyyan/scorch.git",
142
+ "dataType": "sc:URL",
143
+ "source": {
144
+ "fileObject": {"@id": "tensorbench.json"},
145
+ "extract": {"jsonPath": "$[*].repo_url"}
146
+ }
147
+ },
148
+ {
149
+ "@type": "cr:Field",
150
+ "@id": "tasks/base_commit",
151
+ "name": "base_commit",
152
+ "description": "Commit SHA the task is anchored at. The harness git reset --hards to this before applying patches.",
153
+ "dataType": "sc:Text",
154
+ "source": {
155
+ "fileObject": {"@id": "tensorbench.json"},
156
+ "extract": {"jsonPath": "$[*].base_commit"}
157
+ }
158
+ },
159
+ {
160
+ "@type": "cr:Field",
161
+ "@id": "tasks/language",
162
+ "name": "language",
163
+ "description": "Source language. Always python for this dataset.",
164
+ "dataType": "sc:Text",
165
+ "source": {
166
+ "fileObject": {"@id": "tensorbench.json"},
167
+ "extract": {"jsonPath": "$[*].language"}
168
+ }
169
+ },
170
+ {
171
+ "@type": "cr:Field",
172
+ "@id": "tasks/setup_commands",
173
+ "name": "setup_commands",
174
+ "description": "Optional list of shell commands run inside the container before the test command. Empty for all current Scorch tasks (setup is baked into the Docker image); the field is present for harness compatibility with other consumers.",
175
+ "dataType": "sc:Text",
176
+ "repeated": true,
177
+ "source": {
178
+ "fileObject": {"@id": "tensorbench.json"},
179
+ "extract": {"jsonPath": "$[*].setup_commands"}
180
+ }
181
+ },
182
+ {
183
+ "@type": "cr:Field",
184
+ "@id": "tasks/test_command",
185
+ "name": "test_command",
186
+ "description": "Shell command that runs the pytest suite (typically /testbed/run_tests.sh).",
187
+ "dataType": "sc:Text",
188
+ "source": {
189
+ "fileObject": {"@id": "tensorbench.json"},
190
+ "extract": {"jsonPath": "$[*].test_command"}
191
+ }
192
+ },
193
+ {
194
+ "@type": "cr:Field",
195
+ "@id": "tasks/test_timeout",
196
+ "name": "test_timeout",
197
+ "description": "Test-runner timeout in seconds. 3000 for every current task.",
198
+ "dataType": "sc:Integer",
199
+ "source": {
200
+ "fileObject": {"@id": "tensorbench.json"},
201
+ "extract": {"jsonPath": "$[*].test_timeout"}
202
+ }
203
+ },
204
+ {
205
+ "@type": "cr:Field",
206
+ "@id": "tasks/refactor_type",
207
+ "name": "refactor_type",
208
+ "description": "Mostly empty (legacy field from the original taxonomy; only a handful of tasks have extract/consolidate populated).",
209
+ "dataType": "sc:Text",
210
+ "source": {
211
+ "fileObject": {"@id": "tensorbench.json"},
212
+ "extract": {"jsonPath": "$[*].refactor_type"}
213
+ }
214
+ },
215
+ {
216
+ "@type": "cr:Field",
217
+ "@id": "tasks/description",
218
+ "name": "description",
219
+ "description": "Natural-language task prompt the model receives.",
220
+ "dataType": "sc:Text",
221
+ "source": {
222
+ "fileObject": {"@id": "tensorbench.json"},
223
+ "extract": {"jsonPath": "$[*].description"}
224
+ }
225
+ },
226
+ {
227
+ "@type": "cr:Field",
228
+ "@id": "tasks/files",
229
+ "name": "files",
230
+ "description": "Optional list of upstream-codebase files relevant to the task, surfaced as a hint to the model. Empty for all current Scorch tasks; the field is present for harness compatibility with other consumers.",
231
+ "dataType": "sc:Text",
232
+ "repeated": true,
233
+ "source": {
234
+ "fileObject": {"@id": "tensorbench.json"},
235
+ "extract": {"jsonPath": "$[*].files"}
236
+ }
237
+ },
238
+ {
239
+ "@type": "cr:Field",
240
+ "@id": "tasks/task_type",
241
+ "name": "task_type",
242
+ "description": "feature or refactor. Both are evaluated as feature-addition (success = pytest passes).",
243
+ "dataType": "sc:Text",
244
+ "source": {
245
+ "fileObject": {"@id": "tensorbench.json"},
246
+ "extract": {"jsonPath": "$[*].task_type"}
247
+ }
248
+ },
249
+ {
250
+ "@type": "cr:Field",
251
+ "@id": "tasks/categories",
252
+ "name": "categories",
253
+ "description": "Hierarchical category paths (e.g. `Runtime/Caching & dispatch`, `API/Linear Algebra/Matmul variants`, `Scheduler/Loop transformations/Tiling`). A task may carry multiple categories.",
254
+ "dataType": "sc:Text",
255
+ "repeated": true,
256
+ "source": {
257
+ "fileObject": {"@id": "tensorbench.json"},
258
+ "extract": {"jsonPath": "$[*].categories"}
259
+ }
260
+ }
261
+ ]
262
+ }
263
+ ]
264
+ }
run_tests.sh ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ echo "============================================"
4
+ echo "Running Scorch Test Suite"
5
+ echo "============================================"
6
+
7
+ # Clear JIT-compiled kernel cache to prevent stale .so files
8
+ rm -rf ~/.cache/torch_extensions/ 2>/dev/null || true
9
+ rm -rf /tmp/torch_extensions_* 2>/dev/null || true
10
+
11
+ # Clear build artifacts and inline-compiled extension so rebuild picks up new csrc/.
12
+ # scorch's setup.py uses package_dir={"":"src"}, so build_ext --inplace writes the
13
+ # top-level scorch_ops extension to /testbed/src/scorch_ops*.so (NOT /testbed/).
14
+ # We must delete both candidate paths or a silent build failure will fall through
15
+ # to a stale snapshot-baked .so and the test run will silently use the wrong build.
16
+ rm -rf /testbed/build/ /testbed/scorch.egg-info/ 2>/dev/null || true
17
+ rm -f /testbed/scorch_ops*.so /testbed/src/scorch_ops*.so 2>/dev/null || true
18
+
19
+ # Rebuild scorch_ops C++ extension to match current source. Fail loudly if the
20
+ # build fails so a stale .so doesn't silently masquerade as the patched build.
21
+ cd /testbed
22
+ if ! python setup.py build_ext --inplace --force 2>&1 | tee build_output.log | tail -3; then
23
+ echo "============================================"
24
+ echo "BUILD FAILED - scorch_ops C++ extension did not compile"
25
+ echo "============================================"
26
+ tail -30 build_output.log
27
+ exit 1
28
+ fi
29
+
30
+ python -m pytest tests/ -v --tb=short --no-header 2>&1 | tee test_output.log
31
+
32
+ if [ -f test_output.log ]; then
33
+ echo ""
34
+ echo "============================================"
35
+ echo "TEST SUMMARY"
36
+ echo "============================================"
37
+
38
+ SUMMARY_LINE=$(grep -E "={5,}.*in [0-9]+\.[0-9]+s.*={5,}" test_output.log | tail -1)
39
+
40
+ if [ -n "$SUMMARY_LINE" ]; then
41
+ PASSED=$(echo "$SUMMARY_LINE" | grep -oE '[0-9]+ passed' | grep -oE '[0-9]+' || echo "0")
42
+ FAILED=$(echo "$SUMMARY_LINE" | grep -oE '[0-9]+ failed' | grep -oE '[0-9]+' || echo "0")
43
+ SKIPPED=$(echo "$SUMMARY_LINE" | grep -oE '[0-9]+ skipped' | grep -oE '[0-9]+' || echo "0")
44
+ ERRORS=$(echo "$SUMMARY_LINE" | grep -oE '[0-9]+ error' | grep -oE '[0-9]+' || echo "0")
45
+
46
+ PASSED=${PASSED:-0}
47
+ FAILED=${FAILED:-0}
48
+ SKIPPED=${SKIPPED:-0}
49
+ ERRORS=${ERRORS:-0}
50
+
51
+ TOTAL=$((PASSED + FAILED + SKIPPED + ERRORS))
52
+
53
+ echo "Total: $TOTAL | Passed: $PASSED | Failed: $FAILED | Skipped: $SKIPPED | Errors: $ERRORS"
54
+
55
+ if [ "$FAILED" -eq "0" ] && [ "$ERRORS" -eq "0" ]; then
56
+ echo "ALL TESTS PASSED!"
57
+ exit 0
58
+ else
59
+ echo "SOME TESTS FAILED!"
60
+ grep -E "(FAILED|ERROR)" test_output.log | head -10
61
+ exit 1
62
+ fi
63
+ else
64
+ echo "Could not parse pytest output"
65
+ tail -10 test_output.log
66
+ exit 1
67
+ fi
68
+ fi
tensorbench.json ADDED
The diff for this file is too large to render. See raw diff