Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

libDF does not support the Send trait #615

Open
vaisest opened this issue Oct 27, 2024 · 0 comments
Open

libDF does not support the Send trait #615

vaisest opened this issue Oct 27, 2024 · 0 comments

Comments

@vaisest
Copy link

vaisest commented Oct 27, 2024

I have had some troubles with trying to use libDF and following the LADSPA plugin implementation to create a VST version. These mostly seem to stem from the fact that the DfTract model does not support Send. This seems to be caused by the use of TValue, from what I can tell. From what I can tell without real knowledge about tract, it does generally support Send+Sync. Would it be possible to add Send support?

The full error is listed below:

note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
   Compiling vst-filter v0.1.0 (C:\Users\Turtvaiz\Downloads\deepfilter-vst)
error[E0277]: `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
   --> src\lib.rs:62:17
    |
62  | impl Plugin for Vst {
    |                 ^^^ `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
    |
    = help: within `Vst`, the trait `Send` is not implemented for `Rc<tract_data::tensor::Tensor>`, which is required by `Vst: Send`
note: required because it appears within the type `tract_core::value::TValue`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\value.rs:9:10
    |
9   | pub enum TValue {
    |          ^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
note: required by a bound in `nih_plug::prelude::Plugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin.rs:59:29
    |
59  | pub trait Plugin: Default + Send + 'static {
    |                             ^^^^ required by this bound in `Plugin`

error[E0277]: `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
   --> src\lib.rs:62:17
    |
62  | impl Plugin for Vst {
    |                 ^^^ `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `(dyn tract_core::ops::OpState + 'static)`, which is required by `Vst: Send`
    = note: required for `Unique<(dyn tract_core::ops::OpState + 'static)>` to implement `Send`
note: required because it appears within the type `Box<(dyn tract_core::ops::OpState + 'static)>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\boxed.rs:235:12
    |
235 | pub struct Box<
    |            ^^^
note: required because it appears within the type `Option<Box<(dyn tract_core::ops::OpState + 'static)>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `PhantomData<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\marker.rs:741:12
    |
741 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `alloc::raw_vec::RawVec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\raw_vec.rs:75:19
    |
75  | pub(crate) struct RawVec<T, A: Allocator = Global> {
    |                   ^^^^^^
note: required because it appears within the type `Vec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\vec\mod.rs:397:12
    |
397 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |            ^^^
note: required because it appears within the type `SimpleState<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>, SimplePlan<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>>>`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\plan.rs:132:12
    |
132 | pub struct SimpleState<F, O, M, P>
    |            ^^^^^^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
note: required by a bound in `nih_plug::prelude::Plugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin.rs:59:29
    |
59  | pub trait Plugin: Default + Send + 'static {
    |                             ^^^^ required by this bound in `Plugin`
    = note: the full name for the type has been written to 'C:\Users\Turtvaiz\Downloads\deepfilter-vst\target\debug\deps\vst_df.long-type-2428458703810400329.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0277]: `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
   --> src\lib.rs:155:21
    |
155 | impl Vst3Plugin for Vst {
    |                     ^^^ `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
    |
    = help: within `Vst`, the trait `Send` is not implemented for `Rc<tract_data::tensor::Tensor>`, which is required by `Vst: nih_plug::prelude::Plugin`
    = help: the trait `nih_plug::prelude::Plugin` is implemented for `Vst`
note: required because it appears within the type `tract_core::value::TValue`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\value.rs:9:10
    |
9   | pub enum TValue {
    |          ^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
    = note: required for `Vst` to implement `nih_plug::prelude::Plugin`
note: required by a bound in `nih_plug::prelude::Vst3Plugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin\vst3.rs:5:23
    |
5   | pub trait Vst3Plugin: Plugin {
    |                       ^^^^^^ required by this bound in `Vst3Plugin`

error[E0277]: `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
   --> src\lib.rs:155:21
    |
155 | impl Vst3Plugin for Vst {
    |                     ^^^ `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `(dyn tract_core::ops::OpState + 'static)`, which is required by `Vst: nih_plug::prelude::Plugin`
    = help: the trait `nih_plug::prelude::Plugin` is implemented for `Vst`
    = note: required for `Unique<(dyn tract_core::ops::OpState + 'static)>` to implement `Send`
note: required because it appears within the type `Box<(dyn tract_core::ops::OpState + 'static)>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\boxed.rs:235:12
    |
235 | pub struct Box<
    |            ^^^
note: required because it appears within the type `Option<Box<(dyn tract_core::ops::OpState + 'static)>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `PhantomData<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\marker.rs:741:12
    |
741 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `alloc::raw_vec::RawVec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\raw_vec.rs:75:19
    |
75  | pub(crate) struct RawVec<T, A: Allocator = Global> {
    |                   ^^^^^^
note: required because it appears within the type `Vec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\vec\mod.rs:397:12
    |
397 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |            ^^^
note: required because it appears within the type `SimpleState<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>, SimplePlan<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>>>`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\plan.rs:132:12
    |
132 | pub struct SimpleState<F, O, M, P>
    |            ^^^^^^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
    = note: required for `Vst` to implement `nih_plug::prelude::Plugin`
note: required by a bound in `nih_plug::prelude::Vst3Plugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin\vst3.rs:5:23
    |
5   | pub trait Vst3Plugin: Plugin {
    |                       ^^^^^^ required by this bound in `Vst3Plugin`
    = note: the full name for the type has been written to 'C:\Users\Turtvaiz\Downloads\deepfilter-vst\target\debug\deps\vst_df.long-type-2428458703810400329.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0277]: `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
   --> src\lib.rs:163:21
    |
163 | impl ClapPlugin for Vst {
    |                     ^^^ `Rc<tract_data::tensor::Tensor>` cannot be sent between threads safely
    |
    = help: within `Vst`, the trait `Send` is not implemented for `Rc<tract_data::tensor::Tensor>`, which is required by `Vst: nih_plug::prelude::Plugin`
    = help: the trait `nih_plug::prelude::Plugin` is implemented for `Vst`
note: required because it appears within the type `tract_core::value::TValue`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\value.rs:9:10
    |
9   | pub enum TValue {
    |          ^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
    = note: required for `Vst` to implement `nih_plug::prelude::Plugin`
note: required by a bound in `nih_plug::prelude::ClapPlugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin\clap.rs:6:23
    |
6   | pub trait ClapPlugin: Plugin {
    |                       ^^^^^^ required by this bound in `ClapPlugin`

error[E0277]: `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
   --> src\lib.rs:163:21
    |
163 | impl ClapPlugin for Vst {
    |                     ^^^ `(dyn tract_core::ops::OpState + 'static)` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `(dyn tract_core::ops::OpState + 'static)`, which is required by `Vst: nih_plug::prelude::Plugin`
    = help: the trait `nih_plug::prelude::Plugin` is implemented for `Vst`
    = note: required for `Unique<(dyn tract_core::ops::OpState + 'static)>` to implement `Send`
note: required because it appears within the type `Box<(dyn tract_core::ops::OpState + 'static)>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\boxed.rs:235:12
    |
235 | pub struct Box<
    |            ^^^
note: required because it appears within the type `Option<Box<(dyn tract_core::ops::OpState + 'static)>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `PhantomData<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\marker.rs:741:12
    |
741 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `alloc::raw_vec::RawVec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\raw_vec.rs:75:19
    |
75  | pub(crate) struct RawVec<T, A: Allocator = Global> {
    |                   ^^^^^^
note: required because it appears within the type `Vec<Option<Box<(dyn tract_core::ops::OpState + 'static)>>>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\vec\mod.rs:397:12
    |
397 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |            ^^^
note: required because it appears within the type `SimpleState<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>, SimplePlan<TypedFact, Box<dyn TypedOp>, Graph<TypedFact, Box<dyn TypedOp>>>>`
   --> C:\Users\Turtvaiz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tract-core-0.21.4\src\plan.rs:132:12
    |
132 | pub struct SimpleState<F, O, M, P>
    |            ^^^^^^^^^^^
note: required because it appears within the type `df::tract::DfTract`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\deepfilternet-7f2a84b8ce7ebe06\d375b2d\libDF\src\tract.rs:198:12
    |
198 | pub struct DfTract {
    |            ^^^^^^^
note: required because it appears within the type `Option<df::tract::DfTract>`
   --> C:\Users\Turtvaiz\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:571:10
    |
571 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `Vst`
   --> src\lib.rs:6:12
    |
6   | pub struct Vst {
    |            ^^^
    = note: required for `Vst` to implement `nih_plug::prelude::Plugin`
note: required by a bound in `nih_plug::prelude::ClapPlugin`
   --> C:\Users\Turtvaiz\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\dfafe90\src\plugin\clap.rs:6:23
    |
6   | pub trait ClapPlugin: Plugin {
    |                       ^^^^^^ required by this bound in `ClapPlugin`
    = note: the full name for the type has been written to 'C:\Users\Turtvaiz\Downloads\deepfilter-vst\target\debug\deps\vst_df.long-type-2428458703810400329.txt'
    = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0277`.
error: could not compile `vst-filter` (lib) due to 6 previous errors
@vaisest vaisest changed the title libDF does not support the Sync trait libDF does not support the Send trait Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant