"platforms/hip/src/HipParallelKernels.cpp" did not exist on "dd352ee536a429bfccd4aeda5258adafba8e0d84"
Commit 080691d3 authored by peastman's avatar peastman
Browse files

Consolidated logic for determining if vector instructions are supported

parent 35041ae1
...@@ -40,6 +40,14 @@ typedef int int32_t; ...@@ -40,6 +40,14 @@ typedef int int32_t;
// This file defines classes and functions to simplify vectorizing code with NEON. // This file defines classes and functions to simplify vectorizing code with NEON.
/**
* Determine whether ivec4 and fvec4 are supported on this processor.
*/
static bool isVec4Supported() {
uint64_t features = android_getCpuFeatures();
return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
}
class ivec4; class ivec4;
/** /**
......
...@@ -33,10 +33,23 @@ ...@@ -33,10 +33,23 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include <smmintrin.h> #include <smmintrin.h>
#include "hardware.h"
// This file defines classes and functions to simplify vectorizing code with SSE. // This file defines classes and functions to simplify vectorizing code with SSE.
/**
* Determine whether ivec4 and fvec4 are supported on this processor.
*/
static bool isVec4Supported() {
int cpuInfo[4];
cpuid(cpuInfo, 0);
if (cpuInfo[0] >= 1) {
cpuid(cpuInfo, 1);
return ((cpuInfo[2] & ((int) 1 << 19)) != 0);
}
return false;
}
class ivec4; class ivec4;
/** /**
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "CpuKernels.h" #include "CpuKernels.h"
#include "CpuSETTLE.h" #include "CpuSETTLE.h"
#include "ReferenceConstraints.h" #include "ReferenceConstraints.h"
#include "openmm/internal/hardware.h" #include "openmm/internal/vectorize.h"
#include <sstream> #include <sstream>
#include <stdlib.h> #include <stdlib.h>
...@@ -94,20 +94,7 @@ bool CpuPlatform::supportsDoublePrecision() const { ...@@ -94,20 +94,7 @@ bool CpuPlatform::supportsDoublePrecision() const {
} }
bool CpuPlatform::isProcessorSupported() { bool CpuPlatform::isProcessorSupported() {
// Make sure the CPU supports SSE 4.1 or NEON. return isVec4Supported();
#ifdef __ANDROID__
uint64_t features = android_getCpuFeatures();
return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
#else
int cpuInfo[4];
cpuid(cpuInfo, 0);
if (cpuInfo[0] >= 1) {
cpuid(cpuInfo, 1);
return ((cpuInfo[2] & ((int) 1 << 19)) != 0);
}
return false;
#endif
} }
void CpuPlatform::contextCreated(ContextImpl& context, const map<string, string>& properties) const { void CpuPlatform::contextCreated(ContextImpl& context, const map<string, string>& properties) const {
......
...@@ -569,20 +569,7 @@ double CpuCalcPmeReciprocalForceKernel::finishComputation(IO& io) { ...@@ -569,20 +569,7 @@ double CpuCalcPmeReciprocalForceKernel::finishComputation(IO& io) {
} }
bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() { bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() {
// Make sure the CPU supports SSE 4.1 or NEON. return isVec4Supported();
#ifdef __ANDROID__
uint64_t features = android_getCpuFeatures();
return (features & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
#else
int cpuInfo[4];
cpuid(cpuInfo, 0);
if (cpuInfo[0] >= 1) {
cpuid(cpuInfo, 1);
return ((cpuInfo[2] & ((int) 1 << 19)) != 0);
}
return false;
#endif
} }
int CpuCalcPmeReciprocalForceKernel::findFFTDimension(int minimum) { int CpuCalcPmeReciprocalForceKernel::findFFTDimension(int minimum) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment