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

Compiler warnings with VS 2015 #3394

Closed
StrikerRUS opened this issue Sep 13, 2020 · 7 comments · Fixed by #3399
Closed

Compiler warnings with VS 2015 #3394

StrikerRUS opened this issue Sep 13, 2020 · 7 comments · Fixed by #3399

Comments

@StrikerRUS
Copy link
Collaborator

There are a lot of warnings produced by VS 2015:

C:\Users\ntitov\Downloads\LightGBM\build>cmake -A x64 ..
-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version 10.0.10586.0 to target Windows 10.0.14393.
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Failed
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/ntitov/Downloads/LightGBM/build

C:\Users\ntitov\Downloads\LightGBM\build>cmake --build . --target ALL_BUILD --config Release
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Building Custom Rule C:/Users/ntitov/Downloads/LightGBM/CMakeLists.txt
  application.cpp
  boosting.cpp
  gbdt.cpp
  gbdt_model_text.cpp
  gbdt_prediction.cpp
  prediction_early_stop.cpp
  bin.cpp
  config.cpp
  config_auto.cpp
  dataset.cpp
  dataset_loader.cpp
  file_io.cpp
  json11.cpp
c:\users\ntitov\downloads\lightgbm\src\boosting\prediction_early_stop.cpp(88): warning C4702: unreachable code [C:\User
s\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
  metadata.cpp
C:\Users\ntitov\Downloads\LightGBM\src\io\dataset.cpp(380): warning C4800: 'signed char': forcing value to bool 'true'
or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(355): warning C4100: 'max_bin': unreferenced formal parameter
(compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp) [C:\Users\ntitov\Downloads\LightGBM\build\_li
ghtgbm.vcxproj]
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(407): note: see reference to function template instantiation
   'LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,const
  uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) c
  onst' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(405): note: see reference to function template instantiation
   'LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,const
  uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) c
  onst' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(404): note: while compiling class template member function '
  LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategorical(uint32_t,uint32_t,const uint32_t *,int,const Li
  ghtGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) const' (compiling source
   file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp(629): note: see reference to class template instantiation 'LightGBM
  ::SparseBin<uint32_t>' being compiled
c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(310): warning C4100: 'max_bin': unreferenced formal parameter (
compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp) [C:\Users\ntitov\Downloads\LightGBM\build\_lig
htgbm.vcxproj]
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(362): note: see reference to function template instantiation
  'LightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,co
  nst uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t
  *) const' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(360): note: see reference to function template instantiation
  'LightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,co
  nst uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t
  *) const' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(359): note: while compiling class template member function 'L
  ightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategorical(uint32_t,uint32_t,const uint32_t *,int,cons
  t LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) const' (compiling so
  urce file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp(625): note: see reference to class template instantiation 'LightGBM
  ::DenseBin<uint32_t,false>' being compiled
  parser.cpp
  tree.cpp
  dcg_calculator.cpp
  metric.cpp
  linker_topo.cpp
  linkers_mpi.cpp
  linkers_socket.cpp
  network.cpp
  objective_function.cpp
  data_parallel_tree_learner.cpp
  feature_parallel_tree_learner.cpp
  gpu_tree_learner.cpp
  serial_tree_learner.cpp
  tree_learner.cpp
  voting_parallel_tree_learner.cpp
  c_api.cpp
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\serial_tree_learner.cpp(388): warning C4800: 'signed char': forcing
value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\serial_tree_learner.cpp(410): warning C4800: 'signed char': forcing
value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(203): warning C4800: 'signed char': f
orcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxpro
j]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(176): note: while compiling class t
  emplate member function 'void LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHistogra
  ms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)'
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(171): note: see reference to functi
  on template instantiation 'void LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHistog
  rams(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)' being compiled
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(259): note: see reference to class
  template instantiation 'LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>' being compiled
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(217): warning C4800: 'signed char': f
orcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxpro
j]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(378): warning C4800: 'signed char':
 forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxp
roj]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(350): note: while compiling class
   template member function 'void LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHist
  ograms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)'
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(346): note: see reference to func
  tion template instantiation 'void LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHi
  stograms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)' being compiled
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(457): note: see reference to clas
  s template instantiation 'LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>' being compiled
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(394): warning C4800: 'signed char':
 forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\_lightgbm.vcxp
