From 5b99d30cda39c5afb913fe88f91c63031eeae7ab Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 5 Jul 2022 17:34:21 -0700 Subject: [PATCH] restructure this multi-crate project to use Cargo's "workspace" feature this solves an issue in the Nix build, where managing multiple Cargo.lock files is otherwise tricky. it causes (or fails to fix?) an adjacent issue where the spirv builder doesn't seem to have everything it needs vendored. --- Cargo.lock | 38 ++++-- Cargo.toml | 71 ++--------- crates/coremem/Cargo.toml | 62 ++++++++++ {benches => crates/coremem/benches}/driver.rs | 0 .../coremem/benches}/history.txt | 0 .../coremem/examples}/archive/README.md | 0 .../examples}/archive/buffer_proto1.rs | 0 .../examples}/archive/buffer_proto2.rs | 0 .../examples}/archive/buffer_proto3.rs | 0 .../examples}/archive/buffer_proto4.rs | 0 .../examples}/archive/minimal_torus.rs | 0 .../coremem/examples}/archive/pml.rs | 0 .../coremem/examples}/archive/toroid25d.rs | 0 .../examples}/archive/wrapped_torus.rs | 0 .../coremem/examples}/buffer_proto5.rs | 0 .../coremem/examples}/sr_latch.rs | 0 .../coremem/examples}/wavefront.rs | 0 {src => crates/coremem/src}/bin/bench.rs | 0 {src => crates/coremem/src}/bin/csv.rs | 0 {src => crates/coremem/src}/bin/decimate.rs | 0 {src => crates/coremem/src}/bin/pml_tuning.rs | 0 {src => crates/coremem/src}/bin/viewer.rs | 0 {src => crates/coremem/src}/driver.rs | 0 {src => crates/coremem/src}/geom/line.rs | 0 {src => crates/coremem/src}/geom/mod.rs | 0 {src => crates/coremem/src}/geom/polygon.rs | 0 .../coremem/src}/geom/region/mod.rs | 0 .../coremem/src}/geom/region/primitives.rs | 0 {src => crates/coremem/src}/geom/units.rs | 0 {src => crates/coremem/src}/geom/vec.rs | 0 {src => crates/coremem/src}/geom/vecu.rs | 0 {src => crates/coremem/src}/lib.rs | 0 .../coremem/src}/mat/bh_ferromagnet.rs | 0 {src => crates/coremem/src}/mat/db.rs | 0 {src => crates/coremem/src}/mat/linear.rs | 0 .../coremem/src}/mat/mb_ferromagnet.rs | 0 .../coremem/src}/mat/mh_ferromagnet.rs | 0 {src => crates/coremem/src}/mat/mod.rs | 0 {src => crates/coremem/src}/meas.rs | 0 {src => crates/coremem/src}/post.rs | 0 {src => crates/coremem/src}/real.rs | 0 {src => crates/coremem/src}/render.rs | 0 {src => crates/coremem/src}/sim/mod.rs | 0 .../coremem/src}/sim/spirv/bindings.rs | 0 {src => crates/coremem/src}/sim/spirv/mod.rs | 0 {src => crates/coremem/src}/sim/units.rs | 0 {src => crates/coremem/src}/stim.rs | 0 {src => crates/coremem/src}/util/cache.rs | 0 {src => crates/coremem/src}/util/mod.rs | 0 .../spirv => crates}/spirv_backend/Cargo.toml | 0 .../spirv => crates}/spirv_backend/src/lib.rs | 0 .../spirv_backend/src/main.rs | 0 .../spirv => crates}/spirv_backend/src/mat.rs | 0 .../spirv => crates}/spirv_backend/src/sim.rs | 0 .../spirv_backend/src/support.rs | 0 .../spirv_backend_builder/Cargo.toml | 1 - .../spirv_backend_builder/src/main.rs | 7 +- .../spirv_backend_lib/Cargo.toml | 0 .../spirv => crates}/spirv_backend_lib/src | 0 .../spirv_backend_runner/Cargo.toml | 0 .../spirv_backend_runner/build.rs | 21 +--- .../spirv_backend_runner/src/lib.rs | 2 +- flake.nix | 2 +- src/sim/spirv/spirv_backend/Cargo.lock | 110 ------------------ 64 files changed, 108 insertions(+), 206 deletions(-) create mode 100644 crates/coremem/Cargo.toml rename {benches => crates/coremem/benches}/driver.rs (100%) rename {benches => crates/coremem/benches}/history.txt (100%) rename {examples => crates/coremem/examples}/archive/README.md (100%) rename {examples => crates/coremem/examples}/archive/buffer_proto1.rs (100%) rename {examples => crates/coremem/examples}/archive/buffer_proto2.rs (100%) rename {examples => crates/coremem/examples}/archive/buffer_proto3.rs (100%) rename {examples => crates/coremem/examples}/archive/buffer_proto4.rs (100%) rename {examples => crates/coremem/examples}/archive/minimal_torus.rs (100%) rename {examples => crates/coremem/examples}/archive/pml.rs (100%) rename {examples => crates/coremem/examples}/archive/toroid25d.rs (100%) rename {examples => crates/coremem/examples}/archive/wrapped_torus.rs (100%) rename {examples => crates/coremem/examples}/buffer_proto5.rs (100%) rename {examples => crates/coremem/examples}/sr_latch.rs (100%) rename {examples => crates/coremem/examples}/wavefront.rs (100%) rename {src => crates/coremem/src}/bin/bench.rs (100%) rename {src => crates/coremem/src}/bin/csv.rs (100%) rename {src => crates/coremem/src}/bin/decimate.rs (100%) rename {src => crates/coremem/src}/bin/pml_tuning.rs (100%) rename {src => crates/coremem/src}/bin/viewer.rs (100%) rename {src => crates/coremem/src}/driver.rs (100%) rename {src => crates/coremem/src}/geom/line.rs (100%) rename {src => crates/coremem/src}/geom/mod.rs (100%) rename {src => crates/coremem/src}/geom/polygon.rs (100%) rename {src => crates/coremem/src}/geom/region/mod.rs (100%) rename {src => crates/coremem/src}/geom/region/primitives.rs (100%) rename {src => crates/coremem/src}/geom/units.rs (100%) rename {src => crates/coremem/src}/geom/vec.rs (100%) rename {src => crates/coremem/src}/geom/vecu.rs (100%) rename {src => crates/coremem/src}/lib.rs (100%) rename {src => crates/coremem/src}/mat/bh_ferromagnet.rs (100%) rename {src => crates/coremem/src}/mat/db.rs (100%) rename {src => crates/coremem/src}/mat/linear.rs (100%) rename {src => crates/coremem/src}/mat/mb_ferromagnet.rs (100%) rename {src => crates/coremem/src}/mat/mh_ferromagnet.rs (100%) rename {src => crates/coremem/src}/mat/mod.rs (100%) rename {src => crates/coremem/src}/meas.rs (100%) rename {src => crates/coremem/src}/post.rs (100%) rename {src => crates/coremem/src}/real.rs (100%) rename {src => crates/coremem/src}/render.rs (100%) rename {src => crates/coremem/src}/sim/mod.rs (100%) rename {src => crates/coremem/src}/sim/spirv/bindings.rs (100%) rename {src => crates/coremem/src}/sim/spirv/mod.rs (100%) rename {src => crates/coremem/src}/sim/units.rs (100%) rename {src => crates/coremem/src}/stim.rs (100%) rename {src => crates/coremem/src}/util/cache.rs (100%) rename {src => crates/coremem/src}/util/mod.rs (100%) rename {src/sim/spirv => crates}/spirv_backend/Cargo.toml (100%) rename {src/sim/spirv => crates}/spirv_backend/src/lib.rs (100%) rename {src/sim/spirv => crates}/spirv_backend/src/main.rs (100%) rename {src/sim/spirv => crates}/spirv_backend/src/mat.rs (100%) rename {src/sim/spirv => crates}/spirv_backend/src/sim.rs (100%) rename {src/sim/spirv => crates}/spirv_backend/src/support.rs (100%) rename {src/sim/spirv => crates}/spirv_backend_builder/Cargo.toml (95%) rename {src/sim/spirv => crates}/spirv_backend_builder/src/main.rs (86%) rename {src/sim/spirv => crates}/spirv_backend_lib/Cargo.toml (100%) rename {src/sim/spirv => crates}/spirv_backend_lib/src (100%) rename {src/sim/spirv => crates}/spirv_backend_runner/Cargo.toml (100%) rename {src/sim/spirv => crates}/spirv_backend_runner/build.rs (82%) rename {src/sim/spirv => crates}/spirv_backend_runner/src/lib.rs (69%) delete mode 100644 src/sim/spirv/spirv_backend/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock index dae23be..4e7eee1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1355,9 +1355,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "oorandom" @@ -1462,9 +1462,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "plotters" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +checksum = "9428003b84df1496fb9d6eeee9c5f8145cb41ca375eb0dad204328888832811f" dependencies = [ "num-traits", "plotters-backend", @@ -1475,15 +1475,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" +checksum = "1c89e57ae773e34419b0f62d68c1934a97ac0637f36741dfde4efb88aaf711a0" [[package]] name = "plotters-svg" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +checksum = "e0918736323d1baff32ee0eade54984f6f201ad7e97d5cfb5d6ab4a358529615" dependencies = [ "plotters-backend", ] @@ -1696,9 +1696,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -1713,9 +1713,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "renderdoc-sys" @@ -2031,6 +2031,20 @@ name = "spirv-types" version = "0.4.0-alpha.12" source = "git+https://github.com/EmbarkStudios/rust-gpu#0866cf591a7fdbbd15bdb3468e192bb9b6189fd0" +[[package]] +name = "spirv_backend" +version = "0.1.0" +dependencies = [ + "spirv-std", +] + +[[package]] +name = "spirv_backend_builder" +version = "0.1.0" +dependencies = [ + "spirv-builder", +] + [[package]] name = "spirv_backend_lib" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7d6c481..b9d6899 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,65 +1,12 @@ -[package] -name = "coremem" -version = "0.1.0" -authors = ["Colin "] -edition = "2021" - -[lib] -crate-type = ["lib"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -bincode = "1.3" # MIT -common_macros = "0.1" # MIT or Apache 2.0 -crossterm = "0.24" # MIT -csv = "1.1" # MIT or Unlicense -dashmap = "5.3" # MIT -decorum = "0.3" # MIT -dyn-clone = "1.0" # MIT or Apache 2.0 -enum_dispatch = "0.3" # MIT or Apache 2.0 -env_logger = "0.9" # MIT or Apache 2.0 -float_eq = "1.0" # MIT or Apache 2.0 -font8x8 = "0.3" # MIT -futures = "0.3" # MIT or Apache 2.0 -image = "0.24" # MIT -imageproc = "0.23" # MIT -indexmap = "1.9" # MIT or Apache 2.0 -itertools = "0.10" # MIT or Apache 2.0 -lazy_static = "1.4" # MIT or Apache 2.0 -log = "0.4" # MIT or Apache 2.0 -lru = "0.7" # MIT -more-asserts = "0.3" # CC0-1.0 -natord = "1.0" # MIT -ndarray = { version = "0.15", features = ["rayon", "serde"] } # MIT or Apache 2.0 -num = "0.4" # MIT or Apache 2.0 -# plotly = { version = "0.6", features = ["kaleido", "plotly_ndarray"], path = "../plotly/plotly" } -rand = "0.8" # MIT or Apache 2.0 -rayon = "1.5" # MIT or Apache 2.0 -serde = "1.0" # MIT or Apache 2.0 -structopt = "0.3" # MIT or Apache 2.0 -threadpool = "1.8" # MIT or Apache 2.0 -typetag = "0.2" # MIT or Apache 2.0 -y4m = "0.7" # MIT - -wgpu = "0.12" -# wgpu = { version = "0.12", features = ["spirv"] } # MIT or Apache 2.0 -# TODO: update to 0.13 -# wgpu = { version = "0.13", features = ["spirv", "vulkan-portability"] } # MIT or Apache 2.0 -# spirv-* is MIT or Apache 2.0 -spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["use-compiled-tools"] } -spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu" } -spirv-std-macros = { git = "https://github.com/EmbarkStudios/rust-gpu" } -spirv_backend_lib = { path = "src/sim/spirv/spirv_backend_lib" } -spirv_backend_runner = { path = "src/sim/spirv/spirv_backend_runner" } - - -[dev-dependencies] -criterion = "0.3" - -[[bench]] -name = "driver" -harness = false +[workspace] +resolver = "2" +members = [ + "crates/coremem", + "crates/spirv_backend", + "crates/spirv_backend_builder", + "crates/spirv_backend_lib", + "crates/spirv_backend_runner", +] # [profile.release] # LTO gives 3% perf boost diff --git a/crates/coremem/Cargo.toml b/crates/coremem/Cargo.toml new file mode 100644 index 0000000..1ef5345 --- /dev/null +++ b/crates/coremem/Cargo.toml @@ -0,0 +1,62 @@ +[package] +name = "coremem" +version = "0.1.0" +authors = ["Colin "] +edition = "2021" + +[lib] +crate-type = ["lib"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +bincode = "1.3" # MIT +common_macros = "0.1" # MIT or Apache 2.0 +crossterm = "0.24" # MIT +csv = "1.1" # MIT or Unlicense +dashmap = "5.3" # MIT +decorum = "0.3" # MIT +dyn-clone = "1.0" # MIT or Apache 2.0 +enum_dispatch = "0.3" # MIT or Apache 2.0 +env_logger = "0.9" # MIT or Apache 2.0 +float_eq = "1.0" # MIT or Apache 2.0 +font8x8 = "0.3" # MIT +futures = "0.3" # MIT or Apache 2.0 +image = "0.24" # MIT +imageproc = "0.23" # MIT +indexmap = "1.9" # MIT or Apache 2.0 +itertools = "0.10" # MIT or Apache 2.0 +lazy_static = "1.4" # MIT or Apache 2.0 +log = "0.4" # MIT or Apache 2.0 +lru = "0.7" # MIT +more-asserts = "0.3" # CC0-1.0 +natord = "1.0" # MIT +ndarray = { version = "0.15", features = ["rayon", "serde"] } # MIT or Apache 2.0 +num = "0.4" # MIT or Apache 2.0 +# plotly = { version = "0.6", features = ["kaleido", "plotly_ndarray"], path = "../plotly/plotly" } +rand = "0.8" # MIT or Apache 2.0 +rayon = "1.5" # MIT or Apache 2.0 +serde = "1.0" # MIT or Apache 2.0 +structopt = "0.3" # MIT or Apache 2.0 +threadpool = "1.8" # MIT or Apache 2.0 +typetag = "0.2" # MIT or Apache 2.0 +y4m = "0.7" # MIT + +wgpu = "0.12" +# wgpu = { version = "0.12", features = ["spirv"] } # MIT or Apache 2.0 +# TODO: update to 0.13 +# wgpu = { version = "0.13", features = ["spirv", "vulkan-portability"] } # MIT or Apache 2.0 +# spirv-* is MIT or Apache 2.0 +spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["use-compiled-tools"] } +spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu" } +spirv-std-macros = { git = "https://github.com/EmbarkStudios/rust-gpu" } +spirv_backend_lib = { path = "../spirv_backend_lib" } +spirv_backend_runner = { path = "../spirv_backend_runner" } + + +[dev-dependencies] +criterion = "0.3" + +[[bench]] +name = "driver" +harness = false diff --git a/benches/driver.rs b/crates/coremem/benches/driver.rs similarity index 100% rename from benches/driver.rs rename to crates/coremem/benches/driver.rs diff --git a/benches/history.txt b/crates/coremem/benches/history.txt similarity index 100% rename from benches/history.txt rename to crates/coremem/benches/history.txt diff --git a/examples/archive/README.md b/crates/coremem/examples/archive/README.md similarity index 100% rename from examples/archive/README.md rename to crates/coremem/examples/archive/README.md diff --git a/examples/archive/buffer_proto1.rs b/crates/coremem/examples/archive/buffer_proto1.rs similarity index 100% rename from examples/archive/buffer_proto1.rs rename to crates/coremem/examples/archive/buffer_proto1.rs diff --git a/examples/archive/buffer_proto2.rs b/crates/coremem/examples/archive/buffer_proto2.rs similarity index 100% rename from examples/archive/buffer_proto2.rs rename to crates/coremem/examples/archive/buffer_proto2.rs diff --git a/examples/archive/buffer_proto3.rs b/crates/coremem/examples/archive/buffer_proto3.rs similarity index 100% rename from examples/archive/buffer_proto3.rs rename to crates/coremem/examples/archive/buffer_proto3.rs diff --git a/examples/archive/buffer_proto4.rs b/crates/coremem/examples/archive/buffer_proto4.rs similarity index 100% rename from examples/archive/buffer_proto4.rs rename to crates/coremem/examples/archive/buffer_proto4.rs diff --git a/examples/archive/minimal_torus.rs b/crates/coremem/examples/archive/minimal_torus.rs similarity index 100% rename from examples/archive/minimal_torus.rs rename to crates/coremem/examples/archive/minimal_torus.rs diff --git a/examples/archive/pml.rs b/crates/coremem/examples/archive/pml.rs similarity index 100% rename from examples/archive/pml.rs rename to crates/coremem/examples/archive/pml.rs diff --git a/examples/archive/toroid25d.rs b/crates/coremem/examples/archive/toroid25d.rs similarity index 100% rename from examples/archive/toroid25d.rs rename to crates/coremem/examples/archive/toroid25d.rs diff --git a/examples/archive/wrapped_torus.rs b/crates/coremem/examples/archive/wrapped_torus.rs similarity index 100% rename from examples/archive/wrapped_torus.rs rename to crates/coremem/examples/archive/wrapped_torus.rs diff --git a/examples/buffer_proto5.rs b/crates/coremem/examples/buffer_proto5.rs similarity index 100% rename from examples/buffer_proto5.rs rename to crates/coremem/examples/buffer_proto5.rs diff --git a/examples/sr_latch.rs b/crates/coremem/examples/sr_latch.rs similarity index 100% rename from examples/sr_latch.rs rename to crates/coremem/examples/sr_latch.rs diff --git a/examples/wavefront.rs b/crates/coremem/examples/wavefront.rs similarity index 100% rename from examples/wavefront.rs rename to crates/coremem/examples/wavefront.rs diff --git a/src/bin/bench.rs b/crates/coremem/src/bin/bench.rs similarity index 100% rename from src/bin/bench.rs rename to crates/coremem/src/bin/bench.rs diff --git a/src/bin/csv.rs b/crates/coremem/src/bin/csv.rs similarity index 100% rename from src/bin/csv.rs rename to crates/coremem/src/bin/csv.rs diff --git a/src/bin/decimate.rs b/crates/coremem/src/bin/decimate.rs similarity index 100% rename from src/bin/decimate.rs rename to crates/coremem/src/bin/decimate.rs diff --git a/src/bin/pml_tuning.rs b/crates/coremem/src/bin/pml_tuning.rs similarity index 100% rename from src/bin/pml_tuning.rs rename to crates/coremem/src/bin/pml_tuning.rs diff --git a/src/bin/viewer.rs b/crates/coremem/src/bin/viewer.rs similarity index 100% rename from src/bin/viewer.rs rename to crates/coremem/src/bin/viewer.rs diff --git a/src/driver.rs b/crates/coremem/src/driver.rs similarity index 100% rename from src/driver.rs rename to crates/coremem/src/driver.rs diff --git a/src/geom/line.rs b/crates/coremem/src/geom/line.rs similarity index 100% rename from src/geom/line.rs rename to crates/coremem/src/geom/line.rs diff --git a/src/geom/mod.rs b/crates/coremem/src/geom/mod.rs similarity index 100% rename from src/geom/mod.rs rename to crates/coremem/src/geom/mod.rs diff --git a/src/geom/polygon.rs b/crates/coremem/src/geom/polygon.rs similarity index 100% rename from src/geom/polygon.rs rename to crates/coremem/src/geom/polygon.rs diff --git a/src/geom/region/mod.rs b/crates/coremem/src/geom/region/mod.rs similarity index 100% rename from src/geom/region/mod.rs rename to crates/coremem/src/geom/region/mod.rs diff --git a/src/geom/region/primitives.rs b/crates/coremem/src/geom/region/primitives.rs similarity index 100% rename from src/geom/region/primitives.rs rename to crates/coremem/src/geom/region/primitives.rs diff --git a/src/geom/units.rs b/crates/coremem/src/geom/units.rs similarity index 100% rename from src/geom/units.rs rename to crates/coremem/src/geom/units.rs diff --git a/src/geom/vec.rs b/crates/coremem/src/geom/vec.rs similarity index 100% rename from src/geom/vec.rs rename to crates/coremem/src/geom/vec.rs diff --git a/src/geom/vecu.rs b/crates/coremem/src/geom/vecu.rs similarity index 100% rename from src/geom/vecu.rs rename to crates/coremem/src/geom/vecu.rs diff --git a/src/lib.rs b/crates/coremem/src/lib.rs similarity index 100% rename from src/lib.rs rename to crates/coremem/src/lib.rs diff --git a/src/mat/bh_ferromagnet.rs b/crates/coremem/src/mat/bh_ferromagnet.rs similarity index 100% rename from src/mat/bh_ferromagnet.rs rename to crates/coremem/src/mat/bh_ferromagnet.rs diff --git a/src/mat/db.rs b/crates/coremem/src/mat/db.rs similarity index 100% rename from src/mat/db.rs rename to crates/coremem/src/mat/db.rs diff --git a/src/mat/linear.rs b/crates/coremem/src/mat/linear.rs similarity index 100% rename from src/mat/linear.rs rename to crates/coremem/src/mat/linear.rs diff --git a/src/mat/mb_ferromagnet.rs b/crates/coremem/src/mat/mb_ferromagnet.rs similarity index 100% rename from src/mat/mb_ferromagnet.rs rename to crates/coremem/src/mat/mb_ferromagnet.rs diff --git a/src/mat/mh_ferromagnet.rs b/crates/coremem/src/mat/mh_ferromagnet.rs similarity index 100% rename from src/mat/mh_ferromagnet.rs rename to crates/coremem/src/mat/mh_ferromagnet.rs diff --git a/src/mat/mod.rs b/crates/coremem/src/mat/mod.rs similarity index 100% rename from src/mat/mod.rs rename to crates/coremem/src/mat/mod.rs diff --git a/src/meas.rs b/crates/coremem/src/meas.rs similarity index 100% rename from src/meas.rs rename to crates/coremem/src/meas.rs diff --git a/src/post.rs b/crates/coremem/src/post.rs similarity index 100% rename from src/post.rs rename to crates/coremem/src/post.rs diff --git a/src/real.rs b/crates/coremem/src/real.rs similarity index 100% rename from src/real.rs rename to crates/coremem/src/real.rs diff --git a/src/render.rs b/crates/coremem/src/render.rs similarity index 100% rename from src/render.rs rename to crates/coremem/src/render.rs diff --git a/src/sim/mod.rs b/crates/coremem/src/sim/mod.rs similarity index 100% rename from src/sim/mod.rs rename to crates/coremem/src/sim/mod.rs diff --git a/src/sim/spirv/bindings.rs b/crates/coremem/src/sim/spirv/bindings.rs similarity index 100% rename from src/sim/spirv/bindings.rs rename to crates/coremem/src/sim/spirv/bindings.rs diff --git a/src/sim/spirv/mod.rs b/crates/coremem/src/sim/spirv/mod.rs similarity index 100% rename from src/sim/spirv/mod.rs rename to crates/coremem/src/sim/spirv/mod.rs diff --git a/src/sim/units.rs b/crates/coremem/src/sim/units.rs similarity index 100% rename from src/sim/units.rs rename to crates/coremem/src/sim/units.rs diff --git a/src/stim.rs b/crates/coremem/src/stim.rs similarity index 100% rename from src/stim.rs rename to crates/coremem/src/stim.rs diff --git a/src/util/cache.rs b/crates/coremem/src/util/cache.rs similarity index 100% rename from src/util/cache.rs rename to crates/coremem/src/util/cache.rs diff --git a/src/util/mod.rs b/crates/coremem/src/util/mod.rs similarity index 100% rename from src/util/mod.rs rename to crates/coremem/src/util/mod.rs diff --git a/src/sim/spirv/spirv_backend/Cargo.toml b/crates/spirv_backend/Cargo.toml similarity index 100% rename from src/sim/spirv/spirv_backend/Cargo.toml rename to crates/spirv_backend/Cargo.toml diff --git a/src/sim/spirv/spirv_backend/src/lib.rs b/crates/spirv_backend/src/lib.rs similarity index 100% rename from src/sim/spirv/spirv_backend/src/lib.rs rename to crates/spirv_backend/src/lib.rs diff --git a/src/sim/spirv/spirv_backend/src/main.rs b/crates/spirv_backend/src/main.rs similarity index 100% rename from src/sim/spirv/spirv_backend/src/main.rs rename to crates/spirv_backend/src/main.rs diff --git a/src/sim/spirv/spirv_backend/src/mat.rs b/crates/spirv_backend/src/mat.rs similarity index 100% rename from src/sim/spirv/spirv_backend/src/mat.rs rename to crates/spirv_backend/src/mat.rs diff --git a/src/sim/spirv/spirv_backend/src/sim.rs b/crates/spirv_backend/src/sim.rs similarity index 100% rename from src/sim/spirv/spirv_backend/src/sim.rs rename to crates/spirv_backend/src/sim.rs diff --git a/src/sim/spirv/spirv_backend/src/support.rs b/crates/spirv_backend/src/support.rs similarity index 100% rename from src/sim/spirv/spirv_backend/src/support.rs rename to crates/spirv_backend/src/support.rs diff --git a/src/sim/spirv/spirv_backend_builder/Cargo.toml b/crates/spirv_backend_builder/Cargo.toml similarity index 95% rename from src/sim/spirv/spirv_backend_builder/Cargo.toml rename to crates/spirv_backend_builder/Cargo.toml index fa57751..8074ad3 100644 --- a/src/sim/spirv/spirv_backend_builder/Cargo.toml +++ b/crates/spirv_backend_builder/Cargo.toml @@ -5,5 +5,4 @@ authors = ["Colin "] edition = "2021" [dependencies] -log = "0.4" spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["use-compiled-tools"] } diff --git a/src/sim/spirv/spirv_backend_builder/src/main.rs b/crates/spirv_backend_builder/src/main.rs similarity index 86% rename from src/sim/spirv/spirv_backend_builder/src/main.rs rename to crates/spirv_backend_builder/src/main.rs index 227157a..9d05c6f 100644 --- a/src/sim/spirv/spirv_backend_builder/src/main.rs +++ b/crates/spirv_backend_builder/src/main.rs @@ -1,5 +1,4 @@ use spirv_builder::{Capability, MetadataPrintout, SpirvBuilder}; -use log::info; use std::env; use std::error::Error; use std::path::PathBuf; @@ -11,7 +10,7 @@ fn main() -> Result<(), Box> { .iter() .copied() .collect::(); - info!("get_shader: constructing builder"); + println!("get_shader: constructing builder"); let builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.1") //let builder = SpirvBuilder::new(crate_path, "spirv-unknown-spv1.3") .print_metadata(MetadataPrintout::None) @@ -21,10 +20,10 @@ fn main() -> Result<(), Box> { // .capability(Capability::GenericPointer) ; - info!("get_shader: building"); + println!("get_shader: building"); let initial_result = builder.build()?; let module_path = initial_result.module.unwrap_single(); - info!("get_shader: built: {:?}", module_path); + println!("get_shader: built: {:?}", module_path); Ok(()) } diff --git a/src/sim/spirv/spirv_backend_lib/Cargo.toml b/crates/spirv_backend_lib/Cargo.toml similarity index 100% rename from src/sim/spirv/spirv_backend_lib/Cargo.toml rename to crates/spirv_backend_lib/Cargo.toml diff --git a/src/sim/spirv/spirv_backend_lib/src b/crates/spirv_backend_lib/src similarity index 100% rename from src/sim/spirv/spirv_backend_lib/src rename to crates/spirv_backend_lib/src diff --git a/src/sim/spirv/spirv_backend_runner/Cargo.toml b/crates/spirv_backend_runner/Cargo.toml similarity index 100% rename from src/sim/spirv/spirv_backend_runner/Cargo.toml rename to crates/spirv_backend_runner/Cargo.toml diff --git a/src/sim/spirv/spirv_backend_runner/build.rs b/crates/spirv_backend_runner/build.rs similarity index 82% rename from src/sim/spirv/spirv_backend_runner/build.rs rename to crates/spirv_backend_runner/build.rs index cfd6f83..8b6e78a 100644 --- a/src/sim/spirv/spirv_backend_runner/build.rs +++ b/crates/spirv_backend_runner/build.rs @@ -12,22 +12,13 @@ fn main() -> Result<(), Box> { let profile = env::var("PROFILE").unwrap(); println!("cargo:rustc-env=PROFILE={}", profile); let mut dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + println!("OUT_DIR: {:?}", dir); // recover the directory from which this was invoked - assert!( - dir.ends_with("out") - && dir.pop() - && dir.pop() - && dir.ends_with("build") - && dir.pop() - && dir.ends_with(profile) - && dir.pop() - ); + while !dir.ends_with("target") { + dir.pop(); + } + assert!(dir.pop()); - // recover the toplevel directory - assert!( - dir.ends_with("target") - && dir.pop() - ); if dir.ends_with("spirv_backend_runner") { // being run from this dir assert!( @@ -42,7 +33,7 @@ fn main() -> Result<(), Box> { } // else already at the top-level dir let target_dir = dir.join("target/spirv_backend_builder"); - let manifest_path = dir.join("src/sim/spirv/spirv_backend_builder/Cargo.toml"); + let manifest_path = dir.join("crates/spirv_backend_builder/Cargo.toml"); println!("target_dir: {:?}", target_dir); println!("manifest_path: {:?}", manifest_path); diff --git a/src/sim/spirv/spirv_backend_runner/src/lib.rs b/crates/spirv_backend_runner/src/lib.rs similarity index 69% rename from src/sim/spirv/spirv_backend_runner/src/lib.rs rename to crates/spirv_backend_runner/src/lib.rs index 2889b6f..74a44dc 100644 --- a/src/sim/spirv/spirv_backend_runner/src/lib.rs +++ b/crates/spirv_backend_runner/src/lib.rs @@ -3,6 +3,6 @@ pub fn spirv_module() -> &'static [u8] { // we specifically include the bytes into this binary, for ease of packaging (v.s. attempting // to locate the compiled result at runtime). - include_bytes!("../../../../../target/spirv-builder/spirv-unknown-vulkan1.1/release/deps/spirv_backend.spv.dir/module") + include_bytes!("../../../target/spirv-builder/spirv-unknown-vulkan1.1/release/deps/spirv_backend.spv.dir/module") } diff --git a/flake.nix b/flake.nix index f70823c..ff0d70f 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,7 @@ cargoLock = { lockFile = ./Cargo.lock; outputHashes = { - "rustc_codegen_spirv-0.4.0-alpha.12" = "sha256-T0WRXsCgPW6/mygmCfZ3ee1xnigfaG4YuDjIb/DZ0t8="; + "rustc_codegen_spirv-0.4.0-alpha.12" = "sha256-cZTUuyvNBuunK60r6vWVqqlovTXGpZZphBU8VP6tjsU="; }; }; # rgpu tests expectedly fail due to a lack of spirv adapter exposed to the builder. diff --git a/src/sim/spirv/spirv_backend/Cargo.lock b/src/sim/spirv/spirv_backend/Cargo.lock deleted file mode 100644 index e5126ab..0000000 --- a/src/sim/spirv/spirv_backend/Cargo.lock +++ /dev/null @@ -1,110 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "glam" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43e957e744be03f5801a55472f593d43fabdebf25a4585db250f04d86b1675f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "libm" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "spirv-std" -version = "0.4.0-alpha.12" -source = "git+https://github.com/EmbarkStudios/rust-gpu#0866cf591a7fdbbd15bdb3468e192bb9b6189fd0" -dependencies = [ - "bitflags", - "glam", - "num-traits", - "spirv-std-macros", - "spirv-types", -] - -[[package]] -name = "spirv-std-macros" -version = "0.4.0-alpha.12" -source = "git+https://github.com/EmbarkStudios/rust-gpu#0866cf591a7fdbbd15bdb3468e192bb9b6189fd0" -dependencies = [ - "proc-macro2", - "quote", - "spirv-types", - "syn", -] - -[[package]] -name = "spirv-types" -version = "0.4.0-alpha.12" -source = "git+https://github.com/EmbarkStudios/rust-gpu#0866cf591a7fdbbd15bdb3468e192bb9b6189fd0" - -[[package]] -name = "spirv_backend" -version = "0.1.0" -dependencies = [ - "spirv-std", -] - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"