diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-03-12 00:45:59 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-03-12 00:45:59 +0000 |
commit | 2c3b9bbdb114cc13b6ef8e0e5933c9e374fca8b6 (patch) | |
tree | 04352a23e7dcea5171eafee655c62e4b2f24afbf /sci-libs/caffe2 | |
parent | 72d7e048ae88be323a380e2eae52dfda0b2dc1c0 (diff) |
gentoo auto-resync : 12:03:2024 - 00:45:59
Diffstat (limited to 'sci-libs/caffe2')
-rw-r--r-- | sci-libs/caffe2/Manifest | 7 | ||||
-rw-r--r-- | sci-libs/caffe2/caffe2-2.1.2-r7.ebuild (renamed from sci-libs/caffe2/caffe2-2.1.2-r6.ebuild) | 61 | ||||
-rw-r--r-- | sci-libs/caffe2/caffe2-2.2.1-r1.ebuild (renamed from sci-libs/caffe2/caffe2-2.2.1.ebuild) | 56 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.1.2-rocm-fix-std-cpp17.patch | 68 | ||||
-rw-r--r-- | sci-libs/caffe2/metadata.xml | 1 |
5 files changed, 171 insertions, 22 deletions
diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest index 2bf0d73c3312..7c25a5549d10 100644 --- a/sci-libs/caffe2/Manifest +++ b/sci-libs/caffe2/Manifest @@ -11,6 +11,7 @@ AUX caffe2-2.1.1-cudaExtra.patch 1336 BLAKE2B f12d29a624f9345452227076108b9ded4c AUX caffe2-2.1.1-gentoo.patch 6329 BLAKE2B c002f1605888ac79bed292cf1967eedd4d177193947dbafea8443958e498b371865a8f7548cc7e2c572d7fff69418344286071d64f4742691e943e81b73d811c SHA512 8eb2b2f89de809ff93e0deaa4bd6116f73bed55642904e689ba97e5bf21ba5754935a8d0c1f632b1f262400f0c809398524056f7691f7787c154a5b7f6f1b7b2 AUX caffe2-2.1.2-fix-openmp-link.patch 483 BLAKE2B dfe9ae0978b71449486d12f769c3c962001c138bc53b0605ed6f2215fe732356da90c5084488bc4d9f54c88aab2a426b8c935543f7ba0890783bb58da30a5cb4 SHA512 a9cee8ae2a8477a21e92bd4ef286af68efd90283593db7ed4641a826b19b4266bcab9c131c93be2b6c2f13d5cd545c766612791cf2e23cff9a731a03f3ad7648 AUX caffe2-2.1.2-fix-rpath.patch 510 BLAKE2B 6585e8089acc6e7fe69713ad04a64263ab2e9d2d5cf6d3a844dbbc917383e4b7a0688ebdfb3142e3c42108c8c14a6435f48ae4ce3adee8db338286d60ed7b503 SHA512 ede770559b487fff736aded0cf4b077d8308c2b85c5cd139150b04bcb8b72a0d78af6a2b74fbb153b75acff71df0832d8f139231d1c18558f5b5479af348e6a0 +AUX caffe2-2.1.2-rocm-fix-std-cpp17.patch 3485 BLAKE2B 38f07fa876e1b628f1709dc35669ee62bbd5b00e23880800a0c430c72365799da86213ba76d344e9b46559ec1a4c98e1be6b46466bee8ebbf484976c597bb5ba SHA512 8dffee073c7744c3eba62f22b5f11d1f5db980fd7e9ac593ae44b489fe1eded532739db397f4599b8cda1b75c26e493dff81c2862056f62823570ab94a8f3389 AUX caffe2-2.2.1-gentoo.patch 6765 BLAKE2B 924338e5823825d18220c33e9168f96b5987350cf47ad26824c660dfe953f54c415a4a709d9d7bab6901687f41f8477c0615ab76773e0e689ecf91e9a7f2ef64 SHA512 e9a20bc83a1c0349927205fc3675b1ad832cb86acca3a8d2f68a3dd33f2c1fa39fb53616b603023dce217d0a29fef34e6abb6315201690a8568d2419bcb9d895 DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3 SHA512 f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62 DIST pytorch-2.0.1.tar.gz 111335778 BLAKE2B 7a10cc2b2d5e2422aef7e060a0c3a62ca5c7460c6e0b9becade9b98939501975c74ed5a175a653731f43ca824d2c9bd31f41d1f633c2b139779ab23d5331e9ce SHA512 2309a22b3be3ccdb36d8d9781a59a7bdcc2fdb8d95ada205702ec77862480f0cbb12cd5d6b8cd3114d01a6e33b7743d0fe9de93debf37138ca5c14403cdb0c43 @@ -18,6 +19,6 @@ DIST pytorch-2.1.2.tar.gz 116316469 BLAKE2B c5a55ee264bc3477d3556ba6376b5591117e DIST pytorch-2.2.1.tar.gz 116370903 BLAKE2B 7d08e80f91bad76fba1751c30a34bebfe7145058b7758c0d47112702263a80666f70687a8860744725c6aa995e854f766a5bfa4644c23e5635e7e08c8d63a6e9 SHA512 f19ebcf59d183c3348946ba7cfcab2bc4ca93785863b8edc39dba5772083a7b0425ccb4f92a8df4dc0d18246c75e8ff812993161467fbf9dc48d7fb28a1e26f1 EBUILD caffe2-1.13.1-r6.ebuild 5244 BLAKE2B d7f5f16e1f1122604a6df64f16c62552fb8b4b0de67bd231036b4835a5a71c58da02f0e1df64f3bd22c2a282a150d7f5a803c87cdf792e3e97ec8f518e055191 SHA512 58b1a09e5e3814d9475d4fe0e46aa837477843e09ed1b0c803c2ac3190e5c819d4216e33e3003652194e90a9f3f35146657eb25f30a4419bf16b2067e5a4b027 EBUILD caffe2-2.0.1-r5.ebuild 5868 BLAKE2B c17450d01ff68d42188c9da9e9c7a6d6469fe5c8b72c91e4ea4456eb4fe9d08cf30619fbb06f3dae21add641329f3ce8ced24bca93eb05900340639c042a1cdb SHA512 d32fa4c194c51efb76b143f22f783efa7a1415902b03ddea1d3f145d632455ebfe672a1b05b1203f2ba752f3331831455ae631a66bb409f45d6c695c68f39c3b -EBUILD caffe2-2.1.2-r6.ebuild 6674 BLAKE2B f12792b8f93c1ef0fccd1d8c2f46d5ce451729051d6f1cc6a04c2bd94324c5eb507e3210597ddad18be186bd42c21bcab0d7e4db2180a7d7f1b6334d94a518ab SHA512 b2f32fd716640a44b582b9c3a7d819c3da78723d93e5b8962cb32d38124ec078602066a08aaa0d0e632ddae1387d9224329fedc528d180f7d5326a54cce54e4f -EBUILD caffe2-2.2.1.ebuild 6306 BLAKE2B c7d765797d3fe09d0d8bee96c94477ca60e3074ec5c9e54b64bcef9c2bb536ba6491755f300b7cf7bfcf21d0c3819f5041638392abf80441780e779fb7e948c7 SHA512 2e293d51c576006b0d4a6ced68a513f2d3eecf0455656096869e1d7e048895575f496b314f10087e32b7680a53a22355511fcdf62e18eeaed207c3a960568236 -MISC metadata.xml 1161 BLAKE2B 77145d6b17a38da3fc791b85ec6d1d8a4faa5f08485f7b8d7918f301342c9d95b9b9db9147334788ffa5137526365d0161a5e1420eabafb2058e1d85a5fa52bb SHA512 44fa18ac5e1abcfb021e8fc48db1bb9c0f61bc115484ae6f293f38c48d1f42704524490c8e3977eec8dccb728837e1fcb3ce2e892986e55044af3a15e82a61e9 +EBUILD caffe2-2.1.2-r7.ebuild 7921 BLAKE2B b05ff1d2ec0ba18f0f97ddb1633bf62c52d70fbe6762dd11788d3c13787d74daa737a77c9b24ece013b18108274b9865104b2fdd283fb01e80ea8daf2d119d27 SHA512 3bd6cedaaf74e73e27f87dbb15843f0de8d146dfdb9b4c9c85f98ce8534312a6f09c168186dc42d580ed4da170c2d21e059d4704f87c9906d6440e5139a3627f +EBUILD caffe2-2.2.1-r1.ebuild 7393 BLAKE2B 6bd0948a559ec0183366625467d07ad39142ee9644504b753e5108e0a46cbdcdea4838810c31c8a8b5dd71e6200b282973d318ae51a5ef3fcb05df4417650817 SHA512 be767aba07657eda925564c4596cb969a493bd449933fc202df3991a476e83fad6677311c14bca3035e412ab056e4ed64a7d2d233abd5e572153da96137ab876 +MISC metadata.xml 1222 BLAKE2B f7224dcb5025c7979dc9060a6fcf26d1f5b724a266cec61b8244c9b7c5f223abc5f00d89ffef1011096c754e418b0ff041b67306b8b68b58c38ea9da56fb5a3c SHA512 7d2d04905fd85d3a5857327f9f9274fee9d262ea2cba4eabd42716a231abd1207118c141df65b3fe86956ef77c55440625d660a0a4b27cdaa573d25d2931d1de diff --git a/sci-libs/caffe2/caffe2-2.1.2-r6.ebuild b/sci-libs/caffe2/caffe2-2.1.2-r7.ebuild index 969c36754c5c..f57406145c6a 100644 --- a/sci-libs/caffe2/caffe2-2.1.2-r6.ebuild +++ b/sci-libs/caffe2/caffe2-2.1.2-r7.ebuild @@ -4,7 +4,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{9..12} ) -inherit python-single-r1 cmake cuda flag-o-matic prefix +ROCM_VERSION=5.7 +inherit python-single-r1 cmake cuda flag-o-matic prefix rocm MYPN=pytorch MYP=${MYPN}-${PV} @@ -17,7 +18,7 @@ SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz LICENSE="BSD" SLOT="0" KEYWORDS="~amd64" -IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn openblas opencl opencv openmp qnnpack tensorpipe xnnpack" +IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn openblas opencl opencv openmp qnnpack rocm tensorpipe xnnpack" RESTRICT="test" REQUIRED_USE=" ${PYTHON_REQUIRED_USE} @@ -26,7 +27,9 @@ REQUIRED_USE=" tensorpipe? ( distributed ) distributed? ( tensorpipe ) gloo? ( distributed ) -" # ?? ( cuda rocm ) + ?? ( cuda rocm ) + rocm? ( || ( ${ROCM_REQUIRED_USE} ) ) +" # CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122 RDEPEND=" @@ -59,6 +62,20 @@ RDEPEND=" opencl? ( virtual/opencl ) opencv? ( media-libs/opencv:= ) qnnpack? ( sci-libs/QNNPACK ) + rocm? ( + >=dev-util/hip-5.7 + >=dev-libs/rccl-5.7[${ROCM_USEDEP}] + >=sci-libs/rocThrust-5.7[${ROCM_USEDEP}] + >=sci-libs/rocPRIM-5.7[${ROCM_USEDEP}] + >=sci-libs/hipBLAS-5.7[${ROCM_USEDEP}] + >=sci-libs/hipFFT-5.7[${ROCM_USEDEP}] + >=sci-libs/hipSPARSE-5.7[${ROCM_USEDEP}] + >=sci-libs/hipRAND-5.7[${ROCM_USEDEP}] + >=sci-libs/hipCUB-5.7[${ROCM_USEDEP}] + >=sci-libs/hipSOLVER-5.7[${ROCM_USEDEP}] + >=sci-libs/miopen-5.7[${ROCM_USEDEP}] + >=dev-util/roctracer-5.7[${ROCM_USEDEP}] + ) tensorpipe? ( sci-libs/tensorpipe[cuda?] ) xnnpack? ( >=sci-libs/XNNPACK-2022.12.22 ) mkl? ( sci-libs/mkl ) @@ -92,6 +109,7 @@ PATCHES=( "${FILESDIR}"/${PN}-2.1.1-cudaExtra.patch "${FILESDIR}"/${PN}-2.1.2-fix-rpath.patch "${FILESDIR}"/${PN}-2.1.2-fix-openmp-link.patch + "${FILESDIR}"/${PN}-2.1.2-rocm-fix-std-cpp17.patch ) src_prepare() { @@ -118,6 +136,18 @@ src_prepare() { cmake/Dependencies.cmake \ torch/CMakeLists.txt \ CMakeLists.txt + + if use rocm; then + sed -e "s:ROCM_PATH /opt/rocm:ROCM_PATH /usr:" \ + -e "s:HIP_PATH \${ROCM_PATH}/hip:HIP_PATH /usr:" \ + -e "s:\${HIP_PATH}/cmake:/usr/$(get_libdir)/cmake/hip:g" \ + -e "s/HIP 1.0/HIP 1.0 REQUIRED/" \ + -i cmake/public/LoadHIP.cmake || die + + ebegin "HIPifying cuda sources" + ${EPYTHON} tools/amd_build/build_amd.py || die + eend $? + fi } src_configure() { @@ -140,9 +170,6 @@ src_configure() { -DUSE_CCACHE=OFF -DUSE_CUDA=$(usex cuda) - -DUSE_CUDNN=$(usex cuda) - -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}" - -DBUILD_NVFUSER=$(usex cuda) -DUSE_DISTRIBUTED=$(usex distributed) -DUSE_MPI=$(usex mpi) -DUSE_FAKELOWP=OFF @@ -155,7 +182,6 @@ src_configure() { -DUSE_LEVELDB=OFF -DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma -DUSE_MKLDNN=$(usex onednn) - -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library -DUSE_NNPACK=$(usex nnpack) -DUSE_QNNPACK=$(usex qnnpack) -DUSE_XNNPACK=$(usex xnnpack) @@ -166,7 +192,7 @@ src_configure() { -DUSE_OPENCL=$(usex opencl) -DUSE_OPENCV=$(usex opencv) -DUSE_OPENMP=$(usex openmp) - -DUSE_ROCM=OFF # TODO + -DUSE_ROCM=$(usex rocm) -DUSE_SYSTEM_CPUINFO=ON -DUSE_SYSTEM_PYBIND11=ON -DUSE_UCC=OFF @@ -200,8 +226,20 @@ src_configure() { addpredict "/dev/char" mycmakeargs+=( + -DUSE_CUDNN=ON + -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}" + -DBUILD_NVFUSER=ON + -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library -DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")" ) + elif use rocm; then + export PYTORCH_ROCM_ARCH="$(get_amdgpu_flags)" + + mycmakeargs+=( + -DBUILD_NVFUSER=ON + -DUSE_NCCL=ON + -DUSE_SYSTEM_NCCL=ON + ) fi if use onednn; then @@ -214,6 +252,9 @@ src_configure() { fi cmake_src_configure + + # do not rerun cmake and the build process in src_install + sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die } src_install() { @@ -225,7 +266,7 @@ src_install() { rm -rf python mkdir -p python/torch/include || die mv "${ED}"/usr/lib/python*/site-packages/caffe2 python/ || die - if use cuda; then + if use cuda || use rocm; then mv "${ED}${S}"/nvfuser python/nvfuser || die mv "${ED}"/usr/$(get_libdir)/nvfuser.so python/nvfuser/_C.so || die fi @@ -234,7 +275,7 @@ src_install() { python_domodule python/torch ln -s ../../../../../include/torch \ "${D}$(python_get_sitedir)"/torch/include/torch || die # bug 923269 - if use cuda; then + if use cuda || use rocm; then python_domodule python/nvfuser fi rm -rf "${ED}${WORKDIR}" diff --git a/sci-libs/caffe2/caffe2-2.2.1.ebuild b/sci-libs/caffe2/caffe2-2.2.1-r1.ebuild index 68328fb71624..80dc2b500a0f 100644 --- a/sci-libs/caffe2/caffe2-2.2.1.ebuild +++ b/sci-libs/caffe2/caffe2-2.2.1-r1.ebuild @@ -4,7 +4,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{9..12} ) -inherit python-single-r1 cmake cuda flag-o-matic prefix +ROCM_VERSION=5.7 +inherit python-single-r1 cmake cuda flag-o-matic prefix rocm MYPN=pytorch MYP=${MYPN}-${PV} @@ -17,14 +18,16 @@ SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz LICENSE="BSD" SLOT="0" KEYWORDS="~amd64" -IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn openblas opencl opencv openmp qnnpack xnnpack" +IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn openblas opencl opencv openmp qnnpack rocm xnnpack" RESTRICT="test" REQUIRED_USE=" ${PYTHON_REQUIRED_USE} ffmpeg? ( opencv ) mpi? ( distributed ) gloo? ( distributed ) -" # ?? ( cuda rocm ) + ?? ( cuda rocm ) + rocm? ( || ( ${ROCM_REQUIRED_USE} ) ) +" # CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122 RDEPEND=" @@ -45,7 +48,7 @@ RDEPEND=" >=dev-libs/cudnn-frontend-0.9.2:0/8 dev-util/nvidia-cuda-toolkit:=[profiler] ) - fbgemm? ( >=dev-libs/FBGEMM-2023.11.02 ) + fbgemm? ( >=dev-libs/FBGEMM-2023.12.01 ) ffmpeg? ( media-video/ffmpeg:= ) gloo? ( sci-libs/gloo[cuda?] ) mpi? ( virtual/mpi ) @@ -57,6 +60,20 @@ RDEPEND=" opencl? ( virtual/opencl ) opencv? ( media-libs/opencv:= ) qnnpack? ( sci-libs/QNNPACK ) + rocm? ( + >=dev-util/hip-5.7 + >=dev-libs/rccl-5.7[${ROCM_USEDEP}] + >=sci-libs/rocThrust-5.7[${ROCM_USEDEP}] + >=sci-libs/rocPRIM-5.7[${ROCM_USEDEP}] + >=sci-libs/hipBLAS-5.7[${ROCM_USEDEP}] + >=sci-libs/hipFFT-5.7[${ROCM_USEDEP}] + >=sci-libs/hipSPARSE-5.7[${ROCM_USEDEP}] + >=sci-libs/hipRAND-5.7[${ROCM_USEDEP}] + >=sci-libs/hipCUB-5.7[${ROCM_USEDEP}] + >=sci-libs/hipSOLVER-5.7[${ROCM_USEDEP}] + >=sci-libs/miopen-5.7[${ROCM_USEDEP}] + >=dev-util/roctracer-5.7[${ROCM_USEDEP}] + ) distributed? ( sci-libs/tensorpipe[cuda?] ) xnnpack? ( >=sci-libs/XNNPACK-2022.12.22 ) mkl? ( sci-libs/mkl ) @@ -89,6 +106,7 @@ PATCHES=( "${FILESDIR}"/${PN}-2.0.0-cudnn_include_fix.patch "${FILESDIR}"/${PN}-2.1.2-fix-rpath.patch "${FILESDIR}"/${PN}-2.1.2-fix-openmp-link.patch + "${FILESDIR}"/${PN}-2.1.2-rocm-fix-std-cpp17.patch ) src_prepare() { @@ -115,6 +133,17 @@ src_prepare() { cmake/Dependencies.cmake \ torch/CMakeLists.txt \ CMakeLists.txt + + if use rocm; then + sed -e "s:/opt/rocm:/usr:" \ + -e "s:lib/cmake:$(get_libdir)/cmake:g" \ + -e "s/HIP 1.0/HIP 1.0 REQUIRED/" \ + -i cmake/public/LoadHIP.cmake || die + + ebegin "HIPifying cuda sources" + ${EPYTHON} tools/amd_build/build_amd.py || die + eend $? + fi } src_configure() { @@ -137,9 +166,6 @@ src_configure() { -DUSE_CCACHE=OFF -DUSE_CUDA=$(usex cuda) - -DUSE_CUDNN=$(usex cuda) - -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}" - -DBUILD_NVFUSER=$(usex cuda) -DUSE_DISTRIBUTED=$(usex distributed) -DUSE_MPI=$(usex mpi) -DUSE_FAKELOWP=OFF @@ -152,7 +178,6 @@ src_configure() { -DUSE_LEVELDB=OFF -DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma -DUSE_MKLDNN=$(usex onednn) - -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library -DUSE_NNPACK=$(usex nnpack) -DUSE_QNNPACK=$(usex qnnpack) -DUSE_XNNPACK=$(usex xnnpack) @@ -163,7 +188,7 @@ src_configure() { -DUSE_OPENCL=$(usex opencl) -DUSE_OPENCV=$(usex opencv) -DUSE_OPENMP=$(usex openmp) - -DUSE_ROCM=OFF # TODO + -DUSE_ROCM=$(usex rocm) -DUSE_SYSTEM_CPUINFO=ON -DUSE_SYSTEM_PYBIND11=ON -DUSE_UCC=OFF @@ -197,8 +222,18 @@ src_configure() { addpredict "/dev/char" mycmakeargs+=( + -DUSE_CUDNN=ON + -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}" + -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library -DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")" ) + elif use rocm; then + export PYTORCH_ROCM_ARCH="$(get_amdgpu_flags)" + + mycmakeargs+=( + -DUSE_NCCL=ON + -DUSE_SYSTEM_NCCL=ON + ) fi if use onednn; then @@ -211,6 +246,9 @@ src_configure() { fi cmake_src_configure + + # do not rerun cmake and the build process in src_install + sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die } src_install() { diff --git a/sci-libs/caffe2/files/caffe2-2.1.2-rocm-fix-std-cpp17.patch b/sci-libs/caffe2/files/caffe2-2.1.2-rocm-fix-std-cpp17.patch new file mode 100644 index 000000000000..cb0fa0c48e80 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.1.2-rocm-fix-std-cpp17.patch @@ -0,0 +1,68 @@ +Fix for error: invalid argument '-std=c++17' not allowed with 'C' +https://github.com/pytorch/pytorch/issues/103222 +--- a/c10/hip/CMakeLists.txt ++++ b/c10/hip/CMakeLists.txt +@@ -30,6 +30,7 @@ hip_add_library(c10_hip ${C10_HIP_SRCS} ${C10_HIP_HEADERS}) + + # Propagate HIP_CXX_FLAGS that were set from Dependencies.cmake + target_compile_options(c10_hip PRIVATE ${HIP_CXX_FLAGS}) ++set_target_properties(c10_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + + # caffe2_hip adds a bunch of dependencies like rocsparse, but c10/hip is supposed to be + # minimal. I'm not sure if we need hip_hcc or not; for now leave it out +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -1598,6 +1598,7 @@ if(USE_ROCM) + + # Since PyTorch files contain HIP headers, these flags are required for the necessary definitions to be added. + target_compile_options(torch_hip PUBLIC ${HIP_CXX_FLAGS}) # experiment ++ set_target_properties(torch_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + target_link_libraries(torch_hip PUBLIC c10_hip) + + if(NOT INTERN_BUILD_MOBILE) +@@ -1774,6 +1775,7 @@ if(BUILD_TEST) + target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) + target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE}) + target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS}) ++ set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) + if(INSTALL_TEST) + install(TARGETS ${test_name} DESTINATION test) +@@ -1955,6 +1957,7 @@ if(BUILD_PYTHON) + endif() + if(NOT MSVC) + target_compile_options(caffe2_pybind11_state_hip PRIVATE ${HIP_CXX_FLAGS} -fvisibility=hidden) ++ set_target_properties(caffe2_pybind11_state_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + endif() + set_target_properties(caffe2_pybind11_state_hip PROPERTIES PREFIX "") + set_target_properties(caffe2_pybind11_state_hip PROPERTIES SUFFIX ${PY_EXT_SUFFIX}) +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1287,7 +1287,6 @@ if(USE_ROCM) + list(APPEND HIP_CXX_FLAGS -Wno-duplicate-decl-specifier) + list(APPEND HIP_CXX_FLAGS -DCAFFE2_USE_MIOPEN) + list(APPEND HIP_CXX_FLAGS -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP) +- list(APPEND HIP_CXX_FLAGS -std=c++17) + add_definitions(-DROCM_VERSION=${ROCM_VERSION_DEV_INT}) + add_definitions(-DTORCH_HIP_VERSION=${TORCH_HIP_VERSION}) + message("TORCH_HIP_VERSION=${TORCH_HIP_VERSION} is added as a compiler defines") +--- a/cmake/public/utils.cmake ++++ b/cmake/public/utils.cmake +@@ -335,6 +335,7 @@ function(caffe2_hip_binary_target target_name_or_src) + caffe2_binary_target(${target_name_or_src}) + + target_compile_options(${__target} PRIVATE ${HIP_CXX_FLAGS}) ++ set_target_properties(${__target} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + target_include_directories(${__target} PRIVATE ${Caffe2_HIP_INCLUDE}) + endfunction() + +--- a/modules/detectron/CMakeLists.txt ++++ b/modules/detectron/CMakeLists.txt +@@ -31,6 +31,7 @@ if(BUILD_CAFFE2_OPS) + ${Detectron_CPU_SRCS} + ${Detectron_HIP_SRCS}) + target_compile_options(caffe2_detectron_ops_hip PRIVATE ${HIP_CXX_FLAGS}) ++ set_target_properties(caffe2_detectron_ops_hip PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF) + if(USE_MKLDNN) + target_link_libraries(caffe2_detectron_ops_hip PRIVATE caffe2::mkldnn) + endif() diff --git a/sci-libs/caffe2/metadata.xml b/sci-libs/caffe2/metadata.xml index 3fe84b0977fc..ed1f9fa58993 100644 --- a/sci-libs/caffe2/metadata.xml +++ b/sci-libs/caffe2/metadata.xml @@ -18,6 +18,7 @@ <flag name="opencv">Add support for image processing operators</flag> <flag name="openmp">Use OpenMP for parallel code</flag> <flag name="qnnpack">Use QNNPACK</flag> + <flag name="rocm">Enable ROCm gpu computing support</flag> <flag name="tensorpipe">Use tensorpipe</flag> <flag name="xnnpack">Use XNNPACK</flag> </use> |