Skip to content

Fails on FreeBSD: error: "Unsupported fallback detection of SSE OS support." #158

Closed

Description

@yurivict
#error "Unsupported OS"
 ^
/wrkdirs/usr/ports/devel/volk/work/volk-2.5.0/cpu_features/src/cpuinfo_x86.c:1268:2: error: "Unsupported fallback detection of SSE OS support."
#error "Unsupported fallback detection of SSE OS support."
 ^
2 errors generated.

Activity

  1. added
    bug
    on Jun 7, 2021
  2. Mizux commented on Jun 7, 2021

    @Mizux
    Collaborator

    cpu_features/src/cpuinfo_x86.c

    Lines 1230 to 1274 in bc2846e

    static void DetectSseViaOs(X86Features* features) {
    #if defined(CPU_FEATURES_OS_WINDOWS)
    // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent
    features->sse =
    GetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
    features->sse2 =
    GetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
    features->sse3 =
    GetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
    #elif defined(CPU_FEATURES_OS_DARWIN)
    // Handling Darwin platform through sysctlbyname.
    features->sse = GetDarwinSysCtlByName("hw.optional.sse");
    features->sse2 = GetDarwinSysCtlByName("hw.optional.sse2");
    features->sse3 = GetDarwinSysCtlByName("hw.optional.sse3");
    features->ssse3 = GetDarwinSysCtlByName("hw.optional.supplementalsse3");
    features->sse4_1 = GetDarwinSysCtlByName("hw.optional.sse4_1");
    features->sse4_2 = GetDarwinSysCtlByName("hw.optional.sse4_2");
    #elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID)
    // Handling Linux platform through /proc/cpuinfo.
    const int fd = CpuFeatures_OpenFile("/proc/cpuinfo");
    if (fd >= 0) {
    StackLineReader reader;
    StackLineReader_Initialize(&reader, fd);
    for (;;) {
    const LineResult result = StackLineReader_NextLine(&reader);
    const StringView line = result.line;
    StringView key, value;
    if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
    if (CpuFeatures_StringView_IsEquals(key, str("flags"))) {
    features->sse = CpuFeatures_StringView_HasWord(value, "sse");
    features->sse2 = CpuFeatures_StringView_HasWord(value, "sse2");
    features->sse3 = CpuFeatures_StringView_HasWord(value, "sse3");
    features->ssse3 = CpuFeatures_StringView_HasWord(value, "ssse3");
    features->sse4_1 = CpuFeatures_StringView_HasWord(value, "sse4_1");
    features->sse4_2 = CpuFeatures_StringView_HasWord(value, "sse4_2");
    break;
    }
    }
    if (result.eof) break;
    }
    CpuFeatures_CloseFile(fd);
    }
    #else
    #error "Unsupported fallback detection of SSE OS support."
    #endif

    @yurivict Do you know which functions/implementation we could use to support SSE detection on a FreeBSD OS ?

  3. added
    enhancement
    on Jun 7, 2021
  4. Mizux commented on Jun 7, 2021

    @Mizux
    Collaborator

    First it means we must detect FreeBSD OS here

    #if defined(__linux__)
    #define CPU_FEATURES_OS_LINUX_OR_ANDROID
    #endif
    #if defined(__ANDROID__)
    #define CPU_FEATURES_OS_ANDROID
    #endif
    #if (defined(_WIN64) || defined(_WIN32))
    #define CPU_FEATURES_OS_WINDOWS
    #endif
    #if (defined(__apple__) || defined(__APPLE__) || defined(__MACH__))
    #define CPU_FEATURES_OS_DARWIN
    #endif

    note: https://docs.freebsd.org/en/books/porters-handbook/porting-dads/#porting-versions

  5. yurivict commented on Jun 7, 2021

    @yurivict
    Author

    You can detect FreeBSD with

    #if defined(__FreeBSD__)
    #endif 
  6. linked a pull request that will close this issueSupport Freebsd #159on Jun 11, 2021
  7. self-assigned this
    on Jun 11, 2021
  8. linked a pull request that will close this issueci: Add FreeBSD GitHub workflows #167on Jun 30, 2021
  9. added a commit that references this issue on Jun 30, 2021
  10. added this to the v0.7.0 milestone on Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugenhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions