forked from tinygrad/tinygrad
fix CUDA=1 disassembly (VIZ=1) by stripping null terminator (#14046)
* fix ptxas disassembly bug * single ' * move fix to get_bytes * move rstrip --------- Co-authored-by: qazal <[email protected]>
This commit is contained in:
@@ -35,7 +35,7 @@ def pretty_ptx(s):
|
||||
def cuda_disassemble(lib:bytes, arch:str):
|
||||
try:
|
||||
fn = (pathlib.Path(tempfile.gettempdir()) / f"tinycuda_{hashlib.md5(lib).hexdigest()}").as_posix()
|
||||
with open(fn, "wb") as f: f.write(lib)
|
||||
with open(fn, "wb") as f: f.write(lib.rstrip(b'\x00'))
|
||||
subprocess.run(["ptxas", f"-arch={arch}", "-o", fn, fn], check=False, stderr=subprocess.DEVNULL) # optional ptx -> sass step for CUDA=1
|
||||
print(system(f'nvdisasm {fn}'))
|
||||
except Exception as e: print("Failed to generate SASS", str(e), "Make sure your PATH contains ptxas/nvdisasm binary of compatible version.")
|
||||
|
||||
Reference in New Issue
Block a user