From edc4e1aede9cbba886b166b0f4a1b15aa8a51834 Mon Sep 17 00:00:00 2001 From: b1tg <33436708+b1tg@users.noreply.github.com> Date: Thu, 6 Nov 2025 01:10:51 +0800 Subject: [PATCH] ignore trailing nops in llvm-objdump output (#13110) --- tinygrad/runtime/support/compiler_amd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tinygrad/runtime/support/compiler_amd.py b/tinygrad/runtime/support/compiler_amd.py index 8f26780d92..d0f7ec6682 100644 --- a/tinygrad/runtime/support/compiler_amd.py +++ b/tinygrad/runtime/support/compiler_amd.py @@ -13,8 +13,9 @@ from tinygrad.runtime.support.compiler_cpu import LLVMCompiler from tinygrad.helpers import OSX, to_char_p_p def amdgpu_disassemble(lib:bytes): - asm = subprocess.check_output(["llvm-objdump" if OSX else "/opt/rocm/llvm/bin/llvm-objdump", '-d', '-'], input=lib) - print('\n'.join([x for x in asm.decode('utf-8').split("\n") if 's_code_end' not in x])) + asm = subprocess.check_output(["llvm-objdump" if OSX else "/opt/rocm/llvm/bin/llvm-objdump", '-d', '-'], input=lib).decode("utf-8").splitlines() + while asm and ("s_nop 0" in asm[-1] or "s_code_end" in asm[-1]): asm.pop() + print("\n".join(asm)) def check(status): if status != 0: