Merge branch 'blender-v3.0-release'

This commit is contained in:
Germano Cavalcante 2021-11-04 16:56:32 -03:00
commit df3e30398f
10 changed files with 471 additions and 477 deletions

View File

@ -1419,9 +1419,10 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.label(text="and NVIDIA driver version 470 or newer", icon='BLANK1')
elif device_type == 'HIP':
import sys
col.label(text="Requires discrete AMD GPU with ??? architecture", icon='BLANK1')
if sys.platform[:3] == "win":
col.label(text="and AMD driver version ??? or newer", icon='BLANK1')
col.label(text="Requires discrete AMD GPU with RDNA2 architecture", icon='BLANK1')
# TODO: provide driver version info.
#if sys.platform[:3] == "win":
# col.label(text="and AMD driver version ??? or newer", icon='BLANK1')
return
for device in devices:

View File

@ -131,9 +131,9 @@ void device_hip_info(vector<DeviceInfo> &devices)
continue;
}
int major;
hipDeviceGetAttribute(&major, hipDeviceAttributeComputeCapabilityMajor, num);
// TODO : (Arya) What is the last major version we are supporting?
if (!hipSupportsDevice(num)) {
continue;
}
DeviceInfo info;

View File

@ -146,12 +146,18 @@ HIPDevice::~HIPDevice()
bool HIPDevice::support_device(const uint /*kernel_features*/)
{
int major, minor;
hipDeviceGetAttribute(&major, hipDeviceAttributeComputeCapabilityMajor, hipDevId);
hipDeviceGetAttribute(&minor, hipDeviceAttributeComputeCapabilityMinor, hipDevId);
if (hipSupportsDevice(hipDevId)) {
return true;
}
else {
/* We only support Navi and above. */
hipDeviceProp_t props;
hipGetDeviceProperties(&props, hipDevId);
// TODO : (Arya) What versions do we plan to support?
return true;
set_error(string_printf("HIP backend requires AMD RDNA2 graphics card or up, but found %s.",
props.name));
return false;
}
}
bool HIPDevice::check_peer_access(Device *peer_device)
@ -240,36 +246,23 @@ string HIPDevice::compile_kernel(const uint kernel_features,
hipDeviceProp_t props;
hipGetDeviceProperties(&props, hipDevId);
/* gcnArchName can contain tokens after the arch name with features, ie.
"gfx1010:sramecc-:xnack-" so we tokenize it to get the first part. */
char *arch = strtok(props.gcnArchName, ":");
if (arch == NULL) {
arch = props.gcnArchName;
}
/* Attempt to use kernel provided with Blender. */
if (!use_adaptive_compilation()) {
if (!force_ptx) {
const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, props.gcnArchName));
const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, arch));
VLOG(1) << "Testing for pre-compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {
VLOG(1) << "Using precompiled kernel.";
return fatbin;
}
}
/* The driver can JIT-compile PTX generated for older generations, so find the closest one. */
int ptx_major = major, ptx_minor = minor;
while (ptx_major >= 3) {
const string ptx = path_get(
string_printf("lib/%s_compute_%d%d.ptx", name, ptx_major, ptx_minor));
VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
if (path_exists(ptx)) {
VLOG(1) << "Using precompiled kernel.";
return ptx;
}
if (ptx_minor > 0) {
ptx_minor--;
}
else {
ptx_major--;
ptx_minor = 9;
}
}
}
/* Try to use locally compiled kernel. */
@ -292,12 +285,10 @@ string HIPDevice::compile_kernel(const uint kernel_features,
# ifdef _DEBUG
options.append(" -save-temps");
# endif
options.append(" --amdgpu-target=").append(props.gcnArchName);
options.append(" --amdgpu-target=").append(arch);
const string include_path = source_path;
const char *const kernel_arch = props.gcnArchName;
const string fatbin_file = string_printf(
"cycles_%s_%s_%s", name, kernel_arch, kernel_md5.c_str());
const string fatbin_file = string_printf("cycles_%s_%s_%s", name, arch, kernel_md5.c_str());
const string fatbin = path_cache_get(path_join("kernels", fatbin_file));
VLOG(1) << "Testing for locally compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {
@ -406,8 +397,9 @@ bool HIPDevice::load_kernels(const uint kernel_features)
return false;
/* check if GPU is supported */
if (!support_device(kernel_features))
if (!support_device(kernel_features)) {
return false;
}
/* get kernel */
const char *kernel_name = "kernel";

View File

@ -58,6 +58,15 @@ const char *hipewCompilerPath();
int hipewCompilerVersion();
# endif /* WITH_HIP_DYNLOAD */
static inline bool hipSupportsDevice(const int hipDevId)
{
int major, minor;
hipDeviceGetAttribute(&major, hipDeviceAttributeComputeCapabilityMajor, hipDevId);
hipDeviceGetAttribute(&minor, hipDeviceAttributeComputeCapabilityMinor, hipDevId);
return (major > 10) || (major == 10 && minor >= 3);
}
CCL_NAMESPACE_END
#endif /* WITH_HIP */

View File

@ -83,6 +83,10 @@ ccl_device void integrator_intersect_volume_stack(KernelGlobals kg, IntegratorSt
Ray volume_ray ccl_optional_struct_init;
integrator_state_read_ray(kg, state, &volume_ray);
/* Trace ray in random direction. Any direction works, Z up is a guess to get the
* fewest hits. */
volume_ray.D = make_float3(0.0f, 0.0f, 1.0f);
volume_ray.t = FLT_MAX;
const uint visibility = (INTEGRATOR_STATE(state, path, flag) & PATH_RAY_ALL_VISIBILITY);
@ -147,7 +151,7 @@ ccl_device void integrator_intersect_volume_stack(KernelGlobals kg, IntegratorSt
int enclosed_volumes[MAX_VOLUME_STACK_SIZE];
int step = 0;
while (stack_index < volume_stack_size - 1 && enclosed_index < volume_stack_size - 1 &&
while (stack_index < volume_stack_size - 1 && enclosed_index < MAX_VOLUME_STACK_SIZE - 1 &&
step < 2 * volume_stack_size) {
Intersection isect;
if (!scene_intersect_volume(kg, &volume_ray, &isect, visibility)) {

View File

@ -46,6 +46,7 @@
*/
#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"
#ifdef __cplusplus
extern "C" {
@ -179,6 +180,8 @@ typedef enum eLibIDDuplicateFlags {
LIB_ID_DUPLICATE_IS_ROOT_ID = 1 << 1,
} eLibIDDuplicateFlags;
ENUM_OPERATORS(eLibIDDuplicateFlags, LIB_ID_DUPLICATE_IS_ROOT_ID)
/* lib_remap.c (keep here since they're general functions) */
/**
* New freeing logic options.

View File

@ -75,7 +75,7 @@ void BKE_object_modifier_gpencil_hook_reset(struct Object *ob,
struct HookGpencilModifierData *hmd);
bool BKE_object_modifier_gpencil_use_time(struct Object *ob, struct GpencilModifierData *md);
bool BKE_object_shaderfx_use_time(struct Object *ob, struct ShaderFxData *md);
bool BKE_object_shaderfx_use_time(struct Object *ob, struct ShaderFxData *fx);
bool BKE_object_supports_modifiers(const struct Object *ob);
bool BKE_object_support_modifier_type_check(const struct Object *ob, int modifier_type);
@ -89,7 +89,7 @@ bool BKE_object_copy_modifier(struct Main *bmain,
struct Object *ob_dst,
const struct Object *ob_src,
struct ModifierData *md);
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModifierData *md);
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModifierData *gmd_src);
bool BKE_object_modifier_stack_copy(struct Object *ob_dst,
const struct Object *ob_src,
const bool do_copy_all,
@ -155,7 +155,7 @@ bool BKE_object_obdata_is_libdata(const struct Object *ob);
struct Object *BKE_object_duplicate(struct Main *bmain,
struct Object *ob,
uint dupflag,
const uint duplicate_options);
uint duplicate_options);
void BKE_object_obdata_size_init(struct Object *ob, const float size);

View File

@ -226,7 +226,7 @@ set(SRC
intern/multires_versioning.c
intern/nla.c
intern/node.cc
intern/object.c
intern/object.cc
intern/object_deform.c
intern/object_dupli.cc
intern/object_facemap.c

View File

@ -30,6 +30,8 @@
extern "C" {
#endif
struct BodySpring;
/* pd->forcefield: Effector Fields types */
typedef enum ePFieldType {
/** (this is used for general effector weight). */