Check only for SSE 4.1 (rather than SSE 4.2) when trying to use the SSE

implementation of PairHMM
This commit is contained in:
Karthik Gururaj 2014-02-07 15:19:55 -08:00
parent dc44b64ad8
commit 20a46e4098
3 changed files with 21 additions and 5 deletions

View File

@ -77,8 +77,9 @@ import java.io.OutputStream;
public class VectorLoglessPairHMM extends JNILoglessPairHMM {
//For machine capabilities
public static final long sse42Mask = 1;
public static final long avxMask = 2;
public static final long sse41Mask = 1;
public static final long sse42Mask = 2;
public static final long avxMask = 4;
public static final long enableAll = 0xFFFFFFFFFFFFFFFFl;
//Used to copy references to byteArrays to JNI from reads

View File

@ -22,6 +22,18 @@ bool is_avx_supported()
return ((ecx >> 28)&1) == 1;
}
bool is_sse41_supported()
{
int ecx = 0, edx = 0, ebx = 0;
__asm__("cpuid"
: "=b" (ebx),
"=c" (ecx),
"=d" (edx)
: "a" (1)
);
return ((ecx >> 19)&1) == 1;
}
bool is_sse42_supported()
{
int ecx = 0, edx = 0, ebx = 0;
@ -41,6 +53,8 @@ uint64_t get_machine_capabilities()
machine_mask |= (1 << AVX_CUSTOM_IDX);
if(is_sse42_supported())
machine_mask |= (1 << SSE42_CUSTOM_IDX);
if(is_sse41_supported())
machine_mask |= (1 << SSE41_CUSTOM_IDX);
return machine_mask;
}
@ -54,9 +68,9 @@ void initialize_function_pointers(uint64_t mask)
g_compute_full_prob_double = compute_full_prob_avxd<double>;
}
else
if(is_sse42_supported() && (mask & (1<< SSE42_CUSTOM_IDX)))
if(is_sse41_supported() && (mask & (1<< SSE41_CUSTOM_IDX)))
{
cout << "Using SSE4.2 accelerated implementation of PairHMM\n";
cout << "Using SSE4.1 accelerated implementation of PairHMM\n";
g_compute_full_prob_float = compute_full_prob_sses<float>;
g_compute_full_prob_double = compute_full_prob_ssed<double>;
}

View File

@ -32,7 +32,8 @@ uint64_t diff_time(struct timespec& prev_time);
//bit 0 is sse4.2, bit 1 is AVX
enum ProcessorCapabilitiesEnum
{
SSE42_CUSTOM_IDX=0,
SSE41_CUSTOM_IDX=0,
SSE42_CUSTOM_IDX,
AVX_CUSTOM_IDX
};
#define ENABLE_ALL_HARDWARE_FEATURES 0xFFFFFFFFFFFFFFFFull