Skip to content

Commit

Permalink
disabled BVH8 on Skylake server CPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwoop committed Feb 15, 2019
1 parent 0a2eb5f commit 8b2ad69
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
11 changes: 9 additions & 2 deletions common/sys/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ namespace embree

CPUModel getCPUModel()
{
if (getCPUVendor() != "GenuineIntel")
return CPU_UNKNOWN;

int out[4];
__cpuid(out, 0);
if (out[0] < 1) return CPU_UNKNOWN;
Expand All @@ -119,6 +122,7 @@ namespace embree
if (model == 0x2D) return CPU_CORE_SANDYBRIDGE; // Core i7, SandyBridge
if (model == 0x45) return CPU_HASWELL; // Haswell
if (model == 0x3C) return CPU_HASWELL; // Haswell
if (model == 0x55) return CPU_SKYLAKE_SERVER; // Skylake server based CPUs
return CPU_UNKNOWN;
}

Expand All @@ -131,7 +135,7 @@ namespace embree
case CPU_CORE_SANDYBRIDGE: return "SandyBridge";
case CPU_HASWELL : return "Haswell";
case CPU_KNIGHTS_LANDING : return "Knights Landing";
case CPU_SKYLAKE : return "Skylake";
case CPU_SKYLAKE_SERVER : return "Skylake Server";
default : return "Unknown CPU";
}
}
Expand Down Expand Up @@ -242,7 +246,7 @@ namespace embree
if (xmm_enabled && cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_SSE4_1) cpu_features |= CPU_FEATURE_SSE41;
if (xmm_enabled && cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_SSE4_2) cpu_features |= CPU_FEATURE_SSE42;
if ( cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_POPCNT) cpu_features |= CPU_FEATURE_POPCNT;
if (ymm_enabled && cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_AVX ) cpu_features |= CPU_FEATURE_AVX;
if (ymm_enabled && cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_AVX ) cpu_features |= CPU_FEATURE_AVX | CPU_FEATURE_PSEUDO_HIFREQ256BIT;
if (xmm_enabled && cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_F16C ) cpu_features |= CPU_FEATURE_F16C;
if ( cpuid_leaf_1[ECX] & CPU_FEATURE_BIT_RDRAND) cpu_features |= CPU_FEATURE_RDRAND;
if (ymm_enabled && cpuid_leaf_7[EBX] & CPU_FEATURE_BIT_AVX2 ) cpu_features |= CPU_FEATURE_AVX2;
Expand All @@ -261,6 +265,9 @@ namespace embree
if (zmm_enabled && cpuid_leaf_7[EBX] & CPU_FEATURE_BIT_AVX512VL ) cpu_features |= CPU_FEATURE_AVX512VL;
if (zmm_enabled && cpuid_leaf_7[ECX] & CPU_FEATURE_BIT_AVX512VBMI) cpu_features |= CPU_FEATURE_AVX512VBMI;

if (getCPUModel() == CPU_SKYLAKE_SERVER)
cpu_features &= ~CPU_FEATURE_PSEUDO_HIFREQ256BIT;

return cpu_features;
}

Expand Down
7 changes: 6 additions & 1 deletion common/sys/sysinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace embree
CPU_CORE_SANDYBRIDGE,
CPU_HASWELL,
CPU_KNIGHTS_LANDING,
CPU_SKYLAKE
CPU_SKYLAKE_SERVER
};

/*! get the full path to the running executable */
Expand Down Expand Up @@ -133,6 +133,8 @@ namespace embree
static const int CPU_FEATURE_AVX512IFMA = 1 << 23;
static const int CPU_FEATURE_AVX512VBMI = 1 << 24;

static const int CPU_FEATURE_PSEUDO_HIFREQ256BIT = 1 << 30;

/*! get CPU features */
int getCPUFeatures();

Expand All @@ -155,6 +157,9 @@ namespace embree
static const int AVX512KNL = AVX2 | CPU_FEATURE_AVX512F | CPU_FEATURE_AVX512PF | CPU_FEATURE_AVX512ER | CPU_FEATURE_AVX512CD;
static const int AVX512SKX = AVX2 | CPU_FEATURE_AVX512F | CPU_FEATURE_AVX512DQ | CPU_FEATURE_AVX512CD | CPU_FEATURE_AVX512BW | CPU_FEATURE_AVX512VL;

static const int AVX_FAST = AVX | CPU_FEATURE_PSEUDO_HIFREQ256BIT;
static const int AVX2_FAST = AVX2 | CPU_FEATURE_PSEUDO_HIFREQ256BIT;

/*! converts ISA bitvector into a string */
std::string stringOfISA(int features);

