summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-04-24 11:13:54 -0500
committerGeorge Kyriazis <[email protected]>2018-04-27 14:36:41 -0500
commitf276517ebfe45c1400b7c283ead99a9e35e9f5ae (patch)
tree8cec102a2db0f9fdc09fded8f2193e89d829a6e6 /src
parent8ace547e8d743dcc51fc3b72ba30067f85232996 (diff)
swr/rast: Use new processor detection mechanism
Use specific avx512 selection mechanism based on avx512er bit instead of getHostCPUName(). LLVM 6.0.0 has a bug that reports wrong string for KNL (fixed in 6.0.1). Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp50
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/JitManager.h2
2 files changed, 51 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 7071e9f02da..aadcca25550 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -80,7 +80,55 @@ JitManager::JitManager(uint32_t simdWidth, const char *arch, const char* core)
StringRef hostCPUName;
- hostCPUName = sys::getHostCPUName();
+ // force JIT to use the same CPU arch as the rest of swr
+ if(mArch.AVX512F())
+ {
+#if USE_SIMD16_SHADERS
+ if(mArch.AVX512ER())
+ {
+ hostCPUName = StringRef("knl");
+ }
+ else
+ {
+ hostCPUName = StringRef("skylake-avx512");
+ }
+ mUsingAVX512 = true;
+#else
+ hostCPUName = StringRef("core-avx2");
+#endif
+ if (mVWidth == 0)
+ {
+ mVWidth = 8;
+ }
+ }
+ else if(mArch.AVX2())
+ {
+ hostCPUName = StringRef("core-avx2");
+ if (mVWidth == 0)
+ {
+ mVWidth = 8;
+ }
+ }
+ else if(mArch.AVX())
+ {
+ if (mArch.F16C())
+ {
+ hostCPUName = StringRef("core-avx-i");
+ }
+ else
+ {
+ hostCPUName = StringRef("corei7-avx");
+ }
+ if (mVWidth == 0)
+ {
+ mVWidth = 8;
+ }
+ }
+ else
+ {
+ SWR_INVALID("Jitting requires at least AVX ISA support");
+ }
+
auto optLevel = CodeGenOpt::Aggressive;
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
index c15e0d1b43b..54a25d89139 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
@@ -69,6 +69,7 @@ public:
bool AVX2(void) { return bForceAVX ? 0 : InstructionSet::AVX2(); }
bool AVX512F(void) { return (bForceAVX | bForceAVX2) ? 0 : InstructionSet::AVX512F(); }
+ bool AVX512ER(void) { return (bForceAVX | bForceAVX2) ? 0 : InstructionSet::AVX512ER(); }
bool BMI2(void) { return bForceAVX ? 0 : InstructionSet::BMI2(); }
private:
@@ -142,6 +143,7 @@ struct JitManager
uint32_t mVWidth;
+ bool mUsingAVX512 = false;
// fetch shader types
llvm::FunctionType* mFetchShaderTy;