From c306ccb67fcf44d9bca3c4ed0f20d1af1df29f26 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Tue, 8 Nov 2022 19:31:48 +0100 Subject: Fix Cycles error with runtime compilation when there is no path to OptiX SDK If no OPTIX_ROOT is set, nvcc fails to compile because there is a stray "-I" in the arguments. Detect if the include path is empty and act accordingly. Differential Revision: https://developer.blender.org/D16308 --- intern/cycles/device/cuda/device_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'intern/cycles/device/cuda/device_impl.cpp') diff --git a/intern/cycles/device/cuda/device_impl.cpp b/intern/cycles/device/cuda/device_impl.cpp index 01c021551f3..b56765208ee 100644 --- a/intern/cycles/device/cuda/device_impl.cpp +++ b/intern/cycles/device/cuda/device_impl.cpp @@ -232,7 +232,7 @@ string CUDADevice::compile_kernel_get_common_cflags(const uint kernel_features) return cflags; } -string CUDADevice::compile_kernel(const uint kernel_features, +string CUDADevice::compile_kernel(const string& common_cflags, const char *name, const char *base, bool force_ptx) @@ -281,7 +281,6 @@ string CUDADevice::compile_kernel(const uint kernel_features, /* We include cflags into md5 so changing cuda toolkit or changing other * compiler command line arguments makes sure cubin gets re-built. */ - string common_cflags = compile_kernel_get_common_cflags(kernel_features); const string kernel_md5 = util_md5_string(source_md5 + common_cflags); const char *const kernel_ext = force_ptx ? "ptx" : "cubin"; @@ -417,7 +416,8 @@ bool CUDADevice::load_kernels(const uint kernel_features) /* get kernel */ const char *kernel_name = "kernel"; - string cubin = compile_kernel(kernel_features, kernel_name); + string cflags = compile_kernel_get_common_cflags(kernel_features); + string cubin = compile_kernel(cflags, kernel_name); if (cubin.empty()) return false; -- cgit v1.2.3 From 4b57bc4e5d4cada4a40d51745cc951f69f9aab08 Mon Sep 17 00:00:00 2001 From: Chris Blackbourn Date: Wed, 9 Nov 2022 08:30:18 +1300 Subject: Cleanup: format --- intern/cycles/device/cuda/device_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/cycles/device/cuda/device_impl.cpp') diff --git a/intern/cycles/device/cuda/device_impl.cpp b/intern/cycles/device/cuda/device_impl.cpp index b56765208ee..c9764d1c21b 100644 --- a/intern/cycles/device/cuda/device_impl.cpp +++ b/intern/cycles/device/cuda/device_impl.cpp @@ -232,7 +232,7 @@ string CUDADevice::compile_kernel_get_common_cflags(const uint kernel_features) return cflags; } -string CUDADevice::compile_kernel(const string& common_cflags, +string CUDADevice::compile_kernel(const string &common_cflags, const char *name, const char *base, bool force_ptx) -- cgit v1.2.3