Expand Down
30 changes: 15 additions & 15 deletions kernels/common/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace embree
switch (mode) {
case /*0b00*/ 0:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
{
if (isHighQuality())
accels.add(device->bvh8_factory->BVH8Triangle4(this,BVHFactory::BuildVariant::HIGH_QUALITY,BVHFactory::IntersectVariant::FAST));
Expand All @@ -172,7 +172,7 @@ namespace embree

case /*0b01*/ 1:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
accels.add(device->bvh8_factory->BVH8Triangle4v(this,BVHFactory::BuildVariant::STATIC,BVHFactory::IntersectVariant::ROBUST));
else
#endif
Expand All @@ -186,7 +186,7 @@ namespace embree
else /* dynamic */
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
{
int mode = 2*(int)isCompact() + 1*(int)isRobust();
switch (mode) {
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace embree
int mode = 2*(int)isCompact() + 1*(int)isRobust();

#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX2)) // BVH8 reduces performance on AVX only-machines
if (device->hasISA(AVX2_FAST)) // BVH8 reduces performance on AVX only-machines
{
switch (mode) {
case /*0b00*/ 0: accels.add(device->bvh8_factory->BVH8Triangle4iMB(this,BVHFactory::BuildVariant::STATIC,BVHFactory::IntersectVariant::FAST )); break;
Expand Down Expand Up @@ -275,7 +275,7 @@ namespace embree
switch (mode) {
case /*0b00*/ 0:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
{
if (isHighQuality())
accels.add(device->bvh8_factory->BVH8Quad4v(this,BVHFactory::BuildVariant::HIGH_QUALITY,BVHFactory::IntersectVariant::FAST));
Expand All @@ -294,7 +294,7 @@ namespace embree

case /*0b01*/ 1:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
accels.add(device->bvh8_factory->BVH8Quad4v(this,BVHFactory::BuildVariant::STATIC,BVHFactory::IntersectVariant::ROBUST));
else
#endif
Expand All @@ -308,7 +308,7 @@ namespace embree
else /* dynamic */
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
{
int mode = 2*(int)isCompact() + 1*(int)isRobust();
switch (mode) {
Expand Down Expand Up @@ -353,7 +353,7 @@ namespace embree
switch (mode) {
case /*0b00*/ 0:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
accels.add(device->bvh8_factory->BVH8Quad4iMB(this,BVHFactory::BuildVariant::STATIC,BVHFactory::IntersectVariant::FAST));
else
#endif
Expand All @@ -362,7 +362,7 @@ namespace embree

case /*0b01*/ 1:
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX))
if (device->hasISA(AVX_FAST))
accels.add(device->bvh8_factory->BVH8Quad4iMB(this,BVHFactory::BuildVariant::STATIC,BVHFactory::IntersectVariant::ROBUST));
else
#endif
Expand Down Expand Up @@ -390,7 +390,7 @@ namespace embree
if (isStatic())
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX2)) // only enable on HSW machines, for SNB this codepath is slower
if (device->hasISA(AVX2_FAST)) // only enable on HSW machines, for SNB this codepath is slower
{
switch (mode) {
case /*0b00*/ 0: accels.add(device->bvh8_factory->BVH8OBBBezier1v(this)); break;
Expand Down Expand Up @@ -438,7 +438,7 @@ namespace embree
if (device->hair_accel_mb == "default")
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX2) && !isCompact()) // only enable on HSW machines, on SNB this codepath is slower
if (device->hasISA(AVX2_FAST) && !isCompact()) // only enable on HSW machines, on SNB this codepath is slower
{
accels.add(device->bvh8_factory->BVH8OBBBezier1iMB(this));
}
Expand All @@ -464,7 +464,7 @@ namespace embree
if (isStatic())
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX) && !isCompact())
if (device->hasISA(AVX_FAST) && !isCompact())
accels.add(device->bvh8_factory->BVH8Line4i(this));
else
#endif
Expand All @@ -489,7 +489,7 @@ namespace embree
if (device->line_accel_mb == "default")
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX) && !isCompact())
if (device->hasISA(AVX_FAST) && !isCompact())
accels.add(device->bvh8_factory->BVH8Line4iMB(this));
else
#endif
Expand Down Expand Up @@ -543,7 +543,7 @@ namespace embree
if (device->object_accel == "default")
{
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX) && !isCompact())
if (device->hasISA(AVX_FAST) && !isCompact())
{
//if (isStatic()) {
accels.add(device->bvh8_factory->BVH8UserGeometry(this,BVHFactory::BuildVariant::STATIC));
Expand Down Expand Up @@ -574,7 +574,7 @@ namespace embree
#if defined(EMBREE_GEOMETRY_USER)
if (device->object_accel_mb == "default" ) {
#if defined (EMBREE_TARGET_SIMD8)
if (device->hasISA(AVX) && !isCompact())
if (device->hasISA(AVX_FAST) && !isCompact())
accels.add(device->bvh8_factory->BVH8UserGeometryMB(this));
else
#endif
Expand Down

0 comments on commit 8b2ad69

Please sign in to comment.