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

pytorch-1.11.0 compile error: set_stream’ is not a member of ‘torch::jit::cuda’ #18

Open
waptaff opened this issue Jun 23, 2022 · 3 comments

Comments

@waptaff
Copy link
Contributor

waptaff commented Jun 23, 2022

Trying to compile pytorch-1.11.0 I get the errors below.

My USE flags are: fbgemm ffmpeg gloo mpi nnpack numpy observers opencv openmp python qnnpack rocm tools -asan -atlas -caffe2 -cuda -doc -eigen -gflags -glog -leveldb -lmdb -mkl -mkldnn -namedtensor -numa -openblas -opencl -redis -static -tbb -test -zeromq

Trying to compile with rocm for an AMD card, with gcc-11.3.0p4 on an amd64 system.

Do you see anything obvious that'd explain the errors?

Thanks,

/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.cpp: In member function ‘bool torch::jit::Node::hasSideEffects() const’:                                                                                                                                
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.cpp:1194:16: error: ‘set_stream’ is not a member of ‘torch::jit::cuda’; did you mean ‘c10::cuda::set_stream’?                                                                                           
 1194 |     case cuda::set_stream:                                                                                                                
      |                ^~~~~~~~~~                                                                                                                 
In file included from /mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.h:18,                           
                 from /mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.cpp:1:                          
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:208:11: note: ‘c10::cuda::set_stream’ declared here                                                                                                                                    
  208 |   _(cuda, set_stream)                \                                                                                                    
      |           ^~~~~~~~~~                                                                                                                      
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:321:35: note: in definition of macro ‘DEFINE_SYMBOL’                                                                                                                                   
  321 |   namespace ns { constexpr Symbol s(static_cast<unique_t>(_keys::ns##_##s)); }                                                            
      |                                   ^                                                                                                       
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:322:1: note: in expansion of macro ‘FORALL_NS_SYMBOLS’                                                                                                                                 
  322 | FORALL_NS_SYMBOLS(DEFINE_SYMBOL)                                                                                                          
      | ^~~~~~~~~~~~~~~~~                                                                                                                         
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.cpp:1195:16: error: ‘_set_device’ is not a member of ‘torch::jit::cuda’; did you mean ‘c10::cuda::_set_device’?                                                                                         
 1195 |     case cuda::_set_device:                                                                                                               
      |                ^~~~~~~~~~~                                                                                                                
In file included from /mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.h:18,                           
                 from /mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/torch/csrc/jit/ir/ir.cpp:1:                          
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:207:11: note: ‘c10::cuda::_set_device’ declared here                                                                                                                                   
  207 |   _(cuda, _set_device)               \                                                                                                    
      |           ^~~~~~~~~~~                                                                                                                     
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:321:35: note: in definition of macro ‘DEFINE_SYMBOL’                                                                                                                                   
  321 |   namespace ns { constexpr Symbol s(static_cast<unique_t>(_keys::ns##_##s)); }                                                            
      |                                   ^                                                                                                       
/mnt/t/tmp-portage/portage/sci-libs/pytorch-1.11.0/work/pytorch-1.11.0/aten/src/ATen/core/interned_strings.h:322:1: note: in expansion of macro ‘FORALL_NS_SYMBOLS’
  322 | FORALL_NS_SYMBOLS(DEFINE_SYMBOL)
      | ^~~~~~~~~~~~~~~~~                                                                         
…
@aclex
Copy link
Owner

aclex commented Jun 24, 2022

Oh, quite strange. I can only propose to try adding using namespace c10 before the switch (somewhere near the line 1175), from what the error says it might just be forgotten for this code path.

In general, unfortunately, the version with rocm USE-flag enabled is not updated for quite a long time here, still can't find enough time to fix and update it properly. You can try better luck with the version from gentoo/sci with rocm enabled, I think, it has better ROCm support at the moment.

@waptaff
Copy link
Contributor Author

waptaff commented Jun 25, 2022

Mmm, you made me realize that the part of code that's generating errors should not even be included in compilation, being inside a #if !defined(USE_ROCM) preprocessor directive. So this is a red herring.

I force-added -DUSE_ROCM to CFLAGS, CXXFLAGS and friends using /etc/portage/package.env (e.g. the method described on gentoo's wiki) and the error vanished. So, somewhere the USE_ROCM build parameter gets lost during build; I have zero CMake skills unfortunately so I cannot provide a proper patch.

Alas, despite that workaround, compilation does not complete, there are new errors but I'll deal with them in another ticket if I can't find a way to work around them.

Thank you,

@aclex
Copy link
Owner

aclex commented Jun 25, 2022

Many thanks for sharing the results of your experiments, Patrice! Yes, that's probably missed somewhere in the build system. It's being updated with new versions quite actively, especially in those side branches like ROCm support.

I also hope to return to this ROCm-related stuff some time soon. I tried with that another time a couple of months ago, but there was a transition to version 5 for ROCm packages in Gentoo so I decided to wait for it to complete. I see most of the packages are updated and merged to the mainline repository now, so I also hope to continue with that.

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

No branches or pull requests

2 participants