Repository: pytorch
Issue: Pytorch master can not build with computer capability 3.0 under Mac OS X 10.13.16 with Nvidia GT 750m
Labels: module: cuda,low priority,triaged,module: macos

## 🐛 Bug

<!--   -->
Building pytorch master HEAD under Mac OS X 10.13.16 with CC3.0 Nvidia GT 750M CUDA 10.0 and cuDNN 7.4.2 failed with error: identifier "__ldg" is undefined because __ldg is only support with CC 3.5 and above

## To Reproduce

Steps to reproduce the behavior:

1.MacOSX 10.13.16(17G8030) with Nvidia GT 750M (CC 3.0)
2.CUDA Web Driver 410.130
3.GPU Driver Version 387.10.10.10.40.130
4.CUDA 10.0
5.cuDNN 7.4.2
6.XCode 9.4.1
7. Clone the master of pytorch and build with GPU enabled "MACOSX_DEPLOYMENT_TARGET=10.13 CC=clang CXX=clang++ python setup.py install"

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->
Build failed with following messages:
[ 51%] Building NVCC (Device) object caffe2/CMakeFiles/torch.dir/operators/torch_generated_abs_op.cu.o
/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(102): error: identifier "__ldg" is undefined

/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(123): error: identifier "__ldg" is undefined

/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(102): error: identifier "__ldg" is undefined
          detected during instantiation of "void caffe2::DepthwiseConv3dGPUKernelNCHW(caffe2::DepthwiseArgs, const T *, const T *, T *, int) [with T=float]" 
(380): here

/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(123): error: identifier "__ldg" is undefined
          detected during instantiation of "void caffe2::DepthwiseConv3dGPUKernelNCHW(caffe2::DepthwiseArgs, const T *, const T *, T *, int) [with T=float]" 
(380): here

/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(184): error: identifier "__ldg" is undefined
          detected during instantiation of "void caffe2::DepthwiseConv3dBackpropFilterGPUKernelNCHW(caffe2::DepthwiseArgs, const T *, const T *, T *, int) [with T=float]" 
(505): here

/Users/sfeng/GH/pytorch_master/caffe2/operators/channelwise_conv3d_op_cudnn.cu(303): error: identifier "__ldg" is undefined
          detected during instantiation of "void caffe2::DepthwiseConv3dBackpropInputGPUKernelNCHW(caffe2::DepthwiseArgs, const T *, const T *, T *, int) [with T=float]" 
(515): here

6 errors detected in the compilation of "/var/folders/wm/5_m2zvqj1tv_gv177yjkq_kr0000gn/T//tmpxft_00011df9_00000000-6_channelwise_conv3d_op_cudnn.cpp1.ii".
CMake Error at torch_generated_channelwise_conv3d_op_cudnn.cu.o.Release.cmake:281 (message):
  Error generating file
  /Users/sfeng/GH/pytorch_master/build/caffe2/CMakeFiles/torch.dir/operators/./torch_generated_channelwise_conv3d_op_cudnn.cu.o


make[2]: *** [caffe2/CMakeFiles/torch.dir/operators/torch_generated_channelwise_conv3d_op_cudnn.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/sfeng/GH/pytorch_master/cmake/../third_party/eigen/Eigen/src/Core/arch/GPU/PacketMathHalf.h(149): warning: missing return statement at end of non-void function "Eigen::internal::ptrue(const Packet &) [with Packet=half2]"

/Users/sfeng/GH/pytorch_master/cmake/../third_party/eigen/Eigen/src/Core/arch/GPU/PacketMathHalf.h(149): warning: missing return statement at end of non-void function "Eigen::internal::ptrue(const Packet &) [with Packet=half2]"

make[1]: *** [caffe2/CMakeFiles/torch.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 759, in <module>
    build_deps()
  File "setup.py", line 320, in build_deps
    cmake=cmake)
  File "/Users/sfeng/GH/pytorch_master/tools/build_pytorch_libs.py", line 59, in build_caffe2
    cmake.build(my_env)
  File "/Users/sfeng/GH/pytorch_master/tools/setup_helpers/cmake.py", line 333, in build
    self.run(build_args, my_env)
  File "/Users/sfeng/GH/pytorch_master/tools/setup_helpers/cmake.py", line 143, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/Users/sfeng/anaconda3/envs/pytorch/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

Build succeed and run properly

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)

Collecting environment information...
/Users/sfeng/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/cuda/__init__.py:132: UserWarning: 
    Found GPU0 GeForce GT 750M which is of cuda capability 3.0.
    PyTorch no longer supports this GPU because it is too old.
    The minimum cuda capability that we support is 3.5.
    
  warnings.warn(old_gpu_warn % (d, name, major, capability[1]))
PyTorch version: 1.3.0a0+a332583
Is debug build: No
CUDA used to build PyTorch: 10.0

OS: Mac OSX 10.13.6
GCC version: Could not collect
CMake version: version 3.14.0

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration: GeForce GT 750M
Nvidia driver version: 1.1.0
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy==1.17.1
[pip] pytorch-sphinx-theme==0.0.24
[pip] torch==1.3.0a0+a332583
[pip] torchvision==0.5.0a0+0bd7080
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      233  
[conda] mkl-include               2019.4                      233  
[conda] mkl-service               2.0.2            py37h1de35cc_0  
[conda] mkl_fft                   1.0.14           py37h5e564d8_0  
[conda] mkl_random                1.0.2            py37h27c97d8_0  
[conda] pytorch-sphinx-theme      0.0.24                    dev_0    <develop>
[conda] torch                     1.3.0a0+a332583          pypi_0    pypi
(pytorch) SamuelFdeMBP:utils sfeng$ 


## Additional context

PyTorch version: 1.3.0a0+a332583 is my local successful build with the PR I will submit soon.

<!-- Add any other context about the problem here. -->

I know that the official support for CC 3.0 stop years ago, But till 1.1.0 pytorch still works with CC3.0 device until there is some cuda launch error which had been fixed by jcooky with his PR of https://github.com/jcooky/pytorch/commit/ecdf4564d44835b3b2ffd18e286ad7e549231a14.
With jcooky's PR the MacOSX version of pytorch master can build and runs properly with CC3.5 devices.
But for CC 3.0 devices the pytorch HEAD failed to build