Skip to content

Commit 073c7d5

Browse files
committed
Used ChatGpt Codex.
Fixes HIP building. Fixes OneApi building for Linux and Windows. Needs reviewing and testing. Branch only made to not loose anything.
1 parent 95dc48e commit 073c7d5

File tree

10 files changed

+387
-27
lines changed

10 files changed

+387
-27
lines changed

DockerfileHIP

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# 'docker run -it -v D:/dev/mcneel/rhino-8.x:/rhino/rhino-8.x ubuntu-cycles-hip-build'
1010
# * The .fatbin files should en up in the cycles/cycles/install/lib directory
1111

12+
# FROM --platform=linux/amd64 ubuntu:22.04
1213
FROM ubuntu:22.04
1314

1415
RUN apt-get update
@@ -21,11 +22,10 @@ RUN apt-get install -y wget
2122
RUN apt-get install -y dos2unix
2223

2324
WORKDIR /rhino
24-
RUN wget https://repo.radeon.com/amdgpu-install/6.2.2/ubuntu/jammy/amdgpu-install_6.2.60202-1_all.deb
25-
RUN apt-get install -y ./amdgpu-install_6.2.60202-1_all.deb
26-
RUN amdgpu-install -y --no-dkms --usecase=rocm
25+
RUN wget https://repo.radeon.com/amdgpu-install/7.1.1/ubuntu/jammy/amdgpu-install_7.1.1.70101-1_all.deb
26+
RUN apt-get install -y ./amdgpu-install_7.1.1.70101-1_all.deb
27+
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC amdgpu-install -y --no-dkms --usecase=rocm
2728

28-
29-
CMD ["bash", "-c", "cd /rhino/rhino-8.x/src4/rhino4/Plug-ins/RDK/cycles/cycles && dos2unix make_hip.sh && ./make_hip.sh Release"]
29+
CMD ["bash", "-c", "cd /rhino/rhino-8.x/src4/rhino4/Plug-ins/RDK/cycles/cycles && dos2unix make_hip.sh && bash make_hip.sh Release"]
3030

3131
#ENTRYPOINT [ "bash" ]

DockerfileOneAPI

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# This Dockerfile will build Intel OneAPI binaries
1+
# This Dockerfile builds Intel oneAPI binaries for Linux.
2+
# Output artifact: libcycles_kernel_oneapi_*.so (not Windows DLL).
3+
# For Windows DLL output use make_oneapi.bat on a Windows oneAPI toolchain.
24
# All you need to do is the following:
35
# On Windows:
46
# * Install Docker Desktop
@@ -8,16 +10,17 @@
810
# * After that, run the Docker image in a container while mounting your Rhino repository root:
911
# 'docker run -it -v D:/dev/mcneel/rhino-8.x:/rhino/rhino-8.x ubuntu-cycles-oneapi-build'
1012

11-
FROM ubuntu:latest
13+
FROM ubuntu:22.04
1214

