1
1

Cycles: disable light tree on HIP due to internal compiler errors

To avoid this blocking the merge to master, but still plan to fix this for
the 3.5 release.
This commit is contained in:
2022-12-02 16:17:54 +01:00
parent d55e3733e8
commit a3c45bc313
6 changed files with 38 additions and 8 deletions

View File

@@ -351,6 +351,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.num = 0;
info.has_nanovdb = true;
info.has_light_tree = true;
info.has_osl = true;
info.has_guiding = true;
info.has_profiling = true;
@@ -399,6 +400,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_nanovdb &= device.has_nanovdb;
info.has_light_tree &= device.has_light_tree;
info.has_osl &= device.has_osl;
info.has_guiding &= device.has_guiding;
info.has_profiling &= device.has_profiling;

View File

@@ -65,6 +65,7 @@ class DeviceInfo {
int num;
bool display_device; /* GPU is used as a display device. */
bool has_nanovdb; /* Support NanoVDB volumes. */
bool has_light_tree; /* Support light tree. */
bool has_osl; /* Support Open Shading Language. */
bool has_guiding; /* Support path guiding. */
bool has_profiling; /* Supports runtime collection of profiling info. */
@@ -84,6 +85,7 @@ class DeviceInfo {
cpu_threads = 0;
display_device = false;
has_nanovdb = false;
has_light_tree = true;
has_osl = false;
has_guiding = false;
has_profiling = false;

View File

@@ -137,6 +137,7 @@ void device_hip_info(vector<DeviceInfo> &devices)
info.num = num;
info.has_nanovdb = true;
info.has_light_tree = false;
info.denoisers = 0;
info.has_gpu_queue = true;

View File

@@ -337,6 +337,7 @@ ccl_device_inline bool light_sample_from_volume_segment(KernelGlobals kg,
int emitter_shader_flag = 0;
float emitter_pdf_selection = 0.0f;
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
if (!light_tree_sample<true>(kg,
randu,
@@ -355,7 +356,9 @@ ccl_device_inline bool light_sample_from_volume_segment(KernelGlobals kg,
return false;
}
}
else {
else
#endif
{
if (!light_distribution_sample(kg,
randu,
randv,
@@ -425,6 +428,7 @@ ccl_device bool light_sample_from_position(KernelGlobals kg,
int emitter_shader_flag = 0;
float emitter_pdf_selection = 0.0f;
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
if (!light_tree_sample<false>(kg,
randu,
@@ -443,7 +447,9 @@ ccl_device bool light_sample_from_position(KernelGlobals kg,
return false;
}
}
else {
else
#endif
{
if (!light_distribution_sample(kg,
randu,
randv,
@@ -509,10 +515,13 @@ ccl_device_inline bool light_sample_new_position(KernelGlobals kg,
return false;
}
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
ls->pdf *= ls->pdf_selection;
}
else {
else
#endif
{
/* Handled in triangle_light_sample for effeciency. */
}
return true;
@@ -558,6 +567,7 @@ ccl_device_inline float light_sample_mis_weight_forward_surface(KernelGlobals kg
float pdf = triangle_light_pdf(kg, sd, t);
/* Light selection pdf. */
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
float3 ray_P = INTEGRATOR_STATE(state, ray, P);
const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n);
@@ -565,7 +575,9 @@ ccl_device_inline float light_sample_mis_weight_forward_surface(KernelGlobals kg
uint prim_offset = kernel_data_fetch(object_prim_offset, sd->object);
pdf *= light_tree_pdf(kg, ray_P, N, path_flag, sd->prim - prim_offset + lookup_offset);
}
else {
else
#endif
{
/* Handled in triangle_light_pdf for effeciency. */
}
@@ -582,11 +594,14 @@ ccl_device_inline float light_sample_mis_weight_forward_lamp(KernelGlobals kg,
float pdf = ls->pdf;
/* Light selection pdf. */
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n);
pdf *= light_tree_pdf(kg, P, N, path_flag, ~ls->lamp);
}
else {
else
#endif
{
pdf *= light_distribution_pdf_lamp(kg);
}
@@ -613,11 +628,14 @@ ccl_device_inline float light_sample_mis_weight_forward_background(KernelGlobals
float pdf = background_light_pdf(kg, ray_P, ray_D);
/* Light selection pdf. */
#ifdef __LIGHT_TREE__
if (kernel_data.integrator.use_light_tree) {
const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n);
pdf *= light_tree_pdf(kg, ray_P, N, path_flag, ~kernel_data.background.light_index);
}
else {
else
#endif
{
pdf *= light_distribution_pdf_lamp(kg);
}

View File

@@ -60,6 +60,7 @@ CCL_NAMESPACE_BEGIN
#define __DENOISING_FEATURES__
#define __DPDU__
#define __HAIR__
#define __LIGHT_TREE__
#define __OBJECT_MOTION__
#define __PASSES__
#define __PATCH_EVAL__
@@ -74,6 +75,11 @@ CCL_NAMESPACE_BEGIN
#define __VISIBILITY_FLAG__
#define __VOLUME__
/* TODO: solve internal compiler errors and enable light tree on HIP. */
#ifdef __KERNEL_HIP__
# undef __LIGHT_TREE__
#endif
/* Device specific features */
#ifdef WITH_OSL
# define __OSL__

View File

@@ -848,7 +848,7 @@ void LightManager::device_update_background(Device *device,
dscene->light_background_conditional_cdf.copy_to_device();
}
void LightManager::device_update_lights(Device *, DeviceScene *dscene, Scene *scene)
void LightManager::device_update_lights(Device *device, DeviceScene *dscene, Scene *scene)
{
/* Counts lights in the scene. */
size_t num_lights = 0;
@@ -882,7 +882,8 @@ void LightManager::device_update_lights(Device *, DeviceScene *dscene, Scene *sc
/* Update integrator settings. */
KernelIntegrator *kintegrator = &dscene->data.integrator;
kintegrator->use_light_tree = scene->integrator->get_use_light_tree();
kintegrator->use_light_tree = scene->integrator->get_use_light_tree() &&
device->info.has_light_tree;
kintegrator->num_lights = num_lights;
kintegrator->num_distant_lights = num_distant_lights;
kintegrator->num_background_lights = num_background_lights;