Skip to content

Enable slangpy_tests on Metal and Run test_buffer_views on macOS #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions slangpy/tests/slangpy_tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
elif sys.platform == "linux" or sys.platform == "linux2":
DEFAULT_DEVICE_TYPES = [DeviceType.vulkan]
elif sys.platform == "darwin":
# TODO: we don't run any slangpy tests on metal due to slang bugs for now
DEFAULT_DEVICE_TYPES = [] # [DeviceType.metal]
DEFAULT_DEVICE_TYPES = [DeviceType.metal]
else:
raise RuntimeError("Unsupported platform")

Expand Down Expand Up @@ -156,6 +155,6 @@

for i in range(shape):
buffer_data = np.array(data[i * element_count : (i + 1) * element_count])
cursor[i].write(buffer_data)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (linux, x86_64, gcc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (macos, aarch64, clang, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Debug, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Check warning on line 158 in slangpy/tests/slangpy_tests/helpers.py

View workflow job for this annotation

GitHub Actions / build (windows, x86_64, msvc, Release, 3.10)

Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

cursor.apply()
7 changes: 2 additions & 5 deletions slangpy/tests/slangpy_tests/test_buffer_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
except ImportError:
pytest.skip("Pytorch not installed", allow_module_level=True)

# Skip all tests in this file if running on MacOS
if sys.platform == "darwin":
pytest.skip("PyTorch requires CUDA, that is not available on macOS", allow_module_level=True)

MODULE = r"""
struct RGB {
float x;
Expand Down Expand Up @@ -123,7 +119,8 @@ def test_to_torch(
buffer_type: Union[Type[Tensor], Type[NDBuffer]],
test_dtype: tuple[str, Optional[torch.dtype], Type[Any], tuple[int, ...]],
):

if sys.platform == "darwin":
pytest.skip("PyTorch requires CUDA, that is not available on macOS", allow_module_level=True)
device = helpers.get_device(device_type, cuda_interop=True)
module = helpers.create_module(device, MODULE)

Expand Down
Loading