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

[1/3][AOT][DeviceAPI] Connecting devices structure to relevant operators #9395

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

Mousius
Copy link
Member

@Mousius Mousius commented Oct 29, 2021

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};

Which is then added as an argument to the entry function:

/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson grant.watson@arm.com

@Mousius
Copy link
Member Author

Mousius commented Oct 29, 2021

@areusch I've done the bare minimum to wire this through here, and want to follow up later with the cpacked variant that was actually working pretty well from just variables rather than adding the resource_handle attribute.

@Mousius Mousius force-pushed the device-api-wiring branch 3 times, most recently from 4198fb6 to 9959a13 Compare October 29, 2021 11:09
@Mousius Mousius requested a review from icemelon as a code owner November 8, 2021 10:59
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mousius thanks for this. just a couple comments here

@Mousius Mousius force-pushed the device-api-wiring branch 2 times, most recently from 45f05d6 to 442ab30 Compare November 9, 2021 18:30
Copy link
Contributor

@mbs-octoml mbs-octoml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A personal appeal from Mark not to add more to te_compiler.cc

:-)

@mbs-octoml
Copy link
Contributor

LGTM from me.

Mousius and others added 2 commits November 12, 2021 11:12
This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>
@Mousius Mousius changed the title [AOT][DeviceAPI] Connecting devices structure to relevant operators [1/3][AOT][DeviceAPI] Connecting devices structure to relevant operators Nov 12, 2021
@areusch areusch merged commit 67714c6 into apache:main Nov 12, 2021
@areusch
Copy link
Contributor

areusch commented Nov 12, 2021

thanks @Mousius @mbs-octoml the PR is now merged!

@Mousius Mousius deleted the device-api-wiring branch November 12, 2021 20:43
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
…ors (apache#9395)

* [AOT][DeviceAPI] Connecting devices structure to relevant operators

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>

* Correct "use_device_api" attribute name on Target

Co-authored-by: Grant Watson <grant.watson@arm.com>
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
…ors (apache#9395)

* [AOT][DeviceAPI] Connecting devices structure to relevant operators

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>

* Correct "use_device_api" attribute name on Target

Co-authored-by: Grant Watson <grant.watson@arm.com>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
…ors (apache#9395)

* [AOT][DeviceAPI] Connecting devices structure to relevant operators

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>

* Correct "use_device_api" attribute name on Target

Co-authored-by: Grant Watson <grant.watson@arm.com>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
…ors (apache#9395)

* [AOT][DeviceAPI] Connecting devices structure to relevant operators

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>

* Correct "use_device_api" attribute name on Target

Co-authored-by: Grant Watson <grant.watson@arm.com>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…ors (apache#9395)

* [AOT][DeviceAPI] Connecting devices structure to relevant operators

This patch adds support for passing the device context via the unpacked API in AOT, generating an additional struct if necessary:

```c
/*!
 * \brief Device context pointers for TVM module "default"
 */
struct tvmgen_default_devices {
  void* npu;
};
```

Which is then added as an argument to the entry function:
```c
/*!
 * \brief entrypoint function for TVM module "default"
 * \param inputs Input tensors for the module
 * \param outputs Output tensors for the module
 * \param devices Device context pointers for the module
 */
int32_t tvmgen_default_run(
  struct tvmgen_default_inputs* inputs,
  struct tvmgen_default_outputs* outputs,
  struct tvmgen_default_devices* devices
);
```

I've temporarily added the collection of external code generators to the TE compiler pending proper annotation of the eventual functions.

Co-authored-by: Grant Watson <grant.watson@arm.com>

* Correct "use_device_api" attribute name on Target

Co-authored-by: Grant Watson <grant.watson@arm.com>
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

Successfully merging this pull request may close these issues.

3 participants