tqchen commented on code in PR #17599:
URL: https://github.com/apache/tvm/pull/17599#discussion_r1939811868
##########
src/relax/transform/utils.h:
##########
@@ -387,7 +387,7 @@ inline String GetCodegenName(const std::string&
composite_name) {
inline int GetDeviceIndex(const IRModule& mod, const VDevice& vdevice) {
Array<GlobalInfo> vdevices = mod->global_infos["vdevice"];
for (int i = 0; i < static_cast<int>(vdevices.size()); ++i) {
- if (vdevices[i] == vdevice) {
+ if (vdevices[i].as<VDevice>() == vdevice) {
Review Comment:
vdevices[i].same_as
##########
include/tvm/ir/global_info.h:
##########
@@ -95,6 +95,15 @@ class VDeviceNode : public GlobalInfoNode {
class VDevice : public GlobalInfo {
public:
TVM_DLL explicit VDevice(Target tgt, int dev_id, MemoryScope mem_scope);
+ /*!
+ * \brief Equal comparator.
+ * \param other The data type to compare against.
+ * \return The comparison result.
+ */
+ bool operator==(const VDevice& other) const {
Review Comment:
is this still necessary if we use equality based on object? Just want to
reduce the overhead here
##########
src/script/printer/relax/utils.h:
##########
@@ -141,7 +141,7 @@ inline int FindVDeviceIndexByTargetKind(const VDevice&
vdevice, const IRDocsifie
int kind_index = 0;
for (size_t i = 0; i < vdevices.size(); ++i) {
auto vdev = Downcast<VDevice>(vdevices[i]);
- if (vdev.same_as(vdevice)) {
+ if (vdev == vdevice) {
Review Comment:
Seems this is a bug in our parsing mechanism, I think we should fix the
parsing in such case to remap things back to ptr equality. if there is a min
example, we can work together to fix. cc @yongwww
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]