roj]
c:\users\ntitov\downloads\lightgbm\src\objective\objective_function.cpp(52): warning C4702: unreachable code [C:\Users\
ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
c:\users\ntitov\downloads\lightgbm\src\c_api.cpp(879): warning C4702: unreachable code [C:\Users\ntitov\Downloads\Light
GBM\build\_lightgbm.vcxproj]
c:\users\ntitov\downloads\lightgbm\src\treelearner\serial_tree_learner.cpp(233): warning C4702: unreachable code [C:\Us
ers\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]
     Creating library C:/Users/ntitov/Downloads/LightGBM/Release/lib_lightgbm.lib and object C:/Users/ntitov/Downloads/
  LightGBM/Release/lib_lightgbm.exp
  _lightgbm.vcxproj -> C:\Users\ntitov\Downloads\LightGBM\Release\lib_lightgbm.dll
  Building Custom Rule C:/Users/ntitov/Downloads/LightGBM/CMakeLists.txt
  main.cpp
  application.cpp
  boosting.cpp
  gbdt.cpp
  gbdt_model_text.cpp
  gbdt_prediction.cpp
  prediction_early_stop.cpp
  bin.cpp
  config.cpp
  config_auto.cpp
  dataset.cpp
  dataset_loader.cpp
C:\Users\ntitov\Downloads\LightGBM\src\io\dataset.cpp(380): warning C4800: 'signed char': forcing value to bool 'true'
or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
c:\users\ntitov\downloads\lightgbm\src\boosting\prediction_early_stop.cpp(88): warning C4702: unreachable code [C:\User
s\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
  file_io.cpp
c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(355): warning C4100: 'max_bin': unreferenced formal parameter
(compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp) [C:\Users\ntitov\Downloads\LightGBM\build\lig
htgbm.vcxproj]
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(407): note: see reference to function template instantiation
   'LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,const
  uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) c
  onst' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(405): note: see reference to function template instantiation
   'LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,const
  uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) c
  onst' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\sparse_bin.hpp(404): note: while compiling class template member function '
  LightGBM::data_size_t LightGBM::SparseBin<uint32_t>::SplitCategorical(uint32_t,uint32_t,const uint32_t *,int,const Li
  ghtGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) const' (compiling source
   file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp(629): note: see reference to class template instantiation 'LightGBM
  ::SparseBin<uint32_t>' being compiled
c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(310): warning C4100: 'max_bin': unreferenced formal parameter (
compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp) [C:\Users\ntitov\Downloads\LightGBM\build\ligh
tgbm.vcxproj]
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(362): note: see reference to function template instantiation
  'LightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,co
  nst uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t
  *) const' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(360): note: see reference to function template instantiation
  'LightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategoricalInner<false>(uint32_t,uint32_t,uint32_t,co
  nst uint32_t *,int,const LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t
  *) const' being compiled (compiling source file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  c:\users\ntitov\downloads\lightgbm\src\io\dense_bin.hpp(359): note: while compiling class template member function 'L
  ightGBM::data_size_t LightGBM::DenseBin<uint32_t,false>::SplitCategorical(uint32_t,uint32_t,const uint32_t *,int,cons
  t LightGBM::data_size_t *,LightGBM::data_size_t,LightGBM::data_size_t *,LightGBM::data_size_t *) const' (compiling so
  urce file C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp)
  C:\Users\ntitov\Downloads\LightGBM\src\io\bin.cpp(625): note: see reference to class template instantiation 'LightGBM
  ::DenseBin<uint32_t,false>' being compiled
  json11.cpp
  metadata.cpp
  parser.cpp
  tree.cpp
  dcg_calculator.cpp
  metric.cpp
  linker_topo.cpp
  linkers_mpi.cpp
  linkers_socket.cpp
  network.cpp
  objective_function.cpp
  data_parallel_tree_learner.cpp
  feature_parallel_tree_learner.cpp
  gpu_tree_learner.cpp
  serial_tree_learner.cpp
  tree_learner.cpp
  voting_parallel_tree_learner.cpp
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(203): warning C4800: 'signed char': f
orcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj
]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(176): note: while compiling class t
  emplate member function 'void LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHistogra
  ms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)'
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(171): note: see reference to functi
  on template instantiation 'void LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHistog
  rams(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)' being compiled
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(259): note: see reference to class
  template instantiation 'LightGBM::DataParallelTreeLearner<LightGBM::GPUTreeLearner>' being compiled
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\data_parallel_tree_learner.cpp(217): warning C4800: 'signed char': f
orcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj
]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\serial_tree_learner.cpp(388): warning C4800: 'signed char': forcing
value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\serial_tree_learner.cpp(410): warning C4800: 'signed char': forcing
value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
c:\users\ntitov\downloads\lightgbm\src\objective\objective_function.cpp(52): warning C4702: unreachable code [C:\Users\
ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(378): warning C4800: 'signed char':
 forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxpr
oj]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(350): note: while compiling class
   template member function 'void LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHist
  ograms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)'
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(346): note: see reference to func
  tion template instantiation 'void LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>::FindBestSplitsFromHi
  stograms(const std::vector<int8_t,std::allocator<_Ty>> &,bool,const LightGBM::Tree *)' being compiled
          with
          [
              _Ty=int8_t
          ]
  C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(457): note: see reference to clas
  s template instantiation 'LightGBM::VotingParallelTreeLearner<LightGBM::GPUTreeLearner>' being compiled
C:\Users\ntitov\Downloads\LightGBM\src\treelearner\voting_parallel_tree_learner.cpp(394): warning C4800: 'signed char':
 forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ntitov\Downloads\LightGBM\build\lightgbm.vcxpr
