Skip to content

Commit

Permalink
Remove copy=False for NumPy 2.0 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgherbst committed Jul 2, 2024
1 parent a581055 commit 863d4f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext

__version__ = "0.2.9"
__version__ = "0.2.10"

#################################################################################
# parse_reqs, long_desc from https://github.com/siliconcompiler/siliconcompiler #
Expand Down
2 changes: 1 addition & 1 deletion switchboard/axi.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def write(
raise ValueError('Can only write integer dtypes such as uint8, uint16, etc.'
f' (got dtype "{data.dtype}")')
elif isinstance(data, np.integer):
write_data = np.array(data, ndmin=1, copy=False)
write_data = np.array(data, ndmin=1)
else:
raise TypeError(f"Unknown data type: {type(data)}")

Expand Down
2 changes: 1 addition & 1 deletion switchboard/axil.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def write(
raise ValueError('Can only write integer dtypes such as uint8, uint16, etc.'
f' (got dtype "{data.dtype}")')
elif isinstance(data, np.integer):
write_data = np.array(data, ndmin=1, copy=False)
write_data = np.array(data, ndmin=1)
else:
raise TypeError(f"Unknown data type: {type(data)}")

Expand Down
7 changes: 2 additions & 5 deletions switchboard/umi.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def write(self, addr, data, srcaddr=None, max_bytes=None,
raise ValueError('Can only write integer dtypes such as uint8, uint16, etc.'
f' (got dtype "{data.dtype}")')
elif isinstance(data, np.integer):
write_data = np.array(data, ndmin=1, copy=False)
write_data = np.array(data, ndmin=1)
else:
raise TypeError(f"Unknown data type: {type(data)}")

Expand Down Expand Up @@ -534,10 +534,7 @@ def atomic(self, addr, data, opcode, srcaddr=None, qos=0, prot=0, error=None):

# format the data for sending
if isinstance(data, np.integer):
# copy=False should be safe here, because the data will be
# copied over to the queue; the original data will never
# be read again or modified from the C++ side
atomic_data = np.array(data, ndmin=1, copy=False).view(np.uint8)
atomic_data = np.array(data, ndmin=1).view(np.uint8)
result = self.umi.atomic(addr, atomic_data, opcode, srcaddr, qos, prot, error)
return result.view(data.dtype)[0]
else:
Expand Down

0 comments on commit 863d4f6

Please sign in to comment.