13-
RUN apt-get update
14-
RUN apt-get install -y cmake
15-
RUN apt-get install -y g++
16-
RUN apt-get install -y subversion
17-
RUN apt-get install -y git
18-
RUN apt-get install -y python3
19-
RUN apt-get install -y xorg-dev
15+
RUN apt-get update && \
16+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
17+
cmake \
18+
dos2unix \
19+
g++ \
20+
git \
21+
python3 \
22+
subversion \
23+
xorg-dev && \
24+
rm -rf /var/lib/apt/lists/*
2025

21-
CMD ["bash", "-c", "cd /rhino/rhino-8.x/src4/rhino4/Plug-ins/RDK/cycles/cycles && ./make_oneapi.sh Debug"]
22-
23-
# && ./make_oneapi.sh Debug
26+
CMD ["bash", "-lc", "cd /rhino/rhino-8.x/src4/rhino4/Plug-ins/RDK/cycles/cycles && dos2unix make_oneapi.sh && bash make_oneapi.sh Release"]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ git push <branch_name>
6060

6161
2. Navigate to `RDK/cycles/cycles`.
6262

63+
For oneAPI DLL-only builds, run:
64+
`make_oneapi.bat release jit` (or `make_oneapi.bat release aot`).
65+
6366
3. Execute `rm -fr build/`.
6467

6568
4. Run `./make_rhino.bat release all`.

make_hip.sh

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ BUILD_DIR=build_hip
66
PYTHON=python3
77
COMMAND=$1
88

9+
HIPCC_EXECUTABLE="${HIP_HIPCC_EXECUTABLE:-}"
10+
BUILD_TARGET="${CYCLES_HIP_BUILD_TARGET:-cycles_kernel_hip}"
11+
BUILD_JOBS="${CYCLES_HIP_BUILD_JOBS:-1}"
12+
HIP_ARCH_LIST="${CYCLES_HIP_BINARIES_ARCH_LIST:-gfx900;gfx906;gfx90c;gfx902;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1200;gfx1201}"
13+
914
#rm -rf $BUILD_DIR
1015

1116
if [ -z "$COMMAND" ]
@@ -14,6 +19,30 @@ then
1419
fi
1520

1621
#$PYTHON src/cmake/make_update.py
22+
if [ -z "$HIPCC_EXECUTABLE" ]
23+
then
24+
if command -v hipcc >/dev/null 2>&1
25+
then
26+
HIPCC_EXECUTABLE="$(command -v hipcc)"
27+
elif [ -x /opt/rocm/bin/hipcc ]
28+
then
29+
HIPCC_EXECUTABLE="/opt/rocm/bin/hipcc"
30+
elif [ -x /opt/rocm-6.2.2/bin/hipcc ]
31+
then
32+
HIPCC_EXECUTABLE="/opt/rocm-6.2.2/bin/hipcc"
33+
else
34+
echo "Could not find hipcc. Set HIP_HIPCC_EXECUTABLE to a valid hipcc path."
35+
exit 1
36+
fi
37+
fi
38+
39+
echo "Using hipcc at: $HIPCC_EXECUTABLE"
40+
echo "Building target: $BUILD_TARGET"
41+
echo "Parallel jobs: $BUILD_JOBS"
42+
echo "HIP arch list: $HIP_ARCH_LIST"
43+
44+
45+
1746

1847
cmake -B $BUILD_DIR \
1948
-DWITH_CYCLES_ALEMBIC=OFF \
@@ -31,6 +60,11 @@ cmake -B $BUILD_DIR \
3160
-DWITH_CUDA_DYNLOAD=OFF \
3261
-DWITH_CYCLES_DEVICE_HIP=ON \
3362
-DWITH_CYCLES_HIP_BINARIES=ON \
34-
-DCYCLES_HIP_BINARIES_ARCH="gfx900;gfx906;gfx90c;gfx902;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1200;gfx1201" \
35-
-DHIP_HIPCC_EXECUTABLE="/opt/rocm-6.2.2/bin/hipcc" \
36-
&& cd $BUILD_DIR && cmake --build . -j 8 --target install --config $COMMAND
63+
-DCYCLES_HIP_BINARIES_ARCH="$HIP_ARCH_LIST" \
64+
-DHIP_HIPCC_EXECUTABLE="$HIPCC_EXECUTABLE" \
65+
&& cd $BUILD_DIR \
66+
&& cmake --build . -j "$BUILD_JOBS" --target "$BUILD_TARGET" --config $COMMAND \
67+
&& if [ "$BUILD_TARGET" = "cycles_kernel_hip" ]; then \
68+
mkdir -p ../install/lib; \
69+
cp -f src/kernel/kernel_*.fatbin ../install/lib/; \
70+
fi

make_oneapi.bat

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
@echo off
2+
3+
REM Convenience wrapper for oneAPI-only Windows build that outputs a DLL.
4+
5+
setlocal enableextensions enabledelayedexpansion
6+
7+
set "BUILD_DIR=build_oneapi"
8+
set "PYTHON=python"
9+
set "COMMAND=%1"
10+
set "VARIANT=%2"
11+
12+
if "%COMMAND%" == "" (
13+
set "COMMAND=release"
14+
)
15+
16+
if /I "%COMMAND%" == "release" (
17+
set "CONFIG=RelWithDebInfo"
18+
) else if /I "%COMMAND%" == "debug" (
19+
set "CONFIG=Debug"
20+
) else if /I "%COMMAND%" == "update" (
21+
set "CONFIG="
22+
) else if /I "%COMMAND%" == "clean" (
23+
set "CONFIG="
24+
) else (
25+
echo Command "%COMMAND%" unknown
26+
echo Usage: make_oneapi.bat [release^|debug^|update^|clean] [aot^|jit]
27+
exit /b 1
28+
)
29+
30+
set "CYCLES_LIB_PLATFORMS=win64_vc15"
31+
32+
if /I "%VARIANT%" == "jit" (
33+
set "ONEAPI_BINARIES=OFF"
34+
) else (
35+
set "ONEAPI_BINARIES=ON"
36+
)
37+
38+
if /I "%COMMAND%" == "update" (
39+
%PYTHON% src/cmake/make_update.py --no-cycles
40+
exit /b %ERRORLEVEL%
41+
)
42+
43+
if /I "%COMMAND%" == "clean" (
44+
if exist %BUILD_DIR% (
45+
cd %BUILD_DIR% && cmake --build . --target install --config Clean
46+
exit /b %ERRORLEVEL%
47+
)
48+
echo %BUILD_DIR% does not exist, skipping clean.
49+
exit /b 0
50+
)
51+
52+
if not defined LEVELZERO_INC (
53+
set "LEVELZERO_INC=..\lib\win64_vc15\level-zero\include"
54+
)
55+
if not defined LEVELZERO_LIB (
56+
set "LEVELZERO_LIB=..\lib\win64_vc15\level-zero\lib"
57+
)
58+
if not defined MSVC_REDIST_DIR (
59+
set "MSVC_REDIST_DIR=C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Redist/MSVC/14.29.30133"
60+
)
61+
if not defined WINDOWS_KITS_DIR (
62+
set "WINDOWS_KITS_DIR=C:/Program Files (x86)/Windows Kits/10"
63+
)
64+
65+
%PYTHON% src/cmake/make_update.py --no-cycles
66+
if errorlevel 1 exit /b %ERRORLEVEL%
67+
68+
cmake -B %BUILD_DIR% ^
69+
-DWITH_CYCLES_ALEMBIC=OFF ^
70+
-DWITH_CYCLES_EMBREE=OFF ^
71+
-DWITH_CYCLES_OPENCOLORIO=OFF ^
72+
-DWITH_CYCLES_OPENIMAGEDENOISE=OFF ^
73+
-DWITH_CYCLES_OPENSUBDIV=OFF ^
74+
-DWITH_CYCLES_OPENVDB=OFF ^
75+
-DWITH_CYCLES_NANOVDB=OFF ^
76+
-DWITH_CYCLES_OSL=OFF ^
77+
-DWITH_CYCLES_USD=OFF ^
78+
-DWITH_CYCLES_HYDRA_RENDER_DELEGATE=OFF ^
79+
-DWITH_CYCLES_CUDA_BINARIES=OFF ^
80+
-DWITH_CYCLES_DEVICE_OPTIX=OFF ^
81+
-DWITH_CUDA_DYNLOAD=OFF ^
82+
-DWITH_CYCLES_DEVICE_ONEAPI=ON ^
83+
-DWITH_CYCLES_ONEAPI_BINARIES=%ONEAPI_BINARIES% ^
84+
-D_LEVEL_ZERO_INCLUDE_DIR=%LEVELZERO_INC% ^
85+
-D_LEVEL_ZERO_LIBRARY=%LEVELZERO_LIB% ^
86+
-DMSVC_REDIST_DIR="%MSVC_REDIST_DIR%" ^
87+
-DWINDOWS_KITS_DIR="%WINDOWS_KITS_DIR%" ^
88+
&& cd %BUILD_DIR% && cmake --build . --target install --config %CONFIG%
89+
90+
if errorlevel 1 exit /b %ERRORLEVEL%
91+
92+
if /I "%ONEAPI_BINARIES%" == "ON" (
93+
echo Built install\cycles_kernel_oneapi_aot.dll
94+
) else (
95+
echo Built install\cycles_kernel_oneapi_jit.dll
96+
)

make_oneapi.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ then
1111
COMMAND=Release
1212
fi
1313

14-
$PYTHON src/cmake/make_update.py
14+
export CYCLES_LIB_PLATFORMS=${CYCLES_LIB_PLATFORMS:-linux_x86_64_glibc_228}
15+
$PYTHON src/cmake/make_update.py --no-cycles
1516

1617
cmake -B $BUILD_DIR \
1718
-DWITH_CYCLES_ALEMBIC=OFF \

0 commit comments

Comments
 (0)