You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/19 01:51:40 UTC

[GitHub] [incubator-tvm] kazum commented on pull request #5830: Rust Refactor Stage 4: Rewrite Rust graph runtime to use new APIs

kazum commented on pull request #5830:
URL: https://github.com/apache/incubator-tvm/pull/5830#issuecomment-646390576


   @jroesch Can we enable derive_default for bindgen?  Otherwise, test_wasm32 fails with tvm-sys because of the generated padding field.
   
   The following change looks necessary which existed in the previous implementation.
   
   ```diff
   diff --git a/rust/tvm-graph-rt/src/array.rs b/rust/tvm-graph-rt/src/array.rs
   index 38519bd..8209b59 100644
   --- a/rust/tvm-graph-rt/src/array.rs
   +++ b/rust/tvm-graph-rt/src/array.rs
   @@ -288,6 +288,7 @@ impl<'a> Tensor<'a> {
                    self.strides.as_ref().unwrap().as_ptr()
                } as *mut i64,
                byte_offset: 0,
   +            ..Default::default()
            }
        }
    }
   diff --git a/rust/tvm-sys/build.rs b/rust/tvm-sys/build.rs
   index 85e16be..01d2934 100644
   --- a/rust/tvm-sys/build.rs
   +++ b/rust/tvm-sys/build.rs
   @@ -54,6 +54,7 @@ fn main() {
            .layout_tests(false)
            .derive_partialeq(true)
            .derive_eq(true)
   +        .derive_default(true)
            .generate()
            .expect("unable to generate bindings")
            .write_to_file(PathBuf::from("src/c_runtime_api.rs"))
   diff --git a/rust/tvm-sys/src/array.rs b/rust/tvm-sys/src/array.rs
   index 1627e9e..5d09d86 100644
   --- a/rust/tvm-sys/src/array.rs
   +++ b/rust/tvm-sys/src/array.rs
   @@ -48,6 +48,7 @@ macro_rules! impl_dltensor_from_ndarray {
                        shape: arr.shape().as_ptr() as *const i64 as *mut i64,
                        strides: arr.strides().as_ptr() as *const i64 as *mut i64,
                        byte_offset: 0,
   +                    ..Default::default()
                    }
                }
            }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org