From e90aa0d898eca0c4f9eb915f9c648851ae062139 Mon Sep 17 00:00:00 2001 From: Vrishabh Date: Sat, 11 May 2024 12:59:47 +0530 Subject: [PATCH] clippy fixes (#31) --- Cargo.lock | 566 ++++++++---------- Cargo.toml | 4 +- .../wgpy_core/src/array_routines/broadcast.rs | 2 +- .../src/array_routines/where_routine.rs | 44 +- crates/wgpy_core/src/lib.rs | 1 + crates/wgpy_core/src/ndarray.rs | 2 +- crates/wgpy_core/src/types.rs | 6 +- crates/wgpy_core/src/utils.rs | 13 + .../wgpy_math/compute_shader/f32/cross.wgsl | 16 + crates/wgpy_math/src/misc.rs | 16 +- crates/wgpy_pyo3/src/misc_math.rs | 7 +- crates/wgpy_pyo3/src/ndarraypy.rs | 9 + crates/wgpy_pyo3/wp_tests/test_arithmetic.py | 16 +- crates/wgpy_pyo3/wp_tests/test_array.py | 33 +- crates/wgpy_pyo3/wp_tests/test_binary.py | 20 +- crates/wgpy_pyo3/wp_tests/test_logical.py | 1 + crates/wgpy_pyo3/wp_tests/test_misc_math.py | 18 +- crates/wgpy_pyo3/wp_tests/test_random.py | 22 +- .../wgpy_pyo3/wp_tests/test_trigonometry.py | 11 +- crates/wgpy_pyo3/wp_tests/test_utils.py | 7 +- crates/wgpy_random/src/generator.rs | 6 +- 21 files changed, 446 insertions(+), 374 deletions(-) create mode 100644 crates/wgpy_core/src/utils.rs create mode 100644 crates/wgpy_math/compute_shader/f32/cross.wgsl diff --git a/Cargo.lock b/Cargo.lock index e29bb4c..26700a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,20 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -27,18 +16,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android_system_properties" @@ -57,15 +46,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "arc-swap" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayvec" @@ -76,7 +65,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "arrow_gpu" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_arithmetic", "arrow_gpu_array", @@ -91,7 +80,7 @@ dependencies = [ [[package]] name = "arrow_gpu_arithmetic" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -100,11 +89,11 @@ dependencies = [ [[package]] name = "arrow_gpu_array" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "bytemuck", "futures-intrusive", - "hashbrown 0.14.3", + "hashbrown", "log", "pollster", "wgpu", @@ -113,7 +102,7 @@ dependencies = [ [[package]] name = "arrow_gpu_cast" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -122,7 +111,7 @@ dependencies = [ [[package]] name = "arrow_gpu_compare" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -131,7 +120,7 @@ dependencies = [ [[package]] name = "arrow_gpu_logical" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_arithmetic", "arrow_gpu_array", @@ -141,7 +130,7 @@ dependencies = [ [[package]] name = "arrow_gpu_math" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -150,7 +139,7 @@ dependencies = [ [[package]] name = "arrow_gpu_routines" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -159,7 +148,7 @@ dependencies = [ [[package]] name = "arrow_gpu_trigonometry" version = "0.1.0" -source = "git+https://github.com/psvri/arrow-gpu.git?rev=537d9bc08df795e28b0f58e7fd5f07da841c6ba0#537d9bc08df795e28b0f58e7fd5f07da841c6ba0" +source = "git+https://github.com/psvri/arrow-gpu.git?rev=639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e#639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e" dependencies = [ "arrow_gpu_array", "wgpu", @@ -176,9 +165,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bit-set" @@ -203,9 +192,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block" @@ -215,9 +204,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" @@ -231,12 +220,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -278,18 +261,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstyle", "clap_lex", @@ -297,9 +280,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "codespan-reporting" @@ -344,9 +327,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -354,15 +337,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -438,20 +421,29 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "d3d12" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" +checksum = "b28bfe653d79bd16c77f659305b195b82bb5ce0c0eb2a4846b82ddbd77586813" dependencies = [ - "bitflags 2.3.3", - "libloading 0.8.0", + "bitflags 2.5.0", + "libloading 0.8.3", "winapi", ] +[[package]] +name = "document-features" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" +dependencies = [ + "litrs", +] + [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "equivalent" @@ -459,16 +451,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -487,7 +469,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -498,9 +480,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-intrusive" @@ -513,17 +495,6 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gl_generator" version = "0.14.0" @@ -562,7 +533,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", "gpu-alloc-types", ] @@ -572,7 +543,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", ] [[package]] @@ -590,29 +561,29 @@ dependencies = [ [[package]] name = "gpu-descriptor" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" +checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "gpu-descriptor-types", - "hashbrown 0.12.3", + "hashbrown", ] [[package]] name = "gpu-descriptor-types" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", ] [[package]] name = "half" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ "cfg-if", "crunchy", @@ -620,20 +591,11 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.7.6", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash 0.8.7", + "ahash", "allocator-api2", ] @@ -643,10 +605,10 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", "com", "libc", - "libloading 0.8.0", + "libloading 0.8.3", "thiserror", "widestring", "winapi", @@ -660,9 +622,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hexf-parse" @@ -672,29 +634,29 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] name = "indexmap" -version = "2.0.2" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown", ] [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.52.0", + "libc", + "windows-sys", ] [[package]] @@ -708,15 +670,21 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -728,7 +696,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.0", + "libloading 0.8.3", "pkg-config", ] @@ -740,9 +708,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" @@ -756,25 +724,25 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-targets 0.52.5", ] [[package]] -name = "linux-raw-sys" -version = "0.4.13" +name = "litrs" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -782,9 +750,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "malloc_buf" @@ -797,26 +765,26 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "metal" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +checksum = "5637e166ea14be6063a3f8ba5ccb9a4159df7d8f6d61c02fc3d480b1f90dcfcb" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", "block", "core-graphics-types", "foreign-types", @@ -827,12 +795,13 @@ dependencies = [ [[package]] name = "naga" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899" +checksum = "e536ae46fcab0876853bd4a632ede5df4b1c2527a58f6c5a4150fe86be858231" dependencies = [ + "arrayvec", "bit-set", - "bitflags 2.3.3", + "bitflags 2.5.0", "codespan-reporting", "hexf-parse", "indexmap", @@ -845,11 +814,20 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -861,16 +839,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", - "objc_exception", -] - -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", ] [[package]] @@ -897,9 +865,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", @@ -916,9 +884,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plotters" @@ -968,18 +936,18 @@ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "profiling" -version = "1.0.8" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332cd62e95873ea4f41f3dfd6bbbfc5b52aec892d7e8d534197c4720a0bbbab2" +checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" [[package]] name = "pyo3" @@ -1039,7 +1007,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -1052,14 +1020,14 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1072,15 +1040,15 @@ checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" [[package]] name = "raw-window-handle" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" +checksum = "8cc3bcbdb1ddfc11e700e62968e6b4cc9c75bb466464ad28fb61c5b2c964418b" [[package]] name = "rayon" -version = "1.8.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -1098,18 +1066,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1119,9 +1087,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1130,15 +1098,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "renderdoc-sys" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" [[package]] name = "rustc-hash" @@ -1146,24 +1114,11 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustix" -version = "0.38.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "same-file" @@ -1182,29 +1137,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -1213,18 +1168,18 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "version_check", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "spirv" @@ -1232,7 +1187,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", ] [[package]] @@ -1254,9 +1209,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -1265,9 +1220,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "termcolor" @@ -1287,22 +1242,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -1317,15 +1272,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -1347,25 +1302,19 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", ] -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1373,24 +1322,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -1400,9 +1349,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1410,28 +1359,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1497,13 +1446,14 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1213b52478a7631d6e387543ed8f642bc02c578ef4e3b49aca2a29a7df0cb" +checksum = "32ff1bfee408e1028e2e3acbf6d32d98b08a5a059ccbf5f33305534453ba5d3e" dependencies = [ "arrayvec", "cfg-if", "cfg_aliases", + "document-features", "js-sys", "log", "naga", @@ -1522,15 +1472,16 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed" +checksum = "ac6a86eaa5e763e59c73cf9e97d55fffd4dfda69fd8bda19589fcf851ddfef1f" dependencies = [ "arrayvec", "bit-vec", - "bitflags 2.3.3", + "bitflags 2.5.0", "cfg_aliases", "codespan-reporting", + "document-features", "indexmap", "log", "naga", @@ -1548,15 +1499,15 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bb47856236bfafc0bc591a925eb036ac19cd987624a447ff353e7a7e7e6f72" +checksum = "4d71c8ae05170583049b65ee562fd839fdc0b3e9ddb84f4e40c9d5f8ea0d4c8c" dependencies = [ "android_system_properties", "arrayvec", "ash", "bit-set", - "bitflags 2.3.3", + "bitflags 2.5.0", "block", "cfg_aliases", "core-graphics-types", @@ -1570,10 +1521,11 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.0", + "libloading 0.8.3", "log", "metal", "naga", + "ndk-sys", "objc", "once_cell", "parking_lot", @@ -1592,20 +1544,20 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2" +checksum = "1353d9a46bff7f955a680577f34c69122628cc2076e1d6f3a9be6ef00ae793ef" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.5.0", "js-sys", "web-sys", ] [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -1625,9 +1577,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1640,30 +1592,21 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -1672,7 +1615,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1692,17 +1635,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1713,9 +1657,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -1725,9 +1669,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -1737,9 +1681,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -1749,9 +1699,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -1761,9 +1711,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -1773,9 +1723,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -1785,15 +1735,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "xml-rs" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "zerocopy" @@ -1812,5 +1762,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] diff --git a/Cargo.toml b/Cargo.toml index d037661..fd89fb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ edition = "2021" [workspace.dependencies] pyo3 = { version = "0.20.3", features = ["extension-module"] } #arrow_gpu = { path="../arrow-gpu/crates/arrow"} -arrow_gpu = { git="https://github.com/psvri/arrow-gpu.git", rev = "537d9bc08df795e28b0f58e7fd5f07da841c6ba0"} -wgpu = "0.19.3" +arrow_gpu = { git="https://github.com/psvri/arrow-gpu.git", rev = "639cbdfc92c51e3d1fd4e4c8804675b9ebe3053e"} +wgpu = "0.20.0" once_cell = "1.19.0" bytemuck = "1.15.0" diff --git a/crates/wgpy_core/src/array_routines/broadcast.rs b/crates/wgpy_core/src/array_routines/broadcast.rs index aab1b0c..13b8477 100644 --- a/crates/wgpy_core/src/array_routines/broadcast.rs +++ b/crates/wgpy_core/src/array_routines/broadcast.rs @@ -96,7 +96,7 @@ pub fn broadcast_if_required( pipeline: &mut ArrowComputePipeline, ) -> Option { if arr.shape != broadcasted_shape { - Some(broadcast_to_op(arr, &broadcasted_shape, pipeline)) + Some(broadcast_to_op(arr, broadcasted_shape, pipeline)) } else { None } diff --git a/crates/wgpy_core/src/array_routines/where_routine.rs b/crates/wgpy_core/src/array_routines/where_routine.rs index 24f9bd9..ee62795 100644 --- a/crates/wgpy_core/src/array_routines/where_routine.rs +++ b/crates/wgpy_core/src/array_routines/where_routine.rs @@ -1,7 +1,10 @@ +use std::borrow::Cow; + use arrow_gpu::{array::ArrowArrayGPU, kernels::merge_dyn}; use crate::{ broadcast::{broadcast_shape, broadcast_to}, + utils::Holder, NdArray, }; @@ -10,14 +13,39 @@ pub fn where_(mask: &NdArray, x: &NdArray, y: &NdArray) -> NdArray { if let ArrowArrayGPU::BooleanArrayGPU(bool_mask) = &mask.data { let broadcast_shape = broadcast_shape(&mask.shape, &broadcast_shape(&x.shape, &y.shape).unwrap()).unwrap(); - let broadcasted_x = broadcast_to(x, &broadcast_shape); - let broadcasted_y = broadcast_to(y, &broadcast_shape); - let merged_array = merge_dyn(&broadcasted_x.data, &broadcasted_y.data, bool_mask); - NdArray { - shape: x.shape.clone(), - dims: x.dims, - data: merged_array, - dtype: x.dtype, + + let broadcasted_x = if x.shape != broadcast_shape { + Holder::Owned(broadcast_to(x, &broadcast_shape)) + } else { + Holder::Borrowed(x) + }; + + let broadcasted_y = if y.shape != broadcast_shape { + Holder::Owned(broadcast_to(y, &broadcast_shape)) + } else { + Holder::Borrowed(y) + }; + + let broadcasted_mask = if mask.shape != broadcast_shape { + Holder::Owned(broadcast_to(mask, &broadcast_shape)) + } else { + Holder::Borrowed(mask) + }; + + if let ArrowArrayGPU::BooleanArrayGPU(bool_mask) = &broadcasted_mask.as_ref().data { + let merged_array = merge_dyn( + &broadcasted_x.as_ref().data, + &broadcasted_y.as_ref().data, + bool_mask, + ); + NdArray { + shape: x.shape.clone(), + dims: x.dims, + data: merged_array, + dtype: x.dtype, + } + } else { + unreachable!() } } else { panic!("Mask is not of boolean type") diff --git a/crates/wgpy_core/src/lib.rs b/crates/wgpy_core/src/lib.rs index e567730..d985d8c 100644 --- a/crates/wgpy_core/src/lib.rs +++ b/crates/wgpy_core/src/lib.rs @@ -8,6 +8,7 @@ pub(crate) mod ndarray; pub(crate) mod operand; pub(crate) mod types; pub(crate) mod ufunc; +pub(crate) mod utils; pub use array_routines::*; pub use arrow_gpu::utils::ScalarArray; diff --git a/crates/wgpy_core/src/ndarray.rs b/crates/wgpy_core/src/ndarray.rs index 4a98270..00c0211 100644 --- a/crates/wgpy_core/src/ndarray.rs +++ b/crates/wgpy_core/src/ndarray.rs @@ -110,7 +110,7 @@ impl NdArray { } pub fn take(&self, indices: &NdArray, axis: Option) -> Self { - if let Some(_) = axis { + if axis.is_some() { todo!() } else { if let ArrowArrayGPU::UInt32ArrayGPU(indices_array) = &indices.data { diff --git a/crates/wgpy_core/src/types.rs b/crates/wgpy_core/src/types.rs index d5cb887..a0f4364 100644 --- a/crates/wgpy_core/src/types.rs +++ b/crates/wgpy_core/src/types.rs @@ -64,9 +64,9 @@ impl<'a> From<&'a str> for Dtype { } } -impl Into for Dtype { - fn into(self) -> ArrowType { - match self { +impl From for ArrowType { + fn from(val: Dtype) -> Self { + match val { Dtype::Int8 => ArrowType::Int8Type, Dtype::Int16 => ArrowType::Int16Type, Dtype::Int32 => ArrowType::Int32Type, diff --git a/crates/wgpy_core/src/utils.rs b/crates/wgpy_core/src/utils.rs new file mode 100644 index 0000000..bfb32c7 --- /dev/null +++ b/crates/wgpy_core/src/utils.rs @@ -0,0 +1,13 @@ +pub enum Holder<'a, B> { + Borrowed(&'a B), + Owned(B), +} + +impl<'a, T> AsRef for Holder<'a, T> { + fn as_ref(&self) -> &T { + match self { + Holder::Borrowed(x) => x, + Holder::Owned(x) => x, + } + } +} diff --git a/crates/wgpy_math/compute_shader/f32/cross.wgsl b/crates/wgpy_math/compute_shader/f32/cross.wgsl new file mode 100644 index 0000000..27b6b85 --- /dev/null +++ b/crates/wgpy_math/compute_shader/f32/cross.wgsl @@ -0,0 +1,16 @@ +@group(0) @binding(0) +var input_1 : array; + +@group(0) @binding(1) +var input_2 : array; + +@group(0) @binding(2) +var input_2 : array; + +@compute +@workgroup_size(256) +fn cross_(@builtin(global_invocation_id) global_id: vec3) { + if global_id.x * 3 < arrayLength(input_1) { + + } +} \ No newline at end of file diff --git a/crates/wgpy_math/src/misc.rs b/crates/wgpy_math/src/misc.rs index 5940a1f..c139446 100644 --- a/crates/wgpy_math/src/misc.rs +++ b/crates/wgpy_math/src/misc.rs @@ -1,11 +1,13 @@ use arrow_gpu::{gpu_utils::ArrowComputePipeline, kernels::*}; use webgpupy_core::{ broadcast_shape, broadcast_shapes, broadcast_to_op, ufunc_nin1_nout1, ufunc_nin1_nout1_body, - Dtype, NdArray, + ufunc_nin2_nout1, ufunc_nin2_nout1_body, Dtype, NdArray, }; ufunc_nin1_nout1_body!(sqrt, sqrt_op_dyn); ufunc_nin1_nout1_body!(cbrt, cbrt_op_dyn); +ufunc_nin1_nout1_body!(absolute, abs_op_dyn); +ufunc_nin2_nout1_body!(power, power_op_dyn); pub fn clip(a: &NdArray, a_min: Option<&NdArray>, a_max: Option<&NdArray>) -> NdArray { match (a_min, a_max) { @@ -103,6 +105,18 @@ pub fn clip(a: &NdArray, a_min: Option<&NdArray>, a_max: Option<&NdArray>) -> Nd } } +pub fn cross(a: &NdArray, b: &NdArray) -> NdArray { + let shader = match (a.dtype, b.dtype) { + (Dtype::Float32, Dtype::Float32) => include_str!("../compute_shader/f32/cross.wgsl"), + _ => panic!( + "cross not supported for type {:?} and {:?}", + a.dtype, b.dtype + ), + }; + + todo!() +} + #[cfg(test)] mod test { use super::*; diff --git a/crates/wgpy_pyo3/src/misc_math.rs b/crates/wgpy_pyo3/src/misc_math.rs index 20542f7..85d239e 100644 --- a/crates/wgpy_pyo3/src/misc_math.rs +++ b/crates/wgpy_pyo3/src/misc_math.rs @@ -12,8 +12,10 @@ use webgpupy::clip; impl_ufunc_nin1_nout1!(_sqrt, webgpupy::sqrt); impl_ufunc_nin1_nout1!(_cbrt, webgpupy::cbrt); +impl_ufunc_nin1_nout1!(_absolute, webgpupy::absolute); impl_ufunc_nin2_nout1!(_maximum, webgpupy::maximum); impl_ufunc_nin2_nout1!(_minimum, webgpupy::minimum); +impl_ufunc_nin2_nout1!(_power, webgpupy::power); // TODO add ufunc kwargs support #[pyfunction(name = "clip")] @@ -42,12 +44,15 @@ pub fn create_py_items(m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(_cbrt, m)?)?; m.add_function(wrap_pyfunction!(_maximum, m)?)?; m.add_function(wrap_pyfunction!(_minimum, m)?)?; - m.add_function(wrap_pyfunction!(_minimum, m)?)?; + m.add_function(wrap_pyfunction!(_absolute, m)?)?; + m.add_function(wrap_pyfunction!(_power, m)?)?; m.add_function(wrap_pyfunction!(clip_, m)?)?; add_ufunc_nin1_nout1!(m, "sqrt"); add_ufunc_nin1_nout1!(m, "cbrt"); add_ufunc_nin2_nout1!(m, "maximum"); add_ufunc_nin2_nout1!(m, "minimum"); + add_ufunc_nin2_nout1!(m, "absolute"); + add_ufunc_nin2_nout1!(m, "power"); Ok(()) } diff --git a/crates/wgpy_pyo3/src/ndarraypy.rs b/crates/wgpy_pyo3/src/ndarraypy.rs index 55f7355..42e7b03 100644 --- a/crates/wgpy_pyo3/src/ndarraypy.rs +++ b/crates/wgpy_pyo3/src/ndarraypy.rs @@ -10,6 +10,7 @@ use crate::{ convert_pyobj_into_array_u32, convert_pyobj_into_operand, convert_pyobj_into_scalar, convert_pyobj_into_vec_ndarray, logical::{_equal, _greater, _lesser}, + misc_math::_absolute, types::{into_dtypepy, into_optional_dtypepy, DtypePy}, }; @@ -75,6 +76,10 @@ impl NdArrayPy { Ok(_divide(py, slf.as_ref(), other, None, None)) } + pub fn __rtruediv__(slf: &PyCell, py: Python<'_>, other: &PyAny) -> PyResult { + Ok(_divide(py, other, slf.as_ref(), None, None)) + } + pub fn __add__(slf: &PyCell, py: Python<'_>, other: &PyAny) -> PyResult { Ok(_add(py, slf.as_ref(), other, None, None)) } @@ -113,6 +118,10 @@ impl NdArrayPy { }) } + pub fn __abs__(slf: &PyCell, py: Python<'_>) -> PyResult { + Ok(_absolute(py, slf.as_ref(), None, None)) + } + pub fn __eq__(slf: &PyCell, py: Python<'_>, other: &PyAny) -> PyResult { Ok(_equal(py, slf.as_ref(), other, None, None)) } diff --git a/crates/wgpy_pyo3/wp_tests/test_arithmetic.py b/crates/wgpy_pyo3/wp_tests/test_arithmetic.py index b6ce140..a51298c 100644 --- a/crates/wgpy_pyo3/wp_tests/test_arithmetic.py +++ b/crates/wgpy_pyo3/wp_tests/test_arithmetic.py @@ -3,35 +3,45 @@ import numpy as np from test_utils import almost_equals + @pytest.fixture def input_array(): return [[1.0], [2.0], [3.0], [4.0]] + @pytest.fixture def wp_array(input_array): return wp.array(input_array) + @pytest.fixture def np_array(input_array): return np.array(input_array) + def test_mul_f32(wp_array, np_array): almost_equals(wp_array * 10.0, np_array * 10) - + + def test_rmul_f32(wp_array, np_array): almost_equals(10.0 * wp_array, 10 * np_array) + def test_divide_f32(wp_array, np_array): almost_equals(wp_array / 10.0, np_array / 10) + def test_add_f32(wp_array, np_array): almost_equals(wp_array + 10.0, np_array + 10) + def test_radd_f32(wp_array, np_array): almost_equals(10.0 + wp_array, 10 + np_array) + def test_sub_f32(wp_array, np_array): almost_equals(wp_array - 10.0, np_array - 10) - + + def test_rsub_f32(wp_array, np_array): - almost_equals(10.0 - wp_array, 10 - np_array) \ No newline at end of file + almost_equals(10.0 - wp_array, 10 - np_array) diff --git a/crates/wgpy_pyo3/wp_tests/test_array.py b/crates/wgpy_pyo3/wp_tests/test_array.py index 98e2b12..3f0c51f 100644 --- a/crates/wgpy_pyo3/wp_tests/test_array.py +++ b/crates/wgpy_pyo3/wp_tests/test_array.py @@ -3,31 +3,56 @@ import numpy as np from test_utils import almost_equals + @pytest.fixture def input_array(): return [[1.0], [2.0], [3.0], [4.0]] + @pytest.fixture def wp_array(input_array): return wp.array(input_array) + @pytest.fixture def np_array(input_array): return np.array(input_array) + def test_array(wp_array): - assert wp_array.shape == [4,1] + assert wp_array.shape == [4, 1] assert wp_array.tolist() == [[1.0], [2.0], [3.0], [4.0]] + def test_array_astype(wp_array): - arr = wp_array.astype('uint8') + arr = wp_array.astype("uint8") assert arr.tolist() == [[1], [2], [3], [4]] + def test_indexing(wp_array, np_array): almost_equals(wp_array[:, :], np_array[:, :]) almost_equals(wp_array[:], np_array[:]) almost_equals(wp_array[1], np_array[1]) - almost_equals(wp_array[:,0], np_array[:,0]) + almost_equals(wp_array[:, 0], np_array[:, 0]) + def test_neg(wp_array, np_array): - almost_equals(-wp_array, -np_array) \ No newline at end of file + almost_equals(-wp_array, -np_array) + + +def test_where(wp_array, np_array): + bool_array = (np.random.default_rng(0).random([640, 360, 1]) < 0).tolist() + wp_array = wp.broadcast_to(wp_array.reshape([4]), [640, 360, 4]) + np_array = np.broadcast_to(np_array.reshape([4]), [640, 360, 4]) + wp_where = wp.where(wp.array(bool_array), wp_array, -wp_array) + np_where = np.where(np.array(bool_array), np_array, -np_array) + almost_equals(wp_where, np_where) + + +def test_braodcast_to(): + shape = [1, 160, 1] + new_shape = [1, 160, 2] + bool_array = (np.random.default_rng(0).random(shape) < 0).tolist() + np_array = np.broadcast_to(bool_array, new_shape) + wp_array = wp.broadcast_to(wp.array(bool_array), new_shape) + almost_equals(wp_array, np_array) diff --git a/crates/wgpy_pyo3/wp_tests/test_binary.py b/crates/wgpy_pyo3/wp_tests/test_binary.py index 5a4bbf0..4d7cb2e 100644 --- a/crates/wgpy_pyo3/wp_tests/test_binary.py +++ b/crates/wgpy_pyo3/wp_tests/test_binary.py @@ -1,20 +1,24 @@ import webgpupy as wp import pytest import numpy as np -from test_utils import * +from test_utils import assert_values_nin2, assert_values_nin1 + @pytest.fixture def input_array_1(): return [[1], [2], [0], [4]] + @pytest.fixture def input_array_2(): return [[10], [2], [3], [4]] + @pytest.fixture def wp_array_1(input_array_1): return wp.array(input_array_1) + @pytest.fixture def wp_array_2(input_array_2): return wp.array(input_array_2) @@ -31,14 +35,12 @@ def np_array_2(input_array_2): def test_bitwise_and_u32(wp_array_1, wp_array_2, np_array_1, np_array_2): - assert_values_nin2( - wp_array_1, wp_array_2, np_array_1, np_array_2, 'bitwise_and' - ) + assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, "bitwise_and") + def test_bitwise_or_u32(wp_array_1, wp_array_2, np_array_1, np_array_2): - assert_values_nin2( - wp_array_1, wp_array_2, np_array_1, np_array_2, 'bitwise_or' - ) + assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, "bitwise_or") + -def test_bitwise_or_u32(wp_array_1, np_array_1): - assert_values_nin1(wp_array_1, np_array_1, 'invert') +def test_invert(wp_array_1, np_array_1): + assert_values_nin1(wp_array_1, np_array_1, "invert") diff --git a/crates/wgpy_pyo3/wp_tests/test_logical.py b/crates/wgpy_pyo3/wp_tests/test_logical.py index 8fe479a..3592aa8 100644 --- a/crates/wgpy_pyo3/wp_tests/test_logical.py +++ b/crates/wgpy_pyo3/wp_tests/test_logical.py @@ -38,6 +38,7 @@ def test_eq_f32(wp_array_1, wp_array_2): def test_not_eq_f32(wp_array_1, wp_array_2): assert (wp_array_1 != wp_array_2).tolist() == [[True], [False], [True], [False]] + @pytest.mark.skip(reason="Ignoring temporarily") def test_bitwise_or_u32(input_array_1, input_array_2, wp_array_1, wp_array_2): np_where = np.where([True, True, False, False], input_array_1, input_array_2) diff --git a/crates/wgpy_pyo3/wp_tests/test_misc_math.py b/crates/wgpy_pyo3/wp_tests/test_misc_math.py index 39c4fc9..50dfbc2 100644 --- a/crates/wgpy_pyo3/wp_tests/test_misc_math.py +++ b/crates/wgpy_pyo3/wp_tests/test_misc_math.py @@ -1,7 +1,8 @@ import numpy as np import webgpupy as wp import pytest -from test_utils import * +from test_utils import assert_values_nin2, assert_values_nin1, almost_equals + @pytest.fixture def input_array_1(): @@ -34,22 +35,23 @@ def np_array_2(input_array_2): def test_sqrt(wp_array_1, np_array_1): - assert_values_nin1(wp_array_1, np_array_1, 'sqrt') + assert_values_nin1(wp_array_1, np_array_1, "sqrt") def test_maximum(wp_array_1, wp_array_2, np_array_1, np_array_2): - assert_values_nin2( - wp_array_1, wp_array_2, np_array_1, np_array_2, 'maximum' - ) + assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, "maximum") def test_minimum(wp_array_1, wp_array_2, np_array_1, np_array_2): - assert_values_nin2( - wp_array_1, wp_array_2, np_array_1, np_array_2, 'minimum' - ) + assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, "minimum") def test_clip(wp_array_2, np_array_2): almost_equals(wp.clip(wp_array_2, 0.0, None), np.clip(np_array_2, 0.0, None)) almost_equals(wp.clip(wp_array_2, None, 10.0), np.clip(np_array_2, None, 10.0)) almost_equals(wp.clip(wp_array_2, 0.0, 10.0), np.clip(np_array_2, 0.0, 10.0)) + + +@pytest.mark.skip(reason="Ignoring temporarily") +def test_power(wp_array_1, wp_array_2, np_array_1, np_array_2): + assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, "power") diff --git a/crates/wgpy_pyo3/wp_tests/test_random.py b/crates/wgpy_pyo3/wp_tests/test_random.py index 72f2108..359bb9f 100644 --- a/crates/wgpy_pyo3/wp_tests/test_random.py +++ b/crates/wgpy_pyo3/wp_tests/test_random.py @@ -1,20 +1,7 @@ import webgpupy as wp -from jax import numpy as jp from jax import random -import pytest -from test_utils import * +from test_utils import almost_equals -@pytest.fixture -def input_array_1(): - return [0.0, 1.0, 2.0, 3.0] - -@pytest.fixture -def wp_array_1(input_array_1): - return wp.array(input_array_1) - -@pytest.fixture -def wp_array_1(input_array_1): - return jp.array(input_array_1) def test_random(): key = random.PRNGKey(0) @@ -30,11 +17,12 @@ def test_random(): def test_random_large(): - wp_rand = wp.random.default_rng().random([1920*1080*3]) - jp_rand = random.uniform(random.PRNGKey(0), [1920*1080*3]) + wp_rand = wp.random.default_rng().random([1920 * 1080 * 3]) + jp_rand = random.uniform(random.PRNGKey(0), [1920 * 1080 * 3]) almost_equals(wp_rand, jp_rand) + def test_random_normal(): wp_rand = wp.random.default_rng().normal([100]) jp_rand = random.normal(random.PRNGKey(0), [100]) - almost_equals(wp_rand, jp_rand) \ No newline at end of file + almost_equals(wp_rand, jp_rand) diff --git a/crates/wgpy_pyo3/wp_tests/test_trigonometry.py b/crates/wgpy_pyo3/wp_tests/test_trigonometry.py index e486dfb..9c6de38 100644 --- a/crates/wgpy_pyo3/wp_tests/test_trigonometry.py +++ b/crates/wgpy_pyo3/wp_tests/test_trigonometry.py @@ -1,22 +1,27 @@ import numpy as np import webgpupy as wp -from test_utils import * +from test_utils import assert_values_nin1 import pytest + @pytest.fixture def input_array(): return [0.0, 1.0, 2.0, 3.0] + @pytest.fixture def wp_array(input_array): return wp.array(input_array) + @pytest.fixture def np_array(input_array): return np.array(input_array) + def test_cos(wp_array, np_array): - assert_values_nin1(wp_array, np_array, 'cos') + assert_values_nin1(wp_array, np_array, "cos") + def test_sin(wp_array, np_array): - assert_values_nin1(wp_array, np_array, 'sin') \ No newline at end of file + assert_values_nin1(wp_array, np_array, "sin") diff --git a/crates/wgpy_pyo3/wp_tests/test_utils.py b/crates/wgpy_pyo3/wp_tests/test_utils.py index fce1310..1bfee2e 100644 --- a/crates/wgpy_pyo3/wp_tests/test_utils.py +++ b/crates/wgpy_pyo3/wp_tests/test_utils.py @@ -1,15 +1,18 @@ import numpy as np import webgpupy as wp + def almost_equals(x, y, decimal=6): np.testing.assert_array_almost_equal(x.tolist(), y.tolist(), decimal=decimal) -def assert_values_nin2(wp_array_1,wp_array_2, np_array_1, np_array_2, fn): + +def assert_values_nin2(wp_array_1, wp_array_2, np_array_1, np_array_2, fn): wp_fn = getattr(wp, fn) np_fn = getattr(np, fn) almost_equals(wp_fn(wp_array_1, wp_array_2), np_fn(np_array_1, np_array_2)) + def assert_values_nin1(wp_arr, np_arr, fn): wp_fn = getattr(wp, fn) np_fn = getattr(np, fn) - almost_equals(wp_fn(wp_arr), np_fn(np_arr)) \ No newline at end of file + almost_equals(wp_fn(wp_arr), np_fn(np_arr)) diff --git a/crates/wgpy_random/src/generator.rs b/crates/wgpy_random/src/generator.rs index a1a431e..84f6ddc 100644 --- a/crates/wgpy_random/src/generator.rs +++ b/crates/wgpy_random/src/generator.rs @@ -160,12 +160,12 @@ impl Generator for ThreeFry2x32 { let min_values = &min_value.data; let max_values = &max_value.data; - let diff = sub_op_dyn(&max_values, &min_values, pipeline); + let diff = sub_op_dyn(max_values, min_values, pipeline); floats = mul_op_dyn(&floats, &diff, pipeline); - floats = add_op_dyn(&floats, &min_values, pipeline); + floats = add_op_dyn(&floats, min_values, pipeline); - let data = max_op_dyn(&min_values, &floats, pipeline); + let data = max_op_dyn(min_values, &floats, pipeline); let shape = shape.to_vec(); let dims = shape.len() as u16;