mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
do not sleep immediately in amd's wait_signal (#4859)
* that was slow python in hlb * wait actibely for 5s * just this * revert this back * fix
This commit is contained in:
@@ -464,10 +464,11 @@ class AMDDevice(Compiled):
|
||||
assert signal.event_id != 0, "can't wait on this signal"
|
||||
evt_arr = (kfd.struct_kfd_event_data)(event_id=signal.event_id)
|
||||
|
||||
# Wait active for 5s, then going to sleep.
|
||||
start_time = time.time() * 1000
|
||||
while (time.time() * 1000 - start_time) < timeout:
|
||||
while (time_spent:=time.time() * 1000 - start_time) < timeout:
|
||||
if signal.value >= value: return
|
||||
kio.wait_events(AMDDevice.kfd, events_ptr=ctypes.addressof(evt_arr), num_events=1, wait_for_all=1, timeout=100)
|
||||
if time_spent > 5000: kio.wait_events(AMDDevice.kfd, events_ptr=ctypes.addressof(evt_arr), num_events=1, wait_for_all=1, timeout=1000)
|
||||
raise RuntimeError(f"wait_signal: not set to {value}, but {signal.value}, {timeout} ms TIMEOUT!")
|
||||
|
||||
def __init__(self, device:str=""):
|
||||
|
||||
Reference in New Issue
Block a user