File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -667,6 +667,14 @@ int __cdecl principia__GetStderrLogging() {
667667 return m.Return (FLAGS_stderrthreshold);
668668}
669669
670+ void __cdecl principia__GetCPUIDFeatureFlags (bool * const has_avx,
671+ bool * const has_fma) {
672+ journal::Method<journal::GetCPUIDFeatureFlags> m ({has_avx, has_fma});
673+ *has_avx = CPUIDFeatureFlag::AVX.IsSet ();
674+ *has_fma = CPUIDFeatureFlag::FMA.IsSet ();
675+ return m.Return ();
676+ }
677+
670678int __cdecl principia__GetSuppressedLogging () {
671679 journal::Method<journal::GetSuppressedLogging> m;
672680 return m.Return (FLAGS_minloglevel);
Original file line number Diff line number Diff line change @@ -96,7 +96,18 @@ internal static string LoadPrincipiaDllAndInitGoogleLogging() {
9696 Interface . LoadSymbols ( ) ;
9797 loaded_principia_dll = true ;
9898 Log . InitGoogleLogging ( ) ;
99- return null ;
99+ Interface . GetCPUIDFeatureFlags ( out bool has_avx , out bool has_fma ) ;
100+ Log . Info ( "Processor " +
101+ ( has_avx ? "has" : "does not have" ) +
102+ " AVX support and " +
103+ ( has_fma ? "has" : "does not have" ) +
104+ " FMA support." ) ;
105+ if ( has_fma && ! has_avx ) {
106+ return "Principia does not run on processors with FMA support but no " +
107+ "AVX support." ;
108+ } else {
109+ return null ;
110+ }
100111 } catch ( Exception e ) {
101112 UnityEngine . Debug . LogException ( e ) ;
102113 if ( non_ascii_path_error != null ) {
Original file line number Diff line number Diff line change @@ -1327,6 +1327,17 @@ message GetBufferedLogging {
13271327 optional Return return = 3 ;
13281328}
13291329
1330+ message GetCPUIDFeatureFlags {
1331+ extend Method {
1332+ optional GetCPUIDFeatureFlags extension = 5198 ;
1333+ }
1334+ message Out {
1335+ required bool has_avx = 1 ;
1336+ required bool has_fma = 2 ;
1337+ }
1338+ optional Out out = 2 ;
1339+ }
1340+
13301341message GetStderrLogging {
13311342 extend Method {
13321343 optional GetStderrLogging extension = 5007 ;
You can’t perform that action at this time.
0 commit comments