MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / GB_Global_cpu_features_query

Function GB_Global_cpu_features_query

deps/GraphBLAS/Source/GB_Global.c:396–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394// can then be queried later by GB_Global_cpu_features_avx*.
395
396GB_PUBLIC
397void GB_Global_cpu_features_query (void)
398{
399 #if GBX86
400 {
401
402 //----------------------------------------------------------------------
403 // x86_64 architecture: see if AVX2 and/or AVX512F are supported
404 //----------------------------------------------------------------------
405
406 #if !defined ( GBNCPUFEAT )
407 {
408 // Google's cpu_features package is available: use run-time tests
409 X86Features features = GetX86Info ( ).features ;
410 GB_Global.cpu_features_avx2 = (bool) (features.avx2) ;
411 GB_Global.cpu_features_avx512f = (bool) (features.avx512f) ;
412 }
413 #else
414 {
415 // cpu_features package not available; use compile-time tests
416 #if defined ( GBAVX2 )
417 {
418 // the build system asserts whether or not AVX2 is available
419 GB_Global.cpu_features_avx2 = (bool) (GBAVX2) ;
420 }
421 #else
422 {
423 // AVX2 not available
424 GB_Global.cpu_features_avx2 = false ;
425 }
426 #endif
427 #if defined ( GBAVX512F )
428 {
429 // the build system asserts whether or not AVX512F is available
430 GB_Global.cpu_features_avx512f = (bool) (GBAVX512F) ;
431 }
432 #else
433 {
434 // AVX512F not available
435 GB_Global.cpu_features_avx512f = false ;
436 }
437 #endif
438 }
439 #endif
440
441 }
442 #else
443 {
444
445 //----------------------------------------------------------------------
446 // not on the x86_64 architecture, so no AVX2 or AVX512F acceleration
447 //----------------------------------------------------------------------
448
449 GB_Global.cpu_features_avx2 = false ;
450 GB_Global.cpu_features_avx512f = false ;
451
452 }
453 #endif

Callers 1

GB_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected