Skip to content

[Unity] Fix the ambiguity issue in vDevice constructor on Mac with Apple clang version 14.0.3#15546

Merged
yongwww merged 3 commits intoapache:unityfrom
sunggg:2023-Aug/hot-fix-vdevice
Aug 15, 2023
Merged

[Unity] Fix the ambiguity issue in vDevice constructor on Mac with Apple clang version 14.0.3#15546
yongwww merged 3 commits intoapache:unityfrom
sunggg:2023-Aug/hot-fix-vdevice

Conversation

@sunggg
Copy link
Copy Markdown
Contributor

@sunggg sunggg commented Aug 13, 2023

PR #15447 introduces vDevice and currently, it causes compilation failure on my Mac with the following error:

sung@spark-mbp build % gcc --version                                          
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/Users/sung/tvm/src/ir/global_info.cc:33:25: error: addition of default argument on redeclaration makes this constructor a default constructor
VDevice::VDevice(Target tgt = {}, int dev_id = -1, MemoryScope mem_scope = {}) {
                        ^   ~~~~
/Users/sung/tvm/include/tvm/ir/global_info.h:97:20: note: previous declaration is here
  TVM_DLL explicit VDevice(Target tgt, int dev_id, MemoryScope mem_scope);
                   ^
1 error generated.
make[2]: *** [CMakeFiles/tvm_objs.dir/src/ir/global_info.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/tvm_objs.dir/all] Error 2

This occurs due to the ambiguity with the default constructor defined within TVM_DEFINE_OBJECT_REF_METHODS.
Therefore, this PR eliminates such ambiguity by explicitly calling the constructor.
Since it requires explicit passing of the default arguments, I'd like to find a way to support previous usage (e.g., VDevice()) without the ambiguity. But I don't have good idea at the moment unfortunately.
cc. @yongwww

@tvm-bot
Copy link
Copy Markdown
Collaborator

tvm-bot commented Aug 13, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@yongwww
Copy link
Copy Markdown
Member

yongwww commented Aug 14, 2023

Thanks @sunggg for the hot fix! To pass the CI tests, please change this line to if (n->vdevice.defined() && n->vdevice.value()->target.defined()) {. I can submit fix to your branch for this hotfix if some other tests fail

@yongwww yongwww merged commit 36af504 into apache:unity Aug 15, 2023
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.

4 participants