Skip to content

Commit

Permalink
Conditionally save and restore __cpuid macro for different platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Jan 10, 2025
1 parent a914717 commit 33ad635
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion blis/_src/frame/base/bli_cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@

#if (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86))

// This has a conflicting definition in intrin.h
#ifdef __cpuid
#define __SAVED_CPUID __cpuid
#undef __cpuid
#endif


// This has a conflicting definition in intrin.h on Windows
#include "cpuid.h"

// If cpuid.h didn't define it and we had a previous definition, restore it
#if !defined(__cpuid) && defined(__SAVED_CPUID)
#define __cpuid __SAVED_CPUID
#endif


arch_t bli_cpuid_query_id( void )
{
uint32_t vendor, family, model, features;
Expand Down

0 comments on commit 33ad635

Please sign in to comment.