mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
elf loader touchups (#5607)
* loadonly SHF_ALLOC sections * revert this, just amd fix
This commit is contained in:
@@ -299,9 +299,9 @@ class AMDProgram(HCQProgram):
|
||||
ctypes.memmove(self.lib_gpu.va_addr, mv_address(image), image.nbytes)
|
||||
|
||||
entry_point = min(sh.header.sh_addr for sh in sections if sh.header.sh_type == libc.SHT_PROGBITS and sh.header.sh_flags & libc.SHF_ALLOC)
|
||||
self.group_segment_size = image[:-(len(image)%4)].cast("I")[entry_point//4]
|
||||
self.private_segment_size = image[:-(len(image)%4)].cast("I")[entry_point//4 + 1]
|
||||
self.kernargs_segment_size = image[:-(len(image)%4)].cast("I")[entry_point//4 + 2]
|
||||
self.group_segment_size = image[entry_point:entry_point+4].cast("I")[0]
|
||||
self.private_segment_size = image[entry_point+4:entry_point+8].cast("I")[0]
|
||||
self.kernargs_segment_size = image[entry_point+8:entry_point+12].cast("I")[0]
|
||||
|
||||
lds_size = ((self.group_segment_size + 511) // 512) & 0x1FF
|
||||
if lds_size > (self.device.properties['lds_size_in_kb'] * 1024) // 512: raise RuntimeError("Too many resources requsted: group_segment_size")
|
||||
|
||||
Reference in New Issue
Block a user