Skip to content

Conversation

@Lunderberg
Copy link
Contributor

The ComputePrimValue transform is used to compute the value of symbolic expressions that may appear within a Relax function. For example, to compute a boolean condition used for a relax::If node. These functions are used for small host-side computations, prior to launching a device kernel.

This commit updates ComputePrimValue to annotate the generated PrimFunc with tir::attr::kIsHostFunc. This annotation is required for correct behavior in tvm.dlight.ApplyDefaultSchedule, to avoid erroneous scheduling of this function for the GPU, and for tir::transform::BindTarget, to ensure that the function is compiled for execution on the host.

The `ComputePrimValue` transform is used to compute the value of
symbolic expressions that may appear within a Relax function.  For
example, to compute a boolean condition used for a `relax::If` node.
These functions are used for small host-side computations, prior to
launching a device kernel.

This commit updates `ComputePrimValue` to annotate the generated
`PrimFunc` with `tir::attr::kIsHostFunc`.  This annotation is required
for correct behavior in `tvm.dlight.ApplyDefaultSchedule`, to avoid
erroneous scheduling of this function for the GPU, and for
`tir::transform::BindTarget`, to ensure that the function is compiled
for execution on the host.

Co-authored-by: Chris Sullivan <[email protected]>
@Lunderberg
Copy link
Contributor Author

This PR is identical to the now-closed PR #17024, as a CI restart prevented the CI from running on the original PR.

@tqchen tqchen merged commit c9d87ef into apache:main May 29, 2024
@Lunderberg Lunderberg deleted the relax_bugfix_annotate_compute_prim_value_as_host branch May 29, 2024 14:29
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.

2 participants