highway icon indicating copy to clipboard operation
highway copied to clipboard

I don't know what that message is

Open Jamaika1 opened this issue 2 years ago • 3 comments

Hi jan-wassenberg

I don't know what that message is: WARNING: CPU supports 1800 but software requires 2000000000000000

Jamaika1 avatar Jul 28 '22 17:07 Jamaika1

Hi, this can safely be ignored, but we do fix it in https://github.com/google/highway/commit/51d5f80987e4dc4771a9f12ccbb548e9416503e6. Is it still happening even after that change?

The background is: we're checking that the CPU supports all the targets that the app was compiled for. But if targets.cc was compiled with different flags than the application, we do not know whether the application is using HWY_SCALAR or HWY_EMU128. The solution is to report that the CPU supports both.

jan-wassenberg avatar Jul 29 '22 07:07 jan-wassenberg

I used fix 9b6b473 and don't know if the result is correct now. JPEG XL encoder v0.7.0 0.7.0-59f7d19 [Unknown]

Jamaika1 avatar Jul 29 '22 19:07 Jamaika1

Hi, fix 9b6b473 is helpful, but it only resolves a warning. The results should be correct both before and after the fix.

jan-wassenberg avatar Aug 02 '22 05:08 jan-wassenberg

I still see this issue with version 1.0.0 (commit https://github.com/google/highway/commit/e41973e26b3a870fcfb63fa2d4f2bcd57fe94de5) when cross-compiling for Windows. Here's a simple Dockerfile to reproduce this:

Dockerfile
# Build with:
# docker build --build-arg ARCH=x86_64 -t llvm-mingw .
# docker run --rm llvm-mingw tar -cf - /packaging | tar -xvf -
FROM mstorsjo/llvm-mingw:latest

# Supported architectures: x86_64, i686, aarch64 and armv7
ARG ARCH=x86_64

# Install curl
RUN apt-get update -qq && \
    apt-get install -qqy --no-install-recommends curl && \
    apt-get clean -y && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /build/highway

# Download highway 1.0.0
RUN curl -sL https://github.com/google/highway/archive/refs/tags/1.0.0.tar.gz | \
    tar xzC /build/highway --strip-components=1

# Enable optimizations and link-time garbage collection
ENV \
  CFLAGS="-O3 -fdata-sections -ffunction-sections" \
  CXXFLAGS="-O3 -fdata-sections -ffunction-sections" \
  LDFLAGS="-Wl,--gc-sections -Wl,-s"

WORKDIR /build/highway/build-$ARCH

# Cross-compile highway for Windows
RUN cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_SHARED_LIBS=ON \
      -DBUILD_TESTING=OFF \
      -DHWY_ENABLE_CONTRIB=OFF \
      -DHWY_ENABLE_EXAMPLES=OFF \
      -DCMAKE_INSTALL_PREFIX="/packaging" \
      -DCMAKE_C_COMPILER=$ARCH-w64-mingw32-clang \
      -DCMAKE_CXX_COMPILER=$ARCH-w64-mingw32-clang++ \
      -DCMAKE_SYSTEM_NAME=Windows \
      -DCMAKE_SYSTEM_PROCESSOR=$ARCH \
      .. && \
    cmake --build . -- -j$(nproc) && \
    cmake --install . && \
    cp hwy_list_targets.exe /packaging/bin
Config: emu128:0 scalar:0 static:0 all_attain:0 is_test:0
Compiled HWY_TARGETS:   AVX3 AVX2 SSE4 SSSE3 EMU128
HWY_ATTAINABLE_TARGETS: AVX3 AVX2 SSE4 SSSE3 EMU128
HWY_BASELINE_TARGETS:   EMU128
HWY_STATIC_TARGET:      EMU128
HWY_BROKEN_TARGETS:
HWY_DISABLED_TARGETS:
WARNING: CPU supports 1a00 but software requires 2000000000000000
Current CPU supports:   AVX2 SSE4 SSSE3

I can confirm that commit 9b6b473890bb6a43f5cd4786f9c214f0aa4e6420 resolves this (so it does not only fix a complication warning).

Config: emu128:0 scalar:0 static:0 all_attain:0 is_test:0
Compiled HWY_TARGETS:   AVX3 AVX2 SSE4 SSSE3 EMU128
HWY_ATTAINABLE_TARGETS: AVX3 AVX2 SSE4 SSSE3 EMU128
HWY_BASELINE_TARGETS:   EMU128
HWY_STATIC_TARGET:      EMU128
HWY_BROKEN_TARGETS:
HWY_DISABLED_TARGETS:
Current CPU supports:   AVX2 SSE4 SSSE3 EMU128 SCALAR

kleisauke avatar Aug 10 '22 09:08 kleisauke

Hi @kleisauke , thanks for following up. Looks like I was mistaken, this line bits &= ~min_avx2; seems not to promote min_avx2 to 64-bit. Thus the upper half of the negated min_avx2 is 0, and we're clearing the EMU128 and SCALAR flags. The immediate impact of this is just a (printf) warning, but you are right in that without the fix, the code may behave incorrectly on old CPUs that lack SSSE3. If I understand correctly, this is indeed fixed, so closing.

jan-wassenberg avatar Aug 10 '22 10:08 jan-wassenberg