From dbc0a347774ed73b2e5bf2b664a390e956239cb2 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Sun, 24 Nov 2024 18:26:22 +0900 Subject: [PATCH] m1n1.agx: Python 3.13 fix Signed-off-by: Asahi Lina --- proxyclient/m1n1/agx/__init__.py | 2 +- proxyclient/m1n1/agx/channels.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/proxyclient/m1n1/agx/__init__.py b/proxyclient/m1n1/agx/__init__.py index ca8af3b7..3bf8cbb2 100644 --- a/proxyclient/m1n1/agx/__init__.py +++ b/proxyclient/m1n1/agx/__init__.py @@ -136,7 +136,7 @@ class AGX: # All channels have 0x100 items item_count = ring_size - item_size = cls.item_size + item_size = cls.item_size() ring_size = item_count * item_size self.log(f"Allocating {count} channel(s) for {name} ({item_count} * {item_size:#x} bytes each)") diff --git a/proxyclient/m1n1/agx/channels.py b/proxyclient/m1n1/agx/channels.py index c91f3471..d998156e 100644 --- a/proxyclient/m1n1/agx/channels.py +++ b/proxyclient/m1n1/agx/channels.py @@ -21,7 +21,6 @@ class GPUChannel: self.state.WRITE_PTR.val = 0 @classmethod - @property def item_size(cls): return cls.MSG_CLASS.sizeof() @@ -34,7 +33,7 @@ class GPUTXChannel(GPUChannel): def send_message(self, msg): wptr = self.state.WRITE_PTR.val - self.iface.writemem(self.ring_addr + self.item_size * wptr, + self.iface.writemem(self.ring_addr + self.item_size() * wptr, msg.build()) self.state.WRITE_PTR.val = (wptr + 1) % self.ring_size self.doorbell() @@ -48,8 +47,8 @@ class GPURXChannel(GPUChannel): raise Exception(f"wptr = {wptr:#x} > {self.ring_size:#x}") while rptr != wptr: - msg = self.iface.readmem(self.ring_addr + self.item_size * rptr, - self.item_size) + msg = self.iface.readmem(self.ring_addr + self.item_size() * rptr, + self.item_size()) self.handle_message(self.MSG_CLASS.parse(msg)) rptr = (rptr + 1) % self.ring_size self.state.READ_PTR.val = rptr