Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Rosa <bruno.rosa@eldorado.org.br>2017-04-28 22:35:14 +0300
committerSoumith Chintala <soumith@gmail.com>2017-04-28 20:41:03 +0300
commite8c556d35c97029531c0d1449fcf418728f835e3 (patch)
tree13484cb5c1e5f52d8e7505eb09f36df6024755cc
parent5ac8403221ac50895b39ae3d193e12356ae6ef25 (diff)
Add option to disable ppc64le's VSX support
Set environment variable TH_NO_VSX=1 to disable VSX.
-rw-r--r--lib/TH/README.md6
-rw-r--r--lib/TH/generic/simd/simd.h12
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/TH/README.md b/lib/TH/README.md
index c646ce9..4ac26c1 100644
--- a/lib/TH/README.md
+++ b/lib/TH/README.md
@@ -1,7 +1,11 @@
Environment variables control the disabling of certain explicit SIMD optimizations.
```
+x64 options:
TH_NO_AVX2=1 # disable AVX2 codepaths
TH_NO_AVX=1 # disable AVX codepaths
TH_NO_SSE=1 # disable SSE codepaths
-``` \ No newline at end of file
+
+ppc64le options:
+TH_NO_VSX=1 # disable VSX codepaths
+```
diff --git a/lib/TH/generic/simd/simd.h b/lib/TH/generic/simd/simd.h
index 19d41b1..83c4c56 100644
--- a/lib/TH/generic/simd/simd.h
+++ b/lib/TH/generic/simd/simd.h
@@ -78,7 +78,13 @@ static inline uint32_t detectHostSIMDExtensions()
static inline uint32_t detectHostSIMDExtensions()
{
- return SIMDExtension_VSX;
+ uint32_t hostSimdExts = SIMDExtension_DEFAULT;
+ char *evar;
+
+ evar = getenv("TH_NO_VSX");
+ if (evar == NULL || strncmp(evar, "1", 2) != 0)
+ hostSimdExts = SIMDExtension_VSX;
+ return hostSimdExts;
}
#else //PPC64 without VSX
@@ -89,7 +95,7 @@ static inline uint32_t detectHostSIMDExtensions()
}
#endif
-
+
#else // x86
static inline void cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
{
@@ -146,7 +152,7 @@ static inline uint32_t detectHostSIMDExtensions()
evar = getenv("TH_NO_SSE");
if (evar == NULL || strncmp(evar, "1", 2) != 0)
- TH_NO_SSE = 0;
+ TH_NO_SSE = 0;
if (edx & CPUID_SSE_BIT && TH_NO_SSE == 0) {
hostSimdExts |= SIMDExtension_SSE;
}