16 lines
732 B
Python
16 lines
732 B
Python
#!/usr/bin/env python3
|
|
"""Put one sm120 asset back to its unsealed placeholder state: reset_pin.py sm120_attn_daily (seal_pins.py refuses to overwrite a pinned PTX)."""
|
|
import re
|
|
import sys
|
|
|
|
name = sys.argv[1]
|
|
ptx = f"crates/cuda-driver/src/{name}.ptx"
|
|
rs = "crates/cuda-driver/src/original_verify/sm120.rs"
|
|
with open(ptx, "w", newline="\n") as f:
|
|
f.write(f"// UNSEALED placeholder: {name}.ptx (compile_assets.py / seal_pins.py install the real PTX)\n")
|
|
s = open(rs, newline="").read()
|
|
s2, n = re.subn(r'(name: "%s\.ptx",\n ptx: [^\n]*\n sha: )\[[^\]]*\]' % re.escape(name), lambda m: m.group(1) + "[0; 32]", s, count=1)
|
|
if n != 1:
|
|
sys.exit("reset_pin: sha of %s not found" % name)
|
|
open(rs, "w", newline="").write(s2)
|