Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/CMakeLists.txt
| Show First 20 Lines • Show All 446 Lines • ▼ Show 20 Lines | if(WITH_CYCLES_CUBIN_COMPILER) | ||||
| set(CUBIN_CC_ENV ${CMAKE_COMMAND} | set(CUBIN_CC_ENV ${CMAKE_COMMAND} | ||||
| -E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib") | -E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib") | ||||
| elseif(UNIX) | elseif(UNIX) | ||||
| set(CUBIN_CC_ENV ${CMAKE_COMMAND} | set(CUBIN_CC_ENV ${CMAKE_COMMAND} | ||||
| -E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64") | -E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64") | ||||
| endif() | endif() | ||||
| add_custom_command( | add_custom_command( | ||||
| OUTPUT ${cuda_cubin} | OUTPUT ${cuda_file} | ||||
| COMMAND ${CUBIN_CC_ENV} | COMMAND ${CUBIN_CC_ENV} | ||||
| "$<TARGET_FILE:cycles_cubin_cc>" | "$<TARGET_FILE:cycles_cubin_cc>" | ||||
| -target ${CUDA_ARCH} | -target ${CUDA_ARCH} | ||||
| -i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} | -i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} | ||||
| ${cuda_flags} | ${cuda_flags} | ||||
| -v | -v | ||||
| -cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}" | -cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}" | ||||
| DEPENDS ${kernel_sources} cycles_cubin_cc) | DEPENDS ${kernel_sources} cycles_cubin_cc) | ||||
| set(cuda_file ${cuda_cubin}) | |||||
| else() | else() | ||||
| add_custom_command( | add_custom_command( | ||||
| OUTPUT ${cuda_file} | OUTPUT ${cuda_file} | ||||
| COMMAND ${CUDA_NVCC_EXECUTABLE} | COMMAND ${CUDA_NVCC_EXECUTABLE} | ||||
| -arch=${arch} | -arch=${arch} | ||||
| ${CUDA_NVCC_FLAGS} | ${CUDA_NVCC_FLAGS} | ||||
| --${format} | --${format} | ||||
| ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} | ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} | ||||
| Show All 39 Lines | if(WITH_CYCLES_DEVICE_OPTIX) | ||||
| foreach(input ${SRC_OPTIX_KERNELS}) | foreach(input ${SRC_OPTIX_KERNELS}) | ||||
| get_filename_component(input_we ${input} NAME_WE) | get_filename_component(input_we ${input} NAME_WE) | ||||
| set(output "${CMAKE_CURRENT_BINARY_DIR}/${input_we}.ptx") | set(output "${CMAKE_CURRENT_BINARY_DIR}/${input_we}.ptx") | ||||
| set(cuda_flags | set(cuda_flags | ||||
| -I "${OPTIX_INCLUDE_DIR}" | -I "${OPTIX_INCLUDE_DIR}" | ||||
| -I "${CMAKE_CURRENT_SOURCE_DIR}/.." | -I "${CMAKE_CURRENT_SOURCE_DIR}/.." | ||||
| -I "${CMAKE_CURRENT_SOURCE_DIR}/kernels/cuda" | -I "${CMAKE_CURRENT_SOURCE_DIR}/kernels/cuda" | ||||
| -arch=sm_30 | |||||
| --use_fast_math | --use_fast_math | ||||
| -o ${output}) | -o ${output}) | ||||
| if(NOT WITH_CYCLES_CUBIN_COMPILER) | |||||
| set(cuda_flags ${cuda_flags} -arch=sm_30) | |||||
pmoursnv: I'd move this down into the `add_custom_command` line, similar to how you added `-target 30`… | |||||
| endif() | |||||
| if(WITH_CYCLES_DEBUG) | if(WITH_CYCLES_DEBUG) | ||||
| set(cuda_flags ${cuda_flags} | set(cuda_flags ${cuda_flags} | ||||
| -D __KERNEL_DEBUG__) | -D __KERNEL_DEBUG__) | ||||
| endif() | endif() | ||||
| if(WITH_CYCLES_CUBIN_COMPILER) | |||||
| # Needed to find libnvrtc-builtins.so. Can't do it from inside | |||||
| # cycles_cubin_cc since the env variable is read before main() | |||||
| if(APPLE) | |||||
| set(CUBIN_CC_ENV ${CMAKE_COMMAND} | |||||
| -E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib") | |||||
| elseif(UNIX) | |||||
| set(CUBIN_CC_ENV ${CMAKE_COMMAND} | |||||
| -E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64") | |||||
| endif() | |||||
| add_custom_command( | |||||
| OUTPUT ${output} | |||||
| DEPENDS | |||||
| ${input} | |||||
| ${SRC_HEADERS} | |||||
| ${SRC_KERNELS_CUDA_HEADERS} | |||||
| ${SRC_KERNELS_OPTIX_HEADERS} | |||||
| ${SRC_BVH_HEADERS} | |||||
| ${SRC_SVM_HEADERS} | |||||
| ${SRC_GEOM_HEADERS} | |||||
| ${SRC_CLOSURE_HEADERS} | |||||
| ${SRC_UTIL_HEADERS} | |||||
| COMMAND ${CUBIN_CC_ENV} | |||||
| "$<TARGET_FILE:cycles_cubin_cc>" | |||||
| -target 30 | |||||
| -ptx | |||||
| -i ${CMAKE_CURRENT_SOURCE_DIR}/${input} | |||||
Done Inline ActionsThis is the reason you see OPTIX_ERROR_INVALID_PTX. You are compiling the CUDA kernel with cycles_cubin_cc here, not the OptiX kernel. Changing this to -i ${CMAKE_CURRENT_SOURCE_DIR}/${input} fixes that.
pmoursnv: This is the reason you see `OPTIX_ERROR_INVALID_PTX`. You are compiling the CUDA kernel with… | |||||
| ${cuda_flags} | |||||
| -v | |||||
| -cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}" | |||||
| DEPENDS ${kernel_sources} cycles_cubin_cc) | |||||
| else() | |||||
| add_custom_command( | add_custom_command( | ||||
| OUTPUT | OUTPUT | ||||
| ${output} | ${output} | ||||
| DEPENDS | DEPENDS | ||||
| ${input} | ${input} | ||||
| ${SRC_HEADERS} | ${SRC_HEADERS} | ||||
| ${SRC_KERNELS_CUDA_HEADERS} | ${SRC_KERNELS_CUDA_HEADERS} | ||||
| ${SRC_KERNELS_OPTIX_HEADERS} | ${SRC_KERNELS_OPTIX_HEADERS} | ||||
| ${SRC_BVH_HEADERS} | ${SRC_BVH_HEADERS} | ||||
| ${SRC_SVM_HEADERS} | ${SRC_SVM_HEADERS} | ||||
| ${SRC_GEOM_HEADERS} | ${SRC_GEOM_HEADERS} | ||||
| ${SRC_CLOSURE_HEADERS} | ${SRC_CLOSURE_HEADERS} | ||||
| ${SRC_UTIL_HEADERS} | ${SRC_UTIL_HEADERS} | ||||
| COMMAND | COMMAND | ||||
| ${CUDA_NVCC_EXECUTABLE} --ptx ${cuda_flags} ${input} | ${CUDA_NVCC_EXECUTABLE} --ptx ${cuda_flags} ${input} | ||||
| WORKING_DIRECTORY | WORKING_DIRECTORY | ||||
| "${CMAKE_CURRENT_SOURCE_DIR}") | "${CMAKE_CURRENT_SOURCE_DIR}") | ||||
| endif() | |||||
| list(APPEND optix_ptx ${output}) | list(APPEND optix_ptx ${output}) | ||||
| delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${output}" ${CYCLES_INSTALL_PATH}/lib) | delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${output}" ${CYCLES_INSTALL_PATH}/lib) | ||||
| endforeach() | endforeach() | ||||
| add_custom_target(cycles_kernel_optix ALL DEPENDS ${optix_ptx}) | add_custom_target(cycles_kernel_optix ALL DEPENDS ${optix_ptx}) | ||||
| cycles_set_solution_folder(cycles_kernel_optix) | cycles_set_solution_folder(cycles_kernel_optix) | ||||
| endif() | endif() | ||||
| ▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines | |||||
I'd move this down into the add_custom_command line, similar to how you added -target 30 for the cubin compiler.