MCPcopy Create free account
hub / github.com/NVIDIA/SOL-ExecBench / build_reference_solution

Function build_reference_solution

scripts/run_dataset.py:167–196  ·  view source on GitHub ↗

Construct a Solution dict that wraps the definition's reference code.

(definition: dict)

Source from the content-addressed store, hash-verified

165
166
167def build_reference_solution(definition: dict) -> dict:
168 """Construct a Solution dict that wraps the definition's reference code."""
169 name = definition["name"]
170 reference_code = definition["reference"]
171 dps = _infer_dps(reference_code, definition)
172
173 # Replace "stream" with "strm" to avoid tripping the SourceFile stream detector.
174 # The validator rejects any Python source containing the word "stream", but some
175 # reference implementations legitimately use it in variable names or comments.
176 reference_code = reference_code.replace("stream", "strm")
177
178 return {
179 "name": f"reference_{name}",
180 "definition": name,
181 "author": "run_dataset",
182 "description": "Identity solution: definition reference as-is.",
183 "spec": {
184 "languages": ["pytorch"],
185 "target_hardware": ["LOCAL"],
186 "entry_point": "reference.py::run",
187 "dependencies": ["torch"],
188 "destination_passing_style": dps,
189 },
190 "sources": [
191 {
192 "path": "reference.py",
193 "content": reference_code,
194 }
195 ],
196 }
197
198
199# ---------------------------------------------------------------------------

Callers 1

Calls 1

_infer_dpsFunction · 0.85

Tested by

no test coverage detected