Skip to content

Conversation

@Lunderberg
Copy link
Contributor

If an allocation occurs within a host function, it may not have a device/host split, and may just be annotated with "tir.is_host_func".

If an allocation occurs within a host function, it may not have a
device/host split.
Copy link
Contributor

@slyubomirsky slyubomirsky left a comment

Choose a reason for hiding this comment

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

The change is simple and this seems like a good capability to have. Thank you for implementing it.

def before():
T.func_attr({"target": T.target("llvm")})
T.attr("dummy", "device_id", 0)
T.attr("dummy", "device_type", 2) # kDLCuda
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this constant defined anywhere on the Python side? Perhaps it should be, to avoid such magic numbers (if we expect that to happen again).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, and looks like it is defined in the tvm.runtime.Device struct. I've updated the usage here, and throughout this unit test file.

@Lunderberg
Copy link
Contributor Author

Closing this PR, as changes were required for #16721, and were merged as part of that PR.

@Lunderberg Lunderberg closed this Mar 28, 2024
@Lunderberg Lunderberg deleted the tir_check_function_attr_for_device_type branch March 28, 2024 12:37
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