MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / read_starter_kernel

Function read_starter_kernel

extract.py:246–259  ·  view source on GitHub ↗

Read the starter kernel file. Returns None if not found. For backend='triton': reads from kernels/{op_type}.py For backend='cuda': reads from kernels/cuda/{op_type}.py

(op_type: str, backend: str = "triton")

Source from the content-addressed store, hash-verified

244# ---------------------------------------------------------------------------
245
246def read_starter_kernel(op_type: str, backend: str = "triton") -> Optional[str]:
247 """Read the starter kernel file. Returns None if not found.
248
249 For backend='triton': reads from kernels/{op_type}.py
250 For backend='cuda': reads from kernels/cuda/{op_type}.py
251 """
252 if backend == "cuda":
253 path = os.path.join(KERNELS_DIR, "cuda", f"{op_type}.py")
254 else:
255 path = os.path.join(KERNELS_DIR, f"{op_type}.py")
256 if not os.path.exists(path):
257 return None
258 with open(path, "r", encoding="utf-8") as f:
259 return f.read()
260
261
262def extract_kernel_body(starter_code: str) -> str:

Callers 1

extract_kernelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected