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:
us...@infra.apache.org


Reply via email to