From 62df6c39aff0cbb2c02bb4e473bde652a5dc0f54 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Wed, 27 Aug 2025 01:26:45 +0300 Subject: [PATCH] amd: correct handling of relocations (#11863) * amd: correct handling of relocations * ops * add --- tinygrad/runtime/ops_amd.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tinygrad/runtime/ops_amd.py b/tinygrad/runtime/ops_amd.py index 214732c157..dd960904b2 100644 --- a/tinygrad/runtime/ops_amd.py +++ b/tinygrad/runtime/ops_amd.py @@ -464,14 +464,14 @@ class AMDProgram(HCQProgram): # TODO; this API needs the type signature of the function and global_size/local_size self.dev, self.name, self.lib = dev, name, lib - image, sections, _ = elf_loader(self.lib) + image, sections, relocs = elf_loader(self.lib) rodata_entry = next((sh.header.sh_addr for sh in sections if sh.name == ".rodata"), -1) - text_entry = next((sh.header.sh_addr for sh in sections if sh.name == ".text"), -1) - assert rodata_entry >= 0 and text_entry >= 0, ".text or .rodata section not found" + assert rodata_entry >= 0, ".rodata section not found" - # Relo for kernel_code_entry_byte_offset for AMD_LLVM. Comgr doesn't need that, but keep shared code path. - image[rodata_entry+0x10:rodata_entry+0x10+8] = struct.pack('