From 9bb17c53ead4d27158334d65ff673b3737d93a92 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Mon, 17 Nov 2025 13:59:03 +0300 Subject: [PATCH] amd: timer fix (#13267) --- test/mockgpu/amd/amdgpu.py | 1 + tinygrad/runtime/ops_amd.py | 1 + 2 files changed, 2 insertions(+) diff --git a/test/mockgpu/amd/amdgpu.py b/test/mockgpu/amd/amdgpu.py index afa8b4d44b..7b13b72562 100644 --- a/test/mockgpu/amd/amdgpu.py +++ b/test/mockgpu/amd/amdgpu.py @@ -124,6 +124,7 @@ class PM4Executor(AMDQueue): elif mem_data_sel == 3: if mem_event_type == CACHE_FLUSH_AND_INV_TS_EVENT: ptr.cast('Q')[0] = int(time.perf_counter() * 1e8) else: raise RuntimeError(f"Unknown {mem_data_sel=} {mem_event_type=}") + elif mem_data_sel == 0: pass # no write else: raise RuntimeError(f"Unknown {mem_data_sel=}") def _exec_copy_data(self, n): diff --git a/tinygrad/runtime/ops_amd.py b/tinygrad/runtime/ops_amd.py index d97a2f79b2..7a956a2ae8 100644 --- a/tinygrad/runtime/ops_amd.py +++ b/tinygrad/runtime/ops_amd.py @@ -357,6 +357,7 @@ class AMDComputeQueue(HWQueue): def timestamp(self, signal:AMDSignal): with self.pred_exec(xcc_mask=0b1): + self.release_mem(cache_flush=False) # ensure all prior writes are done self.release_mem(signal.timestamp_addr, 0, self.pm4.data_sel__mec_release_mem__send_gpu_clock_counter, self.pm4.int_sel__mec_release_mem__none) self.acquire_mem() # ensure timestamp is written return self