oj]
c:\users\ntitov\downloads\lightgbm\src\treelearner\serial_tree_learner.cpp(233): warning C4702: unreachable code [C:\Us
ers\ntitov\Downloads\LightGBM\build\lightgbm.vcxproj]
     Creating library C:/Users/ntitov/Downloads/LightGBM/Release/lightgbm.lib and object C:/Users/ntitov/Downloads/Ligh
  tGBM/Release/lightgbm.exp
  lightgbm.vcxproj -> C:\Users\ntitov\Downloads\LightGBM\Release\lightgbm.exe
  Building Custom Rule C:/Users/ntitov/Downloads/LightGBM/CMakeLists.txt

To reproduce run code from the guide:

git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build
cmake -A x64 ..
cmake --build . --target ALL_BUILD --config Release
@guolinke
Copy link
Collaborator

I think these warnings are generated by template function variable, and cannot be fixed.
And compiler should not throw these warnings.

@guolinke
Copy link
Collaborator

for example, it throws max_bin is not used in the following function.

template <bool USE_MIN_BIN>
data_size_t SplitCategoricalInner(uint32_t min_bin, uint32_t max_bin,
uint32_t most_freq_bin,
const uint32_t* threshold,
int num_threshold,
const data_size_t* data_indices,
data_size_t cnt, data_size_t* lte_indices,
data_size_t* gt_indices) const {
data_size_t lte_count = 0;
data_size_t gt_count = 0;
data_size_t* default_indices = gt_indices;
data_size_t* default_count = &gt_count;
int8_t offset = most_freq_bin == 0 ? 1 : 0;
if (most_freq_bin > 0 &&
Common::FindInBitset(threshold, num_threshold, most_freq_bin)) {
default_indices = lte_indices;
default_count = &lte_count;
}
for (data_size_t i = 0; i < cnt; ++i) {
const data_size_t idx = data_indices[i];
const uint32_t bin = data(idx);
if (USE_MIN_BIN && (bin < min_bin || bin > max_bin)) {
default_indices[(*default_count)++] = idx;
} else if (!USE_MIN_BIN && bin == 0) {
default_indices[(*default_count)++] = idx;
} else if (Common::FindInBitset(threshold, num_threshold,
bin - min_bin + offset)) {
lte_indices[lte_count++] = idx;
} else {
gt_indices[gt_count++] = idx;
}
}
return lte_count;
}

But when USE_MIN_BIN is true, max_bin is used.

@StrikerRUS
Copy link
Collaborator Author

@guolinke Yeah, possibly. But some of them can be fixed and are not related to templates I believe. For instance,

c:\users\ntitov\downloads\lightgbm\src\boosting\prediction_early_stop.cpp(88): warning C4702: unreachable code [C:\User
s\ntitov\Downloads\LightGBM\build\_lightgbm.vcxproj]

@StrikerRUS
Copy link
Collaborator Author

Also, we have the following warnings with gcc for GPU version:

[ 83%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/gpu_tree_learner.cpp.o
In file included from /usr/include/boost/property_tree/json_parser/detail/parser.hpp:7:0,
                 from /usr/include/boost/property_tree/json_parser/detail/read.hpp:13,
                 from /usr/include/boost/property_tree/json_parser.hpp:16,
                 from /__w/1/s/compute/include/boost/compute/detail/parameter_cache.hpp:31,
                 from /__w/1/s/compute/include/boost/compute/algorithm/detail/copy_on_device.hpp:23,
                 from /__w/1/s/compute/include/boost/compute/algorithm/copy.hpp:26,
                 from /__w/1/s/compute/include/boost/compute/container/vector.hpp:32,
                 from /__w/1/s/src/treelearner/gpu_tree_learner.h:34,
                 from /__w/1/s/src/treelearner/parallel_tree_learner.h:15,
                 from /__w/1/s/src/treelearner/data_parallel_tree_learner.cpp:9:
/usr/include/boost/bind.hpp:41:265: note: #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
 )

<repeated a lot>

https://dev.azure.com/lightgbm-ci/lightgbm-ci/_build/results?buildId=7330&view=logs&j=9ce42e5d-f31a-544a-a6de-dc42f8c013ed&t=b696def5-78ae-590c-4234-04332342ba2d

But it looks like a problem in boost codebase itself, not with our GPU learner code, right? @huanzhang12

@guolinke
Copy link
Collaborator

@StrikerRUS
yeah, for that warning, it is introduced by code refactoring.
image

for the rest type conversion errors, we can fix them.

@guolinke guolinke mentioned this issue Sep 15, 2020
@StrikerRUS
Copy link
Collaborator Author

@guolinke

yeah, for that warning, it is introduced by code refactoring.

I remember that refactoring was done to workaround warning from VS 2019 about that not all code paths return value. I think we should prefer eliminating warnings from the most recent VS versions.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants