Skip to content

[RUST][FRONTEND] refactoring builder to use a derive #2304

Closed

Description

@ehsanmok

Use derive_builder for tvm_frontend::Function for less boilerplate codes. Proper config is required to make the return buffer accepts at most one value. TODO #2292.

Activity

  1. ehsanmok commented on Dec 19, 2018

    @ehsanmok
    ContributorAuthor

    @nhynes don't think #[derive(Builder)]] can add the proper fields in builder struct needed for Function. It is merely for very common type of builders. Currently, derive_builder only uses the fields of the underlying struct, but the rather minimal signature of the current function::Builder is

    pub struct Builder<'a> {
        pub func: Option<Function>,
        pub arg_buf: Option<Box<[TVMArgValue<'a>]>>,
        pub ret_buf: Option<Box<[TVMRetValue]>>,
    }
    

    with completely different fields, in particular arg_buf and ret_buf. So my conclusion is that the derive_builder is not mature enough to handle our case.

    Side note: In my code, I've pretty much followed std::process::Command construct.

  2. ehsanmok commented on Dec 19, 2018

    @ehsanmok
    ContributorAuthor

    Discussed here and will plan for runtime-frontend compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions