diff --git a/.github/actions/generate-dataset/action.yml b/.github/actions/generate-dataset/action.yml index 5d89e914..0e3fdca3 100644 --- a/.github/actions/generate-dataset/action.yml +++ b/.github/actions/generate-dataset/action.yml @@ -21,9 +21,11 @@ runs: # 2️⃣ Remove any .venv that might have been created earlier # with Python 3.13, so we always recreate it with 3.12. # ───────────────────────────────────────────────────────────── - - name: Remove stale virtual-env + - name: Recreate virtual-env with the correct Python shell: bash - run: rm -rf "$GITHUB_WORKSPACE/.venv" + run: | + rm -rf "$GITHUB_WORKSPACE/.venv" + python3 -m venv "$GITHUB_WORKSPACE/.venv" # ───────────────────────────────────────────────────────────── # 3️⃣ Generate the synthetic data @@ -36,5 +38,6 @@ runs: # 4️⃣ Generate the sentence embeddings # ───────────────────────────────────────────────────────────── - name: Generate embeddings + if: runner.os != 'Windows' shell: bash run: make generate-embeddings diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 442e3308..b1fc2f17 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -10,9 +10,9 @@ run-name: >- on: push: - branches: [ '*' ] + branches: [ main, dev ] pull_request: - branches: [ '*' ] + branches: [ main, dev ] concurrency: group: Benchmarker CI-${{ github.ref }} @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - platform: [ ubuntu-latest, macos-latest ] + platform: [ ubuntu-latest ] defaults: run: diff --git a/.github/workflows/cpp.yaml b/.github/workflows/cpp.yaml index 0d16a6cb..8c4dadd6 100644 --- a/.github/workflows/cpp.yaml +++ b/.github/workflows/cpp.yaml @@ -13,8 +13,9 @@ run-name: >- # ────────────────────────────────────────────────────────────────────────────── on: push: + branches: [ main, dev ] pull_request: - branches: [ "main", "dev" ] + branches: [ main, dev ] # Cancel in-flight runs on the same branch/PR so we do not waste minutes concurrency: @@ -42,38 +43,19 @@ jobs: run: make format-check # ────────────────────────────────────────────────────────────────────────────── - # 2️⃣ Main build + clang-tidy (Linux + macOS + Windows) + # 2️⃣a Clang-tidy (single fast platform — diagnostics are platform-independent) # ────────────────────────────────────────────────────────────────────────────── - build: + tidy: needs: check-format strategy: fail-fast: false matrix: - platform: - - ubuntu-24.04 - - ubuntu-22.04 - - ubuntu-24.04-arm - - ubuntu-22.04-arm - - macos-15 - - macos-14 - - macos-13 build_type: [ Debug, Release ] - cxx: [ clang++ ] shared_lib: [ false, true ] - - # 🛑 Skip the flaky public-preview runner (arm64 Debug + shared) - # GitHub’s ubuntu-24.04-arm image is still in public beta (burstable capacity), - # which can terminate long jobs with “The runner has received a shutdown signal” - # → exit-code 143. See: - # https://github.blog/changelog/2024-06-24-github-actions-ubuntu-24-04-image-now-available-for-arm64-runners/ - # See also Issue #11541: “Intermittent segmentation faults on Ubuntu 24.04 ARM” - # — ~15% of runs on ubuntu-24.04-arm see segfaults or pre-emptions mid-build exclude: - - platform: ubuntu-24.04-arm - build_type: Debug + - build_type: Debug shared_lib: true - - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -90,10 +72,7 @@ jobs: clang --version clang-tidy --version - # ---------------------------------------------------------------------- - # Configure (runs clang-tidy via CMake) - # ---------------------------------------------------------------------- - - name: Configure (with clang-tidy checks) + - name: Configure (with clang-tidy) shell: bash run: | cmake -S "${{ github.workspace }}" \ @@ -104,11 +83,52 @@ jobs: -DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }} \ -DFLS_ENABLE_INSTALL=OFF \ -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} + -DCMAKE_CXX_COMPILER=clang++ - name: Build (clang-tidy runs automatically) run: cmake --build build_${{ matrix.build_type }}_${{ matrix.shared_lib }} -j $BUILD_THREADS + # ────────────────────────────────────────────────────────────────────────────── + # 2️⃣b Compile-check (remaining platforms, Release only, no tidy) + # ────────────────────────────────────────────────────────────────────────────── + build: + needs: check-format + strategy: + fail-fast: false + matrix: + platform: + - ubuntu-22.04 + - ubuntu-24.04-arm + - ubuntu-22.04-arm + - macos-26 + - macos-15 + cxx: [ clang++ ] + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + + - name: Detect CPU count + shell: bash + run: make detect-cpu | tee -a "$GITHUB_ENV" + + - name: Install LLVM + uses: ./.github/actions/install-llvm + + - name: Configure + shell: bash + run: | + cmake -S "${{ github.workspace }}" \ + -B build_Release \ + -DFLS_ENABLE_VERBOSE_OUTPUT=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DFLS_ENABLE_INSTALL=OFF \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} + + - name: Build + run: cmake --build build_Release -j $BUILD_THREADS + # ────────────────────────────────────────────────────────────────────────────── # 3️⃣ IWYU build (Linux only) # ────────────────────────────────────────────────────────────────────────────── @@ -146,18 +166,8 @@ jobs: # 4️⃣ Synthetic-dataset generator (Python, cached pip) # ────────────────────────────────────────────────────────────────────────────── generate_dataset: - needs: build - strategy: - matrix: - platform: - - ubuntu-24.04 - - ubuntu-22.04 - - ubuntu-24.04-arm - - ubuntu-22.04-arm - - macos-15 - - macos-14 - - macos-13 - runs-on: ${{ matrix.platform }} + needs: tidy + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -175,11 +185,25 @@ jobs: example: # needs: build strategy: + fail-fast: false matrix: - platform: [ ubuntu-latest, macos-latest, windows-latest ] + # GCC on ubuntu; Clang on macOS/Windows; shared on one representative per OS + include: + # GCC — static + shared + - { platform: ubuntu-latest, compiler: gcc, cxx: g++, shared_lib: false } + - { platform: ubuntu-latest, compiler: gcc, cxx: g++, shared_lib: true } + # Clang — macOS static + shared + - { platform: macos-latest, compiler: clang, cxx: clang++, shared_lib: false } + - { platform: macos-latest, compiler: clang, cxx: clang++, shared_lib: true } + # Clang — Windows static + shared + - { platform: windows-latest, compiler: clang, cxx: clang++, shared_lib: false } + - { platform: windows-latest, compiler: clang, cxx: clang++, shared_lib: true } + # MSVC — static + shared on windows-latest only + - { platform: windows-latest, compiler: msvc, cxx: cl, shared_lib: false } + - { platform: windows-latest, compiler: msvc, cxx: cl, shared_lib: true } + # MSVC ARM — static only + - { platform: windows-11-arm, compiler: msvc, cxx: cl, shared_lib: false } build_type: [ Release ] - cxx: [ clang++ ] - shared_lib: [ false, true ] runs-on: ${{ matrix.platform }} defaults: @@ -196,37 +220,49 @@ jobs: run: make detect-cpu | tee -a "$GITHUB_ENV" - name: Install LLVM + if: matrix.compiler == 'clang' uses: ./.github/actions/install-llvm + - name: Set up MSVC environment + if: matrix.compiler == 'msvc' + uses: ilammy/msvc-dev-cmd@v1 + - name: Configure example run: | CMAKE_ARGS=( -S "${{ github.workspace }}" - -B "build_${{ matrix.build_type }}_${{ matrix.shared_lib }}" + -B "build_${{ matrix.compiler }}_${{ matrix.build_type }}_${{ matrix.shared_lib }}" -DFLS_BUILD_EXAMPLES=ON -DFLS_ENABLE_VERBOSE_OUTPUT=ON -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DFLS_ENABLE_INSTALL=OFF - -DCMAKE_C_COMPILER=clang - -DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" ) - # Use static MSVC runtime on Windows to avoid ASAN/UBSAN mismatch + if [[ "${{ matrix.compiler }}" == "msvc" ]]; then + : # Ninja is used via global CMAKE_GENERATOR; vcvars sets up MSVC + elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then + CMAKE_ARGS+=(-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++) + else + CMAKE_ARGS+=(-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER="${{ matrix.cxx }}") + fi if [[ "${{ runner.os }}" == "Windows" ]]; then CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded) fi cmake "${CMAKE_ARGS[@]}" - name: Build example - run: cmake --build "build_${{ matrix.build_type }}_${{ matrix.shared_lib }}" --parallel + run: | + cmake --build "build_${{ matrix.compiler }}_${{ matrix.build_type }}_${{ matrix.shared_lib }}" \ + --config ${{ matrix.build_type }} --parallel - name: Run cpp_example shell: bash run: | + BUILD_DIR="build_${{ matrix.compiler }}_${{ matrix.build_type }}_${{ matrix.shared_lib }}" if [[ "${{ runner.os }}" == "Windows" ]]; then - ./build_${{ matrix.build_type }}_${{ matrix.shared_lib }}/examples/cpp_example.exe + ./${BUILD_DIR}/examples/cpp_example.exe else - ./build_${{ matrix.build_type }}_${{ matrix.shared_lib }}/examples/cpp_example + ./${BUILD_DIR}/examples/cpp_example fi # ────────────────────────────────────────────────────────────────────────────── @@ -234,24 +270,35 @@ jobs: # ────────────────────────────────────────────────────────────────────────────── test: # needs: build - name: test (${{ matrix.platform }}, ${{ matrix.build_type }}, ${{ matrix.shared_lib && 'shared' || 'static' }}) + name: test (${{ matrix.platform }}, ${{ matrix.compiler }}, ${{ matrix.build_type }}, ${{ matrix.shared_lib && 'shared' || 'static' }}) strategy: + fail-fast: false matrix: - platform: - - ubuntu-24.04 - - ubuntu-22.04 - - ubuntu-24.04-arm - - ubuntu-22.04-arm - - macos-15 - - macos-14 - - macos-13 + # GCC on ubuntu; Clang on macOS; MSVC on Windows; shared on one per OS family + include: + # GCC — static (half of ubuntu platforms) + - { platform: ubuntu-24.04, compiler: gcc, shared_lib: false } + - { platform: ubuntu-24.04-arm, compiler: gcc, shared_lib: false } + # Clang — static (other half) + - { platform: ubuntu-22.04, compiler: clang, shared_lib: false } + - { platform: ubuntu-22.04-arm, compiler: clang, shared_lib: false } + # GCC — shared (one ubuntu) + - { platform: ubuntu-24.04, compiler: gcc, shared_lib: true } + # Clang — macOS static (all platforms) + - { platform: macos-26, compiler: clang, shared_lib: false } + - { platform: macos-15, compiler: clang, shared_lib: false } + # Clang — macOS shared (one) + - { platform: macos-15, compiler: clang, shared_lib: true } + # MSVC — static + shared on windows-latest; static on ARM + - { platform: windows-latest, compiler: msvc, shared_lib: false } + - { platform: windows-latest, compiler: msvc, shared_lib: true } + - { platform: windows-11-arm, compiler: msvc, shared_lib: false } build_type: [ Release ] - shared_lib: [ false, true ] runs-on: ${{ matrix.platform }} defaults: run: - shell: bash # Use bash on all platforms to avoid PowerShell issues on Windows + shell: bash steps: - uses: actions/checkout@v4 @@ -274,12 +321,16 @@ jobs: uses: ./.github/actions/generate-dataset - name: Install LLVM + if: matrix.compiler == 'clang' uses: ./.github/actions/install-llvm + - name: Set up MSVC environment + if: matrix.compiler == 'msvc' + uses: ilammy/msvc-dev-cmd@v1 + - name: Configure tests run: | - # Build directory uses our human-friendly label - BUILD_DIR="test_build_${LIB_LABEL}" + BUILD_DIR="test_build_${{ matrix.compiler }}_${LIB_LABEL}" CMAKE_ARGS=( -S "${{ github.workspace }}" -B "${BUILD_DIR}" @@ -288,10 +339,14 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DFLS_ENABLE_INSTALL=OFF - -DCMAKE_C_COMPILER=clang - -DCMAKE_CXX_COMPILER=clang++ ) - # On Windows, use static MSVC runtime to prevent ASAN/UBSAN mismatch + if [[ "${{ matrix.compiler }}" == "msvc" ]]; then + : # Ninja is used via global CMAKE_GENERATOR; vcvars sets up MSVC + elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then + CMAKE_ARGS+=(-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++) + else + CMAKE_ARGS+=(-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++) + fi if [[ "${{ runner.os }}" == "Windows" ]]; then CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded) fi @@ -299,18 +354,19 @@ jobs: - name: Build tests run: | - # Use the same labeled build directory - cmake --build "test_build_${LIB_LABEL}" -j $BUILD_THREADS + cmake --build "test_build_${{ matrix.compiler }}_${LIB_LABEL}" \ + --config ${{ matrix.build_type }} -j $BUILD_THREADS - name: Run tests - working-directory: "test_build_${{ env.LIB_LABEL }}" + working-directory: "test_build_${{ matrix.compiler }}_${{ env.LIB_LABEL }}" run: | - # Exclude Quick-Fuzz tests from the normal suite + EXCLUDE="QuickFuzz" ctest -j $BUILD_THREADS \ + --build-config ${{ matrix.build_type }} \ --stop-on-failure \ --output-on-failure \ --timeout 5000 \ - -E "QuickFuzz" + -E "$EXCLUDE" # ────────────────────────────────────────────────────────────────────────────── # 7️⃣ Install job @@ -318,9 +374,17 @@ jobs: install: needs: test strategy: + fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - shared_lib: [ false, true ] + # GCC on ubuntu; Clang on macOS; MSVC on Windows; static + shared per OS + include: + - { os: ubuntu-latest, compiler: gcc, shared_lib: false } + - { os: ubuntu-latest, compiler: gcc, shared_lib: true } + - { os: macos-latest, compiler: clang, shared_lib: false } + - { os: macos-latest, compiler: clang, shared_lib: true } + - { os: windows-latest, compiler: msvc, shared_lib: false } + - { os: windows-latest, compiler: msvc, shared_lib: true } + - { os: windows-11-arm, compiler: msvc, shared_lib: false } runs-on: ${{ matrix.os }} steps: @@ -332,30 +396,38 @@ jobs: shell: bash run: make detect-cpu | tee -a "$GITHUB_ENV" - # Use the same LLVM toolchain as the other jobs - name: Install LLVM toolchain + if: matrix.compiler == 'clang' uses: ./.github/actions/install-llvm + - name: Set up MSVC environment + if: matrix.compiler == 'msvc' + uses: ilammy/msvc-dev-cmd@v1 + - name: Configure + build + install shell: bash run: | CMAKE_ARGS=( -S "${{ github.workspace }}" - -B build_${{ matrix.shared_lib }} - -G "${CMAKE_GENERATOR}" - -DCMAKE_C_COMPILER=clang - -DCMAKE_CXX_COMPILER=clang++ + -B build_${{ matrix.compiler }}_${{ matrix.shared_lib }} -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=build_${{ matrix.shared_lib }}/install + -DCMAKE_INSTALL_PREFIX=build_${{ matrix.compiler }}_${{ matrix.shared_lib }}/install -DFLS_BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DFLS_ENABLE_INSTALL=ON ) - # Use static MSVC runtime on Windows to avoid ASAN/UBSAN mismatch + if [[ "${{ matrix.compiler }}" == "msvc" ]]; then + : # Ninja is used via global CMAKE_GENERATOR; vcvars sets up MSVC + elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then + CMAKE_ARGS+=(-G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++) + else + CMAKE_ARGS+=(-G "${CMAKE_GENERATOR}" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++) + fi if [[ "${{ runner.os }}" == "Windows" ]]; then CMAKE_ARGS+=(-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded) fi cmake "${CMAKE_ARGS[@]}" - cmake --build build_${{ matrix.shared_lib }} --target install -j $BUILD_THREADS + cmake --build build_${{ matrix.compiler }}_${{ matrix.shared_lib }} \ + --config Release --target install -j $BUILD_THREADS - name: Verify installed header files shell: bash @@ -363,7 +435,7 @@ jobs: set -euo pipefail SOURCE_INCLUDE=src/include - INSTALL_INCLUDE=build_${{ matrix.shared_lib }}/install/include + INSTALL_INCLUDE=build_${{ matrix.compiler }}_${{ matrix.shared_lib }}/install/include # 1) fail fast if the install tree isn't there if [[ ! -d "$INSTALL_INCLUDE" ]]; then diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 2777650f..2feca41f 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -10,6 +10,7 @@ run-name: >- on: push: + branches: [ main, dev ] pull_request: branches: [ main, dev ] diff --git a/.github/workflows/flatbuffers-ci.yml b/.github/workflows/flatbuffers-ci.yml index 775ccee1..5f0336aa 100644 --- a/.github/workflows/flatbuffers-ci.yml +++ b/.github/workflows/flatbuffers-ci.yml @@ -12,8 +12,10 @@ run-name: >- # Trigger on every push & PR, on all branches # ───────────────────────────────────────────────────────────── on: - push: # no branches filter ⇒ every branch - pull_request: # no branches filter ⇒ every target branch + push: + branches: [ main, dev ] + pull_request: + branches: [ main, dev ] concurrency: group: flatbuffers-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/fsst.yaml b/.github/workflows/fsst.yaml index f3926baa..bb8fc1f9 100644 --- a/.github/workflows/fsst.yaml +++ b/.github/workflows/fsst.yaml @@ -13,8 +13,9 @@ run-name: >- # ────────────────────────────────────────────────────────────────────────────── on: push: + branches: [ main, dev ] pull_request: - branches: [ "main", "dev" ] + branches: [ main, dev ] # Cancel in-flight runs on the same branch/PR so we do not waste minutes concurrency: diff --git a/.github/workflows/header-check.yml b/.github/workflows/header-check.yml index 55fbb4f0..3fdc3fcc 100644 --- a/.github/workflows/header-check.yml +++ b/.github/workflows/header-check.yml @@ -11,6 +11,7 @@ run-name: >- on: push: + branches: [ main, dev ] pull_request: branches: [ main, dev ] diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b7ee2f56..ba215d2f 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,6 +13,7 @@ run-name: >- # ──────────────────────────────────────────────────────── on: push: + branches: [ main, dev ] pull_request: branches: [ main, dev ] workflow_dispatch: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3751d51e..095e73f3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,8 +14,9 @@ run-name: >- on: push: + branches: [ main, dev ] pull_request: - branches: [ "main", "dev" ] + branches: [ main, dev ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.gitignore b/.gitignore index 551b8a0f..e04f51e5 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,8 @@ rust/target/ skbuild-*/ .idea/ .venv/ + +# Windows build artifacts +build_win.bat +cmake_output.txt +build_win/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..59eeffa1 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,121 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What is FastLanes + +FastLanes is a C++20 columnar compression storage format — "Like Parquet, but with 40% better compression and 40× faster decoding." Zero external dependencies, SIMD-friendly without explicit SIMD instructions. Bindings exist for Python (`python/`), Rust (`rust/`), C (`src/c_api/`), and CUDA (`cuda/`). + +## Build Commands + +FastLanes uses CMake 3.22+ with Ninja. On Linux/macOS it requires Clang >= 13. On Windows it uses MSVC (set up via `vcvarsall.bat`). + +### Configure and build (Release with tests) +```bash +cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLS_BUILD_TESTING=ON +cmake --build build --parallel +``` + +### Run all tests +```bash +cd build && ctest -j4 --output-on-failure --timeout 300 -E QuickFuzz +``` + +### Run a single test by filter +```bash +build/test/src/dataset_tests/dataset_tests.exe --gtest_filter=FastLanesReaderTester.issue_000 +``` + +### Run a single test target +```bash +cmake --build build --target unit_test && ctest -R unit_test --output-on-failure +``` + +### Key CMake options +| Option | Default | Purpose | +|--------|---------|---------| +| `FLS_BUILD_TESTING` | OFF | Build tests (fetches GoogleTest v1.15.2) | +| `FLS_BUILD_SHARED_LIBS` | OFF | Build as shared library (DLL) instead of static | +| `FLS_BUILD_BENCHMARKING` | OFF | Build benchmarks | +| `FLS_BUILD_PYTHON` | OFF | Build Python bindings | +| `FLS_BUILD_CUDA` | OFF | Build CUDA reader | +| `FLS_ENABLE_CLANG_TIDY` | OFF | Enable clang-tidy on all targets | + +### Windows-specific (MSVC) + +Invoke builds via a `.bat` that calls `vcvarsall.bat` first. Example pattern: +```bat +call "C:\Program Files\Microsoft Visual Studio\...\vcvarsall.bat" arm64 +cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLS_BUILD_TESTING=ON +cmake --build build --parallel +``` + +Test data can be cached across builds by setting `FASTLANES_DATA_DIR` environment variable to an existing data directory (e.g., `build_release/_deps/data-src`). + +### Format code +The project uses `.clang-format` (LLVM base, tabs, 120-column limit). Run clang-format on changed files before committing. + +## Architecture + +### Public API + +The main entry point is `fastlanes::Connection` (in `src/include/fls/connection.hpp`): +```cpp +auto conn = fastlanes::connect(); +conn->read_csv("input/"); // ingest CSV +conn->to_fls("output/"); // write FastLanes format +auto reader = conn->read_fls("data.fls"); // read back +auto table = reader->materialize(); +``` + +`TableReader` provides rowgroup-level random access. `RowgroupReader` decompresses individual rowgroups. The reader stack: `TableReader` → `RowgroupReader` → `RowgroupView` → `ColumnView` → `SegmentView`. + +### Library structure + +All source is under `src/`. Each subdirectory builds an OBJECT library that gets linked into the single `FastLanes` library target. Key components: + +- **`cor/`** — Core: architecture detection, CPU features, layout (`Buf`), compression/decompression engines +- **`expression/`** — Expression-based encoding: physical expressions, operators (RLE, FSST, ALP, dict, delta, etc.), interpreter +- **`encoder/`** — High-level encoding pipeline, materializer (decompression) +- **`wizard/`** — Schema discovery: analyzes data and selects optimal encoding per column +- **`reader/`** — File reading: segments, column views, rowgroup views, table reader +- **`table/`** — In-memory table representation: `Rowgroup`, `Table`, `Vector`, typed columns +- **`footer/`** — FlatBuffers-generated metadata descriptors (table, rowgroup, column, segment) +- **`alp/`** — ALP (Adaptive Lossless Floating-Point) compression codec +- **`primitive/`** — Low-level primitives: bitpacking, patching, FSST string compression + +### DLL / Shared library support (Windows) + +The `FLS_API` macro in `src/include/fls/api/api.hpp` controls symbol visibility: +- `FLS_STATIC` defined → `FLS_API` is empty (static build) +- `FLS_BUILD_DLL` defined → `FLS_API` is `__declspec(dllexport)` (building the DLL) +- Neither defined → `FLS_API` is `__declspec(dllimport)` (consuming the DLL) + +When `FLS_BUILD_SHARED_LIBS=ON`, `FLS_BUILD_DLL` is set directory-scoped via `add_compile_definitions` in `src/CMakeLists.txt` so all object libraries under `src/` get it. Test targets (under `test/`) don't get it, so `FLS_API` correctly resolves to `dllimport` for them. + +Any public function or class that test code (or external consumers) calls across the DLL boundary must be marked `FLS_API`. For template functions, the explicit instantiations in the .cpp must also carry `FLS_API`. + +Note: `WINDOWS_EXPORT_ALL_SYMBOLS` does NOT work for this project — the symbol count exceeds the 65535 .def file limit. + +**MSVC dllexport gotchas:** MSVC eagerly instantiates all special member functions for `__declspec(dllexport)` classes. This causes two problems: + +1. **Non-copyable members** (e.g., `vector>`): MSVC tries to generate copy ctor/assign and fails. Fix: explicitly `= delete` copy operations on the class. + +2. **Incomplete types in unique_ptr**: MSVC tries to generate the destructor inline, which needs the complete type. Fix: either include the complete type's header, or declare the destructor in the header and define it `= default` in the .cpp where the type is complete. + +### Type aliases + +Defined in `src/include/fls/common/alias.hpp`: +- `n_t` = `uint64_t` (counts), `idx_t` = `uint32_t` (indices), `bw_t` = `uint8_t` (bit width) +- `up` = `unique_ptr`, `sp` = `shared_ptr` + +### Test structure + +Tests live in `test/src/` with six suites: `dataset_tests`, `expression_tests`, `fls_reader_tests`, `primitive_tests`, `quick_fuzz_tests`, `unit_tests`. All use GoogleTest. On MSVC, a `msvc_heap_guard` object library handles SEH guard-page exceptions that would otherwise cause spurious test failures. + +## Code Style + +- `.clang-tidy` is strict: `WarningsAsErrors: '*'` — all warnings are errors +- Types: `CamelCase`. Functions: `aNy_CasE`. Members: `lower_case` (private: `m_` prefix). Constants: `UPPER_CASE`. Typedefs: `lower_case` with `_t` suffix +- Tabs for indentation, 120-column limit +- PRs target `dev` branch diff --git a/CMakeLists.txt b/CMakeLists.txt index 43acdaa3..3417521b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,13 +6,15 @@ cmake_minimum_required(VERSION 3.22) # Requirements : ------------------------------------------------------------------------------------------------------- -find_program(CLANG_CXX NAMES clang++ REQUIRED) -find_program(CLANG_C NAMES clang REQUIRED) - -if (CLANG_CXX AND CLANG_C) - # Set Clang as the compiler explicitly - set(CMAKE_C_COMPILER "${CLANG_C}" CACHE STRING "C Compiler" FORCE) - set(CMAKE_CXX_COMPILER "${CLANG_CXX}" CACHE STRING "C++ Compiler" FORCE) +# On non-Windows platforms, default to Clang unless the user explicitly sets a compiler +# (e.g. -DCMAKE_CXX_COMPILER=g++). On Windows, let CMake use the default (MSVC from vcvars). +if (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + if (NOT DEFINED CMAKE_CXX_COMPILER) + find_program(CLANG_CXX NAMES clang++ REQUIRED) + find_program(CLANG_C NAMES clang REQUIRED) + set(CMAKE_C_COMPILER "${CLANG_C}" CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER "${CLANG_CXX}" CACHE STRING "C++ Compiler" FORCE) + endif () endif () @@ -48,10 +50,16 @@ include(GNUInstallDirs) include(enable_sanitizer) # Checks : ------------------------------------------------------------------------------------------------------- -if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - message(FATAL_ERROR "Only Clang is supported!") -endif () -if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) +if (MSVC) + message(STATUS "-- FLS: Building with MSVC ${CMAKE_CXX_COMPILER_VERSION}") +elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + message(STATUS "-- FLS: Building with GCC ${CMAKE_CXX_COMPILER_VERSION}") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) + message(FATAL_ERROR "Only GCC >= 11 is supported (C++20 requirement)!") + endif () +elseif (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + message(FATAL_ERROR "Only Clang, GCC, and MSVC are supported!") +elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) message(FATAL_ERROR "Only Clang >= 13 is supported!") endif () @@ -62,51 +70,81 @@ endif () # Flags : -------------------------------------------------------------------------------------------------------------- message("---------------------------------------------------------------------------------------------------------") message("-- FLS: detecting flags.") -# First, check if running on GitHub Actions -if (DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true") - message(STATUS "Running on GitHub Actions runner.") - set(IS_GITHUB_ACTIONS ON) -endif () -# Check if the compiler supports -mavx512dq -check_cxx_compiler_flag("-mavx512dq" COMPILER_SUPPORTS_AVX512DQ) +if (MSVC) + # MSVC auto-targets the host architecture. No manual arch flags needed. + message(STATUS "-- FLS: MSVC build — no arch flags applied.") -# Detect AVX-512DQ hardware support via /proc/cpuinfo -set(HAS_HW_AVX512DQ OFF) -if (EXISTS "/proc/cpuinfo") - file(READ "/proc/cpuinfo" CPUINFO_CONTENT) - if (CPUINFO_CONTENT MATCHES "avx512dq") - set(HAS_HW_AVX512DQ ON) + # Warning level: /W3 for initial port (tighten to /W4 /WX later). + # /Zc:__cplusplus is needed so __cplusplus reports the correct standard version. + # /bigobj is needed for large translation units (e.g. materializer.cpp). + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /Zc:__cplusplus /bigobj /MP") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") +else () + # First, check if running on GitHub Actions + if (DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true") + message(STATUS "Running on GitHub Actions runner.") + set(IS_GITHUB_ACTIONS ON) endif () -endif () -if (COMPILER_SUPPORTS_AVX512DQ AND HAS_HW_AVX512DQ AND NOT IS_GITHUB_ACTIONS) - message(STATUS "Compiler and hardware both support AVX-512DQ. Adding flag '-mavx512dq'.") - set(FLAGS "-mavx512dq") -elseif (COMPILER_SUPPORTS_AVX512DQ AND HAS_HW_AVX512DQ AND IS_GITHUB_ACTIONS) - message(WARNING "Hardware supports AVX-512DQ, but not adding on GitHub Actions runner.") -elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i[3-6]86") - message(STATUS "Setting '-march=native' for x86 processors without AVX-512DQ.") - set(FLAGS "-march=native") -else () - message(STATUS "No instruction set flags applied.") -endif () + # Check if the compiler supports -mavx512dq + check_cxx_compiler_flag("-mavx512dq" COMPILER_SUPPORTS_AVX512DQ) -# Append the computed FLAGS to the compiler flags if defined -if (FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") -endif () + # Detect AVX-512DQ hardware support via /proc/cpuinfo + set(HAS_HW_AVX512DQ OFF) + if (EXISTS "/proc/cpuinfo") + file(READ "/proc/cpuinfo" CPUINFO_CONTENT) + if (CPUINFO_CONTENT MATCHES "avx512dq") + set(HAS_HW_AVX512DQ ON) + endif () + endif () -# Flags for warnings and errors: -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Winconsistent-missing-override -Wshadow -Wconversion -Wnon-virtual-dtor -Wunused -Wpedantic -Woverloaded-virtual -Wshorten-64-to-32") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wshadow -Wconversion") + if (COMPILER_SUPPORTS_AVX512DQ AND HAS_HW_AVX512DQ AND NOT IS_GITHUB_ACTIONS) + message(STATUS "Compiler and hardware both support AVX-512DQ. Adding flag '-mavx512dq'.") + set(FLAGS "-mavx512dq") + elseif (COMPILER_SUPPORTS_AVX512DQ AND HAS_HW_AVX512DQ AND IS_GITHUB_ACTIONS) + message(WARNING "Hardware supports AVX-512DQ, but not adding on GitHub Actions runner.") + elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i[3-6]86") + message(STATUS "Setting '-march=native' for x86 processors without AVX-512DQ.") + set(FLAGS "-march=native") + else () + message(STATUS "No instruction set flags applied.") + endif () + + # Append the computed FLAGS to the compiler flags if defined + if (FLAGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") + endif () + + # Flags for warnings and errors (common to Clang and GCC): + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wshadow -Wconversion -Wnon-virtual-dtor -Wunused -Wpedantic -Woverloaded-virtual") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wshadow -Wconversion") + + # Clang-only warning flags: + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Winconsistent-missing-override -Wshorten-64-to-32") + endif () + # GCC-only warning flags: + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") + endif () + + # On Windows (Clang, not MSVC), vectorize-width pragmas may not be honoured + # because the CI runners lack AVX-512. Demote the transform-warning to a + # non-fatal warning so -Werror does not reject advisory hints. + if (WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pass-failed") + endif () +endif () if (CMAKE_BUILD_TYPE STREQUAL "Debug") message("---------------------------------------------------------------------------------------------------------") message("-- FLS: Debug mode enabled. Adding -g and -O0.") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0") + if (NOT MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0") + endif () endif () # Options : ------------------------------------------------------------------------------------------------------------ @@ -184,10 +222,18 @@ if (FLS_BUILD_TESTING OR FLS_BUILD_CUDA OR FLS_ENABLE_FSST_TESTING_AND_BENCHMARK # On Windows, GoogleTest uses Microsoft-specific language extensions like `__try` # that trigger Clang's -Wlanguage-extension-token warning. Since we build with -Werror, # selectively disable that warning (and suppress all warnings with -w) ONLY for GoogleTest. - if (MSVC OR WIN32) + if (MSVC) + foreach (_t gtest gtest_main gmock gmock_main) + if (TARGET ${_t}) + get_target_property(_aliased ${_t} ALIASED_TARGET) + if (NOT _aliased) + target_compile_options(${_t} PRIVATE /w) + endif () + endif () + endforeach () + elseif (WIN32) foreach (_t gtest gtest_main gmock gmock_main) if (TARGET ${_t}) - # Skip alias targets (defensive; these names are real targets when fetched) get_target_property(_aliased ${_t} ALIASED_TARGET) if (NOT _aliased) target_compile_options(${_t} PRIVATE -Wno-language-extension-token -w) diff --git a/Makefile b/Makefile index 421c0336..2963d54d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ NUM_JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || ec # Test-specific config (separate build dir and build type) TEST_BUILD_DIR ?= $(BUILD_DIR)/tests -TEST_BUILD_TYPE ?= Release +TEST_BUILD_TYPE ?= Debug # Includes include mk/preamble.mk # colors + root paths diff --git a/examples/rust_example/Cargo.toml b/examples/rust_example/Cargo.toml index 16cd1dc6..5b8db0f6 100644 --- a/examples/rust_example/Cargo.toml +++ b/examples/rust_example/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" -fls-rs = "0.1.3-alpha.7" +fls-rs = { path = "../../rust" } [[bin]] name = "rust_example" diff --git a/fls_gen/cuda_unpack.py b/fls_gen/cuda_unpack.py index 061f4d1a..e767bcd7 100644 --- a/fls_gen/cuda_unpack.py +++ b/fls_gen/cuda_unpack.py @@ -179,7 +179,7 @@ def unpack_store(self, cu): def gen_before_loop_pragmas(self, cu): if self.mode is Mode.aav and self.ow > 46: - cu("#pragma clang loop vectorize(enable)") + cu("FLS_PRAGMA_VECTORIZE") def get_func_signature(self): return '__device__ void unpack_$bw$bw_$ow$ow_$crw$crw_$uf$uf(const uint$ow$_t *__restrict a_in_p, uint$ow$_t ' \ diff --git a/mk/benchmark.mk b/mk/benchmark.mk index 1c15fbda..c18c65f4 100644 --- a/mk/benchmark.mk +++ b/mk/benchmark.mk @@ -12,7 +12,7 @@ VENV_DIR := $(abspath ../.venv) PYTHON3 := $(VENV_DIR)/bin/python3 -PYTHON := $(if $(wildcard $(PYTHON3)),$(PYTHON3),$(VENV_DIR)/bin/python) +PYTHON ?= $(if $(wildcard $(PYTHON3)),$(PYTHON3),$(VENV_DIR)/bin/python) PIP := $(PYTHON) -m pip # ── Script location (relative to project root) diff --git a/mk/data.mk b/mk/data.mk index d2fdcd68..dcb6ccf2 100644 --- a/mk/data.mk +++ b/mk/data.mk @@ -10,7 +10,7 @@ PROJECT_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) -include $(PROJECT_ROOT)/mk/python.mk # non-fatal if missing VENV ?= $(PROJECT_ROOT)/.venv -PYTHON ?= $(VENV)/bin/python3 # python.exe on Win via python.mk +PYTHON ?= $(VENV)/bin/python3 PIP ?= $(PYTHON) -m pip DATA_DIR := $(PROJECT_ROOT)/data diff --git a/mk/example.mk b/mk/example.mk index 4b1362d3..3b1548ae 100644 --- a/mk/example.mk +++ b/mk/example.mk @@ -132,7 +132,7 @@ clean-examples: # ───────────────────────────────────────────────────────────── VENV_DIR := $(EXAMPLES_DIR)/.venv -PYTHON := $(VENV_DIR)/bin/python +PYTHON ?= $(VENV_DIR)/bin/python PIP := $(VENV_DIR)/bin/pip PDF_SCRIPT := $(PROJECT_DIR)/data/example/extract_sentences.py CSV_OUTPUT := $(PROJECT_DIR)/data/example/papers.csv diff --git a/mk/header_check.mk b/mk/header_check.mk index 225af9e6..2ad86732 100644 --- a/mk/header_check.mk +++ b/mk/header_check.mk @@ -5,7 +5,7 @@ # ──────────────────────────────────────────────────────── include mk/venv.mk -PYTHON := $(VENV_DIR)/bin/python3 +PYTHON ?= $(VENV_DIR)/bin/python3 SCRIPT := scripts/header_check.py .PHONY: check-header fix-header diff --git a/mk/quick_fuzz.mk b/mk/quick_fuzz.mk index 2b6a205d..077c1274 100644 --- a/mk/quick_fuzz.mk +++ b/mk/quick_fuzz.mk @@ -7,8 +7,6 @@ # ────────────────────────────────────────────────────────── # Bump & verify fuzz seed helper targets # ────────────────────────────────────────────────────────── -PYTHON := python3 - # point ROOT at repo root (parent of this mk/ directory) ROOT := $(shell dirname $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index cf802894..c8c86124 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -36,7 +36,7 @@ cxx = "1" anyhow = "1" [build-dependencies] -vergen = { version = "9.0.5", default-features = false, features = ["build"] } -vergen-gix = { version = "1.0.9", default-features = false, features = ["build"] } +vergen = { version = "9.1.0", default-features = false, features = ["build"] } +vergen-gix = { version = "9.1.0", default-features = false, features = ["build"] } cmake = "0.1" cxx-build = "1" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 056ed968..166a712c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,19 @@ target_include_directories(fls_headers add_library(FastLanes::headers ALIAS fls_headers) + +########################################################################### +# Propagate the shared/static build mode to all object-library targets. +# add_compile_definitions is directory-scoped, so only targets under src/ +# will pick up FLS_BUILD_DLL — test targets won't, so FLS_API correctly +# expands to __declspec(dllimport) for consumers. +########################################################################### +if (FLS_BUILD_SHARED_LIBS) + add_compile_definitions(FLS_BUILD_DLL) +else () + add_compile_definitions(FLS_STATIC) +endif () + ########################################################################### # 2. Sub-directories that build individual components ########################################################################### @@ -59,19 +72,11 @@ if (FLS_BUILD_SHARED_LIBS) connection.cpp ${FASTLANES_OBJECT_FILES} ) - target_compile_definitions(FastLanes - PRIVATE - FLS_BUILD_DLL - ) else () add_library(FastLanes STATIC connection.cpp ${FASTLANES_OBJECT_FILES} ) - target_compile_definitions(FastLanes - PUBLIC - FLS_STATIC - ) endif () target_compile_features(FastLanes PUBLIC cxx_std_20) @@ -81,6 +86,12 @@ target_link_libraries(FastLanes FastLanes::headers ) +# Let consumers know whether they are linking against a static or shared build. +# FLS_STATIC makes FLS_API expand to nothing; without it MSVC defaults to dllimport. +if (NOT FLS_BUILD_SHARED_LIBS) + target_compile_definitions(FastLanes PUBLIC FLS_STATIC) +endif () + add_library(FastLanes::core ALIAS FastLanes) # Optional IWYU integration diff --git a/src/alp/src/encoder.cpp b/src/alp/src/encoder.cpp index b349887d..8c641488 100644 --- a/src/alp/src/encoder.cpp +++ b/src/alp/src/encoder.cpp @@ -11,6 +11,7 @@ #include "alp/sampler.hpp" #include "alp/state.hpp" #include "fls/common/assert.hpp" // fix me +#include "fls/compiler.hpp" #include "fls/ffor_util.hpp" #include #include // for std::ceil @@ -97,10 +98,7 @@ void encoder::encode_simdized(const PT* data_p, } } -#if !defined(_WIN32) - // Only non-Windows platforms will see this pragma -#pragma clang loop vectorize_width(64) -#endif + FLS_PRAGMA_VECTORIZE_WIDTH(64) for (uint64_t i {0}; i < config::VECTOR_SIZE; i++) { auto const actual_value = VALUE_ARR_WITHOUT_SPECIALS[i]; @@ -280,7 +278,9 @@ void encoder::find_top_k_combinations(const PT* smp_arr, state& // We try all combinations in search for the one which minimize the compression size for (int8_t exponent_idx = Constants::MAX_EXPONENT; exponent_idx >= 0; --exponent_idx) { - for (int8_t factor_idx = exponent_idx; factor_idx >= 0; --factor_idx) { + for (int8_t factor_idx = std::min(exponent_idx, static_cast(Constants::FACT_ARR.size() - 1)); + factor_idx >= 0; + --factor_idx) { uint16_t exceptions_count = {0}; uint16_t non_exceptions_count = {0}; uint32_t estimated_bits_per_value = {0}; diff --git a/src/alp/src/falp.cpp b/src/alp/src/falp.cpp index dbdf805d..320f266e 100644 --- a/src/alp/src/falp.cpp +++ b/src/alp/src/falp.cpp @@ -5,13 +5,14 @@ // ──────────────────────────────────────────────────────── // generated! // NOLINTBEGIN -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wfloat-conversion" -#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion" +#include "fls/compiler.hpp" +FLS_DIAG_PUSH +FLS_DIAG_IGNORE_SIGN_CONV +FLS_DIAG_IGNORE_FLOAT_CONV +FLS_DIAG_IGNORE_INT_FLOAT_CONV -#include "alp/falp.hpp" #include "alp/constants.hpp" +#include "alp/falp.hpp" namespace generated { namespace falp::fallback { namespace scalar { static void falp_0bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, double* __restrict a_out_p, @@ -27,7 +28,7 @@ static void falp_0bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { tmp_0 = base_0; tmp_0 *= factor; @@ -114,7 +115,7 @@ static void falp_1bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 1) - 1); @@ -581,7 +582,7 @@ static void falp_2bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 2) - 1); @@ -1049,7 +1050,7 @@ static void falp_3bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 3) - 1); @@ -1520,7 +1521,7 @@ static void falp_4bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 4) - 1); @@ -1990,7 +1991,7 @@ static void falp_5bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 5) - 1); @@ -2465,7 +2466,7 @@ static void falp_6bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 6) - 1); @@ -2941,7 +2942,7 @@ static void falp_7bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 7) - 1); @@ -3420,7 +3421,7 @@ static void falp_8bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 8) - 1); @@ -3894,7 +3895,7 @@ static void falp_9bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 9) - 1); @@ -4377,7 +4378,7 @@ static void falp_10bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 10) - 1); @@ -4861,7 +4862,7 @@ static void falp_11bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 11) - 1); @@ -5348,7 +5349,7 @@ static void falp_12bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 12) - 1); @@ -5834,7 +5835,7 @@ static void falp_13bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 13) - 1); @@ -6325,7 +6326,7 @@ static void falp_14bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 14) - 1); @@ -6817,7 +6818,7 @@ static void falp_15bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 15) - 1); @@ -7312,7 +7313,7 @@ static void falp_16bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 16) - 1); @@ -7794,7 +7795,7 @@ static void falp_17bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 17) - 1); @@ -8293,7 +8294,7 @@ static void falp_18bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 18) - 1); @@ -8793,7 +8794,7 @@ static void falp_19bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 19) - 1); @@ -9296,7 +9297,7 @@ static void falp_20bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 20) - 1); @@ -9798,7 +9799,7 @@ static void falp_21bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 21) - 1); @@ -10305,7 +10306,7 @@ static void falp_22bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 22) - 1); @@ -10813,7 +10814,7 @@ static void falp_23bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 23) - 1); @@ -11324,7 +11325,7 @@ static void falp_24bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 24) - 1); @@ -11830,7 +11831,7 @@ static void falp_25bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 25) - 1); @@ -12345,7 +12346,7 @@ static void falp_26bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 26) - 1); @@ -12861,7 +12862,7 @@ static void falp_27bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 27) - 1); @@ -13380,7 +13381,7 @@ static void falp_28bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 28) - 1); @@ -13898,7 +13899,7 @@ static void falp_29bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 29) - 1); @@ -14421,7 +14422,7 @@ static void falp_30bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 30) - 1); @@ -14945,7 +14946,7 @@ static void falp_31bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 31) - 1); @@ -15472,7 +15473,7 @@ static void falp_32bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 32) - 1); @@ -15970,7 +15971,7 @@ static void falp_33bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 33) - 1); @@ -16501,7 +16502,7 @@ static void falp_34bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 34) - 1); @@ -17033,7 +17034,7 @@ static void falp_35bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 35) - 1); @@ -17568,7 +17569,7 @@ static void falp_36bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 36) - 1); @@ -18102,7 +18103,7 @@ static void falp_37bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 37) - 1); @@ -18641,7 +18642,7 @@ static void falp_38bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 38) - 1); @@ -19181,7 +19182,7 @@ static void falp_39bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 39) - 1); @@ -19724,7 +19725,7 @@ static void falp_40bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 40) - 1); @@ -20262,7 +20263,7 @@ static void falp_41bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 41) - 1); @@ -20809,7 +20810,7 @@ static void falp_42bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 42) - 1); @@ -21357,7 +21358,7 @@ static void falp_43bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 43) - 1); @@ -21908,7 +21909,7 @@ static void falp_44bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 44) - 1); @@ -22458,7 +22459,7 @@ static void falp_45bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 45) - 1); @@ -23013,7 +23014,7 @@ static void falp_46bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 46) - 1); @@ -23569,7 +23570,7 @@ static void falp_47bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 47) - 1); @@ -24128,7 +24129,7 @@ static void falp_48bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 48) - 1); @@ -24674,7 +24675,7 @@ static void falp_49bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 49) - 1); @@ -25237,7 +25238,7 @@ static void falp_50bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 50) - 1); @@ -25801,7 +25802,7 @@ static void falp_51bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 51) - 1); @@ -26368,7 +26369,7 @@ static void falp_52bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 52) - 1); @@ -26934,7 +26935,7 @@ static void falp_53bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 53) - 1); @@ -27505,7 +27506,7 @@ static void falp_54bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 54) - 1); @@ -28077,7 +28078,7 @@ static void falp_55bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 55) - 1); @@ -28652,7 +28653,7 @@ static void falp_56bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 56) - 1); @@ -29222,7 +29223,7 @@ static void falp_57bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 57) - 1); @@ -29801,7 +29802,7 @@ static void falp_58bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 58) - 1); @@ -30381,7 +30382,7 @@ static void falp_59bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 59) - 1); @@ -30964,7 +30965,7 @@ static void falp_60bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 60) - 1); @@ -31546,7 +31547,7 @@ static void falp_61bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 61) - 1); @@ -32133,7 +32134,7 @@ static void falp_62bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 62) - 1); @@ -32721,7 +32722,7 @@ static void falp_63bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 63) - 1); @@ -33312,7 +33313,7 @@ static void falp_64bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] double frac10 = alp::Constants::FRAC_ARR[exp]; [[maybe_unused]] double tmp_dbl; [[maybe_unused]] int64_t tmp_int; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); register_0 += base_0; @@ -42756,5 +42757,5 @@ void falp(const uint32_t* __restrict a_in_p, } }}}; // namespace generated::falp::fallback::scalar -#pragma GCC diagnostic pop +FLS_DIAG_POP // NOLINTEND diff --git a/src/connection.cpp b/src/connection.cpp index fbe0d46b..cc1c498c 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -146,7 +146,7 @@ Status Connection::verify_fls(const path& file_path) { } if (constexpr auto versions = Info::get_all_versions(); - std::ranges::none_of(versions, [&](uint64_t v) { return file_header.version == v; })) { + std::none_of(versions.begin(), versions.end(), [&](uint64_t v) { return file_header.version == v; })) { return Status::Error(Status::ErrorCode::ERR_6_INVALID_VERSION_BYTES); } diff --git a/src/cor/prm/fsst/CMakeLists.txt b/src/cor/prm/fsst/CMakeLists.txt index 0dcb978f..23159301 100644 --- a/src/cor/prm/fsst/CMakeLists.txt +++ b/src/cor/prm/fsst/CMakeLists.txt @@ -16,7 +16,9 @@ set(FASTLANES_OBJECT_FILES PARENT_SCOPE) -target_compile_options(fls_fsst_prm PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_fsst_prm PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_fsst_prm PUBLIC diff --git a/src/cor/prm/fsst12/CMakeLists.txt b/src/cor/prm/fsst12/CMakeLists.txt index a63f009b..1a245a1d 100644 --- a/src/cor/prm/fsst12/CMakeLists.txt +++ b/src/cor/prm/fsst12/CMakeLists.txt @@ -13,7 +13,9 @@ set(FASTLANES_OBJECT_FILES ${FASTLANES_OBJECT_FILES} $ PARENT_SCOPE) -target_compile_options(fls_fsst12_prm PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_fsst12_prm PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_fsst12_prm PUBLIC diff --git a/src/detail/CMakeLists.txt b/src/detail/CMakeLists.txt index 5f2e274a..6eb048de 100644 --- a/src/detail/CMakeLists.txt +++ b/src/detail/CMakeLists.txt @@ -12,7 +12,9 @@ if (FLS_ENABLE_IWYU) set_property(TARGET fls_detail PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) endif () -target_compile_options(fls_detail PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_detail PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_detail PUBLIC diff --git a/src/encoder/CMakeLists.txt b/src/encoder/CMakeLists.txt index 137f7b24..d912421a 100644 --- a/src/encoder/CMakeLists.txt +++ b/src/encoder/CMakeLists.txt @@ -13,7 +13,9 @@ if (FLS_ENABLE_IWYU) set_property(TARGET fls_encoder PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) endif () -target_compile_options(fls_encoder PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_encoder PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_encoder PUBLIC diff --git a/src/expression/CMakeLists.txt b/src/expression/CMakeLists.txt index be234fa3..bb9997c6 100644 --- a/src/expression/CMakeLists.txt +++ b/src/expression/CMakeLists.txt @@ -16,6 +16,8 @@ add_library(fls_expression fsst_dict_operator.cpp fsst_expression.cpp interpreter.cpp + interpreter_encoding.cpp + interpreter_decoding.cpp rpn.cpp null_operator.cpp physical_expression.cpp @@ -38,7 +40,9 @@ set(FASTLANES_OBJECT_FILES PARENT_SCOPE) -target_compile_options(fls_expression PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_expression PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_expression PUBLIC diff --git a/src/expression/cross_rle_operator.cpp b/src/expression/cross_rle_operator.cpp index 638f3adb..fb1a87b0 100644 --- a/src/expression/cross_rle_operator.cpp +++ b/src/expression/cross_rle_operator.cpp @@ -16,6 +16,7 @@ #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" #include // for std::min +#include // for size_t #include // for uint8_t #include @@ -282,7 +283,9 @@ void decode_rle_range(const len_t* rle_lengths, for (n_t i = 0; i < to_copy; ++i) { if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), rle_value_bytes + prev_offset, rle_value_bytes + cur_offset); out_lengths[decoded_pos++] = length; diff --git a/src/expression/dict_expression.cpp b/src/expression/dict_expression.cpp index da30d1c0..08440947 100644 --- a/src/expression/dict_expression.cpp +++ b/src/expression/dict_expression.cpp @@ -17,6 +17,8 @@ #include "fls/reader/segment.hpp" #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" +#include // for std::max +#include // for size_t #include #include // for std::move #include // for std::monostate @@ -227,7 +229,9 @@ void dec_dict_opr::Decode(vector& byte_arr_vec, length_pointer[idx] = length; if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), Bytes() + offset, Bytes() + offset_next); } diff --git a/src/expression/frequency_operator.cpp b/src/expression/frequency_operator.cpp index 8fe99218..2843c2c2 100644 --- a/src/expression/frequency_operator.cpp +++ b/src/expression/frequency_operator.cpp @@ -18,6 +18,8 @@ #include "fls/reader/segment.hpp" #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" +#include // for std::max +#include // for size_t #include #include @@ -295,7 +297,9 @@ void dec_frequency_str_opr::Materialize(n_t vec_idx, FLSStrColumn& typed_col) { vec_idx_t exception_position {0}; for (n_t idx {0}; idx < CFG::VEC_SZ; ++idx) { if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } exception_position = exception_positions[exception_idx]; diff --git a/src/expression/fsst12_dict_operator.cpp b/src/expression/fsst12_dict_operator.cpp index 615bb2d7..c5030a32 100644 --- a/src/expression/fsst12_dict_operator.cpp +++ b/src/expression/fsst12_dict_operator.cpp @@ -19,6 +19,8 @@ #include "fls/reader/segment.hpp" #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" +#include // for std::max +#include // for size_t #include #include // for std::move #include // for std::monostate @@ -200,7 +202,9 @@ void dec_fsst12_dict_opr::Decode(vector& byte_arr_vec, vector length_pointer[idx] = decoded_size; if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), tmp_string.begin(), tmp_string.begin() + decoded_size); } diff --git a/src/expression/fsst12_expression.cpp b/src/expression/fsst12_expression.cpp index 6cb9b1a2..54d5af72 100644 --- a/src/expression/fsst12_expression.cpp +++ b/src/expression/fsst12_expression.cpp @@ -20,6 +20,8 @@ #include "fls/std/variant.hpp" #include "fls/table/rowgroup.hpp" #include "fls_gen/untranspose/untranspose.hpp" +#include // for std::max +#include // for size_t #include #include #include // for std::monostate @@ -159,7 +161,9 @@ void dec_fsst12_opr::Decode(vector& byte_arr_vec, vector& length in_byte_arr += encoded_size; length_pointer[i] = decoded_size; if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), tmp_string.begin(), tmp_string.begin() + decoded_size); } diff --git a/src/expression/fsst_dict_operator.cpp b/src/expression/fsst_dict_operator.cpp index 595392cd..4142fa80 100644 --- a/src/expression/fsst_dict_operator.cpp +++ b/src/expression/fsst_dict_operator.cpp @@ -19,6 +19,8 @@ #include "fls/reader/segment.hpp" #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" +#include // for std::max +#include // for size_t #include #include // for std::move #include // for std::monostate @@ -200,7 +202,9 @@ void dec_fsst_dict_opr::Decode(vector& byte_arr_vec, vector(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), tmp_string.begin(), tmp_string.begin() + decoded_size); } diff --git a/src/expression/fsst_expression.cpp b/src/expression/fsst_expression.cpp index 04ff9952..255fb9d7 100644 --- a/src/expression/fsst_expression.cpp +++ b/src/expression/fsst_expression.cpp @@ -20,6 +20,8 @@ #include "fls/std/variant.hpp" #include "fls/table/rowgroup.hpp" #include "fls_gen/untranspose/untranspose.hpp" +#include // for std::max +#include // for size_t #include #include // for std::move #include // for std::monostate @@ -159,7 +161,9 @@ void dec_fsst_opr::Decode(vector& byte_arr_vec, vector& length_v in_byte_arr += encoded_size; length_pointer[i] = decoded_size; if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), tmp_string.begin(), tmp_string.begin() + decoded_size); } diff --git a/src/expression/interpreter.cpp b/src/expression/interpreter.cpp index 0e2f20a8..1878ecad 100644 --- a/src/expression/interpreter.cpp +++ b/src/expression/interpreter.cpp @@ -4,453 +4,8 @@ // src/expression/interpreter.cpp // ──────────────────────────────────────────────────────── #include "fls/expression/interpreter.hpp" -#include "flatbuffers/vector.h" // flatbuffers::Vector -#include "fls/common/alias.hpp" -#include "fls/common/assert.hpp" -#include "fls/common/common.hpp" -#include "fls/common/exception.hpp" -#include "fls/common/string.hpp" -#include "fls/expression/alp_expression.hpp" -#include "fls/expression/analyze_operator.hpp" -#include "fls/expression/cross_rle_operator.hpp" -#include "fls/expression/data_parallelize_patch_operator.hpp" -#include "fls/expression/data_type.hpp" -#include "fls/expression/decoding_operator.hpp" -#include "fls/expression/dict_expression.hpp" -#include "fls/expression/encoding_operator.hpp" -#include "fls/expression/frequency_operator.hpp" -#include "fls/expression/fsst12_dict_operator.hpp" -#include "fls/expression/fsst12_expression.hpp" -#include "fls/expression/fsst_dict_operator.hpp" -#include "fls/expression/fsst_expression.hpp" -#include "fls/expression/null_operator.hpp" -#include "fls/expression/physical_expression.hpp" -#include "fls/expression/rle_expression.hpp" -#include "fls/expression/rpn.hpp" -#include "fls/expression/rsum_operator.hpp" -#include "fls/expression/scan_operator.hpp" -#include "fls/expression/slpatch_operator.hpp" -#include "fls/expression/transpose_operator.hpp" -#include "fls/expression/validitymask_operator.hpp" -#include "fls/reader/column_view.hpp" -#include "fls/std/type_traits.hpp" -#include "fls/table/rowgroup.hpp" -#include // size_t -#include // uint32_t, uint64_t namespace fastlanes { -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_uncompressed_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_uncompressed_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; - operand_tokens.emplace_back(0); - - const auto& column = rowgroup[column_descriptor.idx]; - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_validitymask_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_enc_validitymask_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; - operand_tokens.emplace_back(0); - - const auto& column = rowgroup[column_descriptor.idx]; - physical_expr.operators.emplace_back( - make_shared(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_struct_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_enc_struct_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - const auto& col = rowgroup[column_descriptor.idx]; - - physical_expr.operators.emplace_back(make_shared(col, column_descriptor)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_fls_str_uncompressed_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_fls_str_uncompressed_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; - operand_tokens.emplace_back(0); - operand_tokens.emplace_back(1); - - const auto& column = rowgroup[column_descriptor.idx]; - physical_expr.operators.emplace_back(make_shared(column)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_fsst_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_fsst_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - physical_expr.operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_fsst_delta_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_fsst_delta_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_fsst_delta_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_fsst_delta_slpatch_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_ffor_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_ffor_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_ffor_slpatch_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_null_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_null_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_null_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_frequency_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * enc_frequency_str_opr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_enc_frequency_str_opr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_cross_rle_opr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_cross_rle_opr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - const auto& column = rowgroup[column_descriptor.idx]; - auto& operators = physical_expr.operators; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_dict_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_dict_ffor_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_dict_ffor_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_fsst_dict_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_fsst_dict_ffor_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_fsst_dict_ffor_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_fsst_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_fsst_dict_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_fsst_dict_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_enc_dict_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_dict_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_alp_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_alp_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_galp_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_galp_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_rle_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_rle_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_rle_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_rle_slpatch_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_delta_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_delta_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); - operators.emplace_back( - make_shared>>(physical_expr, column, column_descriptor, state)); -} -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_alp_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_enc_alp_rd_expr(PhysicalExpr& physical_expr, - const rowgroup_pt& rowgroup, - ColumnDescriptorT& column_descriptor, - InterpreterState& state) { - auto& operators = physical_expr.operators; - const auto& column = rowgroup[column_descriptor.idx]; - - operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * Interpreter::Encoding -\*--------------------------------------------------------------------------------------------------------------------*/ InterpreterState::InterpreterState() : cur_operator(0) @@ -458,1600 +13,4 @@ InterpreterState::InterpreterState() , n_segments(0) { } -sp Interpreter::Encoding::Interpret(ColumnDescriptorT& column_descriptor, - const rowgroup_pt& physical_rowgroup, - InterpreterState& state) { - // return - auto physical_expr = make_shared(); - - for (auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; - const auto& operator_token : operator_tokens) { - using enum OperatorToken; - switch (operator_token) { - case EXP_UNCOMPRESSED_I64: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_I32: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_I16: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_U08: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_I64: { - make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_I32: { - make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_I16: { - make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_I08: { - make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_U08: { - make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_DBL: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_FLT: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_I08: { - make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_UNCOMPRESSED_STR: { - make_fls_str_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CONSTANT_DBL: - case EXP_CONSTANT_I64: - case EXP_CONSTANT_I32: - case EXP_CONSTANT_I16: - case EXP_CONSTANT_I08: - case EXP_CONSTANT_STR: - case EXP_CONSTANT_U08: - case EXP_CONSTANT_FLT: - case EXP_CONSTANT_BOOL: - case EXP_EQUAL: { - break; - } - case EXP_STRUCT: { - make_enc_struct_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_U32: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_U32: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I16_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_U32: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I16_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I08_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_FLT_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_FLT_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_U08: - case EXP_DICT_I64_U16: - case EXP_DICT_I64_U32: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_U08: - case EXP_DICT_I32_U16: - case EXP_DICT_I32_U32: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I16_U08: - case EXP_DICT_I16_U16: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I08_U08: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_U08_U08: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_FLT_U08: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_U08: - case EXP_DICT_DBL_U16: - case EXP_DICT_DBL_U32: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_U08: - case EXP_DICT_STR_U16: - case EXP_DICT_STR_U32: { - make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_ALP_DBL: { - make_enc_alp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_ALP_FLT: { - make_enc_alp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_GALP_FLT: { - make_enc_galp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_GALP_DBL: { - make_enc_galp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_ALP_RD_DBL: { - make_enc_alp_rd_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_ALP_RD_FLT: { - make_enc_alp_rd_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST: { - make_fsst_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12: { - make_fsst_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_U32: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_U16: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_U08: { - make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U32: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U16: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U08: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - - case EXP_RLE_DBL_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_FLT_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I64_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I32_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I16_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I08_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_U08_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_STR_U16: { - make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DELTA: { - make_fsst_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DELTA: { - make_fsst_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DELTA_I64: { - make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DELTA_I32: { - make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DELTA_I16: { - make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DELTA_I08: { - make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DELTA_U08: { - make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_SLPATCH_I64: { - make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_SLPATCH_I32: { - make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_SLPATCH_I16: { - make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_SLPATCH_I08: { - make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FFOR_SLPATCH_U08: { - make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_SLPATCH_U32: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_SLPATCH_U32: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I32_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U32: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I16_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I08_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I16_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_I64_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_FLT_FFOR_SLPATCH_U08: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_FLT_FFOR_SLPATCH_U16: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U32: { - make_enc_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U32: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U16: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U08: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U32: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U16: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U08: { - make_enc_fsst_dict_ffor_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_NULL_DBL: { - make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_NULL_FLT: { - make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_NULL_I16: { - make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_NULL_I32: { - make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I64_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I32_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I16_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_I08_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_U08_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_STR_SLPATCH_U16: { - make_enc_rle_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_DBL_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_RLE_FLT_SLPATCH_U16: { - make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DICT_STR_U32: - case EXP_FSST_DICT_STR_U16: - case EXP_FSST_DICT_STR_U08: { - make_enc_fsst_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST_DELTA_SLPATCH: { - make_enc_fsst_delta_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DELTA_SLPATCH: { - make_enc_fsst_delta_slpatch_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case WIZARD_DICTIONARY_ENCODE: { - FLS_UNREACHABLE() - } - case EXP_FSST12_DICT_STR_U32: - case EXP_FSST12_DICT_STR_U16: - case EXP_FSST12_DICT_STR_U08: { - make_enc_fsst_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U32: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U16: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U08: { - make_enc_fsst_dict_ffor_expr( - *physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_DBL: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_FLT: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_I08: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_U08: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_I16: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_I32: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_I64: { - make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_FREQUENCY_STR: { - make_enc_frequency_str_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_I08: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_U08: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_I16: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_I32: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_I64: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_DBL: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_FLT: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_CROSS_RLE_STR: { - make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case EXP_VALIDITY_MASK: { - make_enc_validitymask_expr(*physical_expr, physical_rowgroup, column_descriptor, state); - break; - } - case INVALID: - default: - throw_not_supported_exception(operator_token); - FLS_UNREACHABLE(); - } - } - - return physical_expr; -} // namespace fastlanes - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_uncompressed_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_uncompressed_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - const InterpreterState& /*state*/) { - const auto* rpn = column_view.column_descriptor.encoding_rpn(); - FLS_ASSERT_NOT_NULL_POINTER(rpn); - - const auto* operands = rpn->operand_tokens(); - FLS_ASSERT_NOT_NULL_POINTER(operands); - - FLS_ASSERT_E(operands->size(), 1); - - const uint64_t last = operands->Get(operands->size() - 1); - - physical_expr.operators.emplace_back(std::make_shared>(column_view, last)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_validitymask_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_validitymask_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - const InterpreterState& /*state*/) { - const auto* rpn = column_view.column_descriptor.encoding_rpn(); - FLS_ASSERT_NOT_NULL_POINTER(rpn); - - const auto* operands = rpn->operand_tokens(); - FLS_ASSERT_NOT_NULL_POINTER(operands); - - FLS_ASSERT_E(operands->size(), 1); - - const uint64_t last = operands->Get(operands->size() - 1); - physical_expr.operators.emplace_back(std::make_shared(column_view, last)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fls_str_uncompressed_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_fls_str_uncompressed_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - const auto* rpn = column_view.column_descriptor.encoding_rpn(); - FLS_ASSERT_NOT_NULL_POINTER(rpn); - - physical_expr.operators.emplace_back(std::make_shared(column_view, *rpn)); - - state.cur_operator += 1; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); - state.cur_operator = state.cur_operator + 2; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_delta_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_delta_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); - state.cur_operator = state.cur_operator + 3; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_delta_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_delta_slpatch_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); - state.cur_operator = state.cur_operator + 3; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>>(column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_ffor_sl_patch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_ffor_slpatch_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_alp_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_alp_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - physical_expr.operators.emplace_back(make_shared>(column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_galp_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_galp_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_alp_rd_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_alp_rd_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - physical_expr.operators.emplace_back(make_shared>(column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_dict_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_dict_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_null_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_null_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_frequency_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_frequency_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_frequency_str_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_frequency_str_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_cross_rle_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_cross_rle_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_dict_ffor_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_dict_ffor_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_dict_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_dict_ffor_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fsst_dict_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_fsst_dict_expr(RowgroupReader& reader, - PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - const auto* rpn = column_view.column_descriptor.encoding_rpn(); - const auto* operand_tokens = rpn->operand_tokens(); - - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - physical_expr.operators.emplace_back(reader.m_expressions[static_cast(operand_tokens->Get(0))]); - physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_dict_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_dict_expr(RowgroupReader& reader, - PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - const auto* operand_tokens = column_view.column_descriptor.encoding_rpn()->operand_tokens(); - - physical_expr.operators.emplace_back( - reader.m_expressions[static_cast(operand_tokens->Get(static_cast(state.cur_operand++)))]); - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_rle_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_rle_expr(RowgroupReader& reader, - PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - state.cur_operator = 0; - - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_rle_slpatch_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_rle_slpatch_expr(RowgroupReader& reader, - PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - state.cur_operator = 0; - - physical_expr.operators.emplace_back(make_shared>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back( - make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_delta_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_delta_expr(RowgroupReader& reader, - PhysicalExpr& physical_expr, - const ColumnView& column_view, - InterpreterState& state) { - state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; - state.cur_operator = 0; - - physical_expr.operators.emplace_back(make_shared>>(column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); - physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_fls_str_uncompressed_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_expr(PhysicalExpr& physical_expr, ColumnView& column_view, InterpreterState& state) { - - physical_expr.operators.emplace_back(make_shared>(column_view)); - state.cur_operator = state.cur_operator + 1; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_constant_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -template -void make_dec_constant_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - - physical_expr.operators.emplace_back(make_shared>(column_view)); - state.cur_operator = state.cur_operator + 1; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_constant_str_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_constant_str_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { - physical_expr.operators.emplace_back(make_shared(column_view)); - state.cur_operator = state.cur_operator + 1; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_equality_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_equality_expr(PhysicalExpr& physical_expr, - RowgroupReader& reader, - const flatbuffers::Vector* operand_tokens) { - FLS_ASSERT_NOT_NULL_POINTER(operand_tokens); - FLS_ASSERT_FB_NOT_EMPTY(operand_tokens); - - const auto idx = static_cast(operand_tokens->Get(0)); - physical_expr.operators.emplace_back(reader.m_expressions[idx]->operators.back()); -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_dec_struct_expr -\*--------------------------------------------------------------------------------------------------------------------*/ -void make_dec_struct_expr(const ColumnDescriptor& column_descriptor, - const ColumnView& column_view, - PhysicalExpr& physical_expr, - InterpreterState& state, - RowgroupReader& reader) { - - physical_expr.operators.emplace_back(make_shared(column_descriptor, column_view, state, reader)); - state.cur_operator = state.cur_operator + 1; -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * Interpreter -\*--------------------------------------------------------------------------------------------------------------------*/ -void Interpreter::Decoding::Interpret(const ColumnDescriptor& column_descriptor, - const ColumnView& column_view, - PhysicalExpr& physical_expr, - InterpreterState& state, - RowgroupReader& reader) { - const auto* rpn = column_descriptor.encoding_rpn(); - FLS_ASSERT_NOT_NULL_POINTER(rpn); - - const auto* operator_tokens = rpn->operator_tokens(); - const auto* operand_tokens = rpn->operand_tokens(); - - FLS_ASSERT_NOT_NULL_POINTER(operator_tokens); - - using enum OperatorToken; // if you already use this in the switch - - for (std::uint32_t i = 0; i < operator_tokens->size(); ++i) { - const auto operator_token = operator_tokens->Get(i); - - switch (operator_token) { - case EXP_UNCOMPRESSED_I64: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_I32: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_I16: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_U08: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_DBL: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_FLT: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_STR: { - make_dec_fls_str_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_UNCOMPRESSED_I08: { - make_dec_uncompressed_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST: { - make_dec_fsst_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST_DELTA: { - make_dec_fsst_delta_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DELTA: { - make_dec_fsst_delta_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST12: { - make_dec_fsst_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_I64: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_I32: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_I16: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_I08: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_U08: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_BOOL: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_DBL: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_FLT: { - make_dec_constant_expr(physical_expr, column_view, state); - break; - } - case EXP_CONSTANT_STR: { - make_dec_constant_str_expr(physical_expr, column_view, state); - break; - } - case EXP_EQUAL: { - make_dec_equality_expr(physical_expr, reader, operand_tokens); - break; - } - case EXP_STRUCT: { - make_dec_struct_expr(column_descriptor, column_view, physical_expr, state, reader); - break; - } - case EXP_FFOR_I64: { - make_dec_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_I32: { - make_dec_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_I16: { - make_dec_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_I08: { - make_dec_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_U08: { - make_dec_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_FFOR_U32: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_FFOR_U32: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I08_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_U32: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_FLT_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_FLT_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_U32: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_U32: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_U16: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_U16: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_U16: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_I08_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_U08_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_FLT_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_U32: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_U16: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_U32: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_U16: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_U08: { - make_dec_dict_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_ALP_DBL: { - make_dec_alp_expr(physical_expr, column_view, state); - break; - } - case EXP_ALP_FLT: { - make_dec_alp_expr(physical_expr, column_view, state); - break; - } - case EXP_GALP_FLT: { - make_dec_galp_expr(physical_expr, column_view, state); - break; - } - case EXP_GALP_DBL: { - make_dec_galp_expr(physical_expr, column_view, state); - break; - } - case EXP_ALP_RD_DBL: { - make_dec_alp_rd_expr(physical_expr, column_view, state); - break; - } - case EXP_ALP_RD_FLT: { - make_dec_alp_rd_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_U32: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_U16: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_U08: { - make_dec_dict_ffor_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U32: { - make_dec_fsst_dict_ffor_expr, u32_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U16: { - make_dec_fsst_dict_ffor_expr, u16_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_U08: { - make_dec_fsst_dict_ffor_expr, u08_pt>(physical_expr, column_view, state); - break; - } - case EXP_RLE_DBL_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_FLT_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I64_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I32_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I16_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I08_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_U08_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_STR_U16: { - make_dec_rle_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DELTA_I64: { - make_dec_delta_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DELTA_I32: { - make_dec_delta_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DELTA_I16: { - make_dec_delta_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DELTA_I08: { - make_dec_delta_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_DELTA_U08: { - make_dec_delta_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_FFOR_SLPATCH_I64: { - make_dec_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_SLPATCH_I32: { - make_dec_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_SLPATCH_I16: { - make_dec_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_SLPATCH_I08: { - make_dec_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FFOR_SLPATCH_U08: { - make_dec_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U32: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_STR_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I08_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I16_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_FLT_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_FLT_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_DBL_FFOR_SLPATCH_U32: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_FFOR_SLPATCH_U08: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I32_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_DICT_I64_FFOR_SLPATCH_U16: { - make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U32: { - make_dec_fsst_dict_ffor_slpatch_expr, u32_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U16: { - make_dec_fsst_dict_ffor_slpatch_expr, u16_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_FFOR_SLPATCH_U08: { - make_dec_fsst_dict_ffor_slpatch_expr, u08_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U32: { - make_dec_fsst_dict_ffor_slpatch_expr, u32_pt>( - physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U16: { - make_dec_fsst_dict_ffor_slpatch_expr, u16_pt>( - physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U08: { - make_dec_fsst_dict_ffor_slpatch_expr, u08_pt>( - physical_expr, column_view, state); - break; - } - case EXP_NULL_DBL: { - make_dec_null_expr(physical_expr, column_view, state); - break; - } - case EXP_NULL_FLT: { - make_dec_null_expr(physical_expr, column_view, state); - break; - } - case EXP_NULL_I32: { - make_dec_null_expr(physical_expr, column_view, state); - break; - } - case EXP_NULL_I16: { - make_dec_null_expr(physical_expr, column_view, state); - break; - } - case EXP_RLE_I64_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I32_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I16_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_I08_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_U08_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_STR_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_DBL_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_RLE_FLT_SLPATCH_U16: { - make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_U32: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_U16: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST_DICT_STR_U08: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST_DELTA_SLPATCH: { - make_dec_fsst_delta_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DELTA_SLPATCH: { - make_dec_fsst_delta_slpatch_expr(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_U32: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_U16: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_U08: { - make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U32: { - make_dec_fsst_dict_ffor_expr, u32_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U16: { - make_dec_fsst_dict_ffor_expr, u16_pt>(physical_expr, column_view, state); - break; - } - case EXP_FSST12_DICT_STR_FFOR_U08: { - make_dec_fsst_dict_ffor_expr, u08_pt>(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_DBL: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_FLT: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_I08: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_U08: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_I16: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_I32: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_I64: { - make_dec_frequency_expr(physical_expr, column_view, state); - break; - } - case EXP_FREQUENCY_STR: { - make_dec_frequency_str_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_I08: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_U08: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_I16: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_I32: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_I64: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_DBL: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_FLT: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_CROSS_RLE_STR: { - make_dec_cross_rle_expr(physical_expr, column_view, state); - break; - } - case EXP_VALIDITY_MASK: { - make_dec_validitymask_expr(physical_expr, column_view, state); - break; - } - case INVALID: - default: - FLS_UNREACHABLE(); - } - } -} - -/*--------------------------------------------------------------------------------------------------------------------*\ - * make_decoding_expression -\*--------------------------------------------------------------------------------------------------------------------*/ -sp make_decoding_expression(const ColumnDescriptor& column_descriptor, - const ColumnView& column_view, - RowgroupReader& reader, - InterpreterState& state) { - auto physical_expr = make_shared(); - Interpreter::Decoding::Interpret(column_descriptor, column_view, *physical_expr, state, reader); - - return physical_expr; -} - } // namespace fastlanes diff --git a/src/expression/interpreter_decoding.cpp b/src/expression/interpreter_decoding.cpp new file mode 100644 index 00000000..9be99e2f --- /dev/null +++ b/src/expression/interpreter_decoding.cpp @@ -0,0 +1,1041 @@ +// ──────────────────────────────────────────────────────── +// | FastLanes | +// ──────────────────────────────────────────────────────── +// src/expression/interpreter_decoding.cpp +// ──────────────────────────────────────────────────────── +#include "flatbuffers/vector.h" // flatbuffers::Vector +#include "fls/common/alias.hpp" +#include "fls/common/assert.hpp" +#include "fls/common/common.hpp" +#include "fls/common/exception.hpp" +#include "fls/common/string.hpp" +#include "fls/expression/alp_expression.hpp" +#include "fls/expression/cross_rle_operator.hpp" +#include "fls/expression/data_type.hpp" +#include "fls/expression/decoding_operator.hpp" +#include "fls/expression/dict_expression.hpp" +#include "fls/expression/frequency_operator.hpp" +#include "fls/expression/fsst12_dict_operator.hpp" +#include "fls/expression/fsst12_expression.hpp" +#include "fls/expression/fsst_dict_operator.hpp" +#include "fls/expression/fsst_expression.hpp" +#include "fls/expression/interpreter.hpp" +#include "fls/expression/null_operator.hpp" +#include "fls/expression/physical_expression.hpp" +#include "fls/expression/rle_expression.hpp" +#include "fls/expression/rpn.hpp" +#include "fls/expression/rsum_operator.hpp" +#include "fls/expression/scan_operator.hpp" +#include "fls/expression/slpatch_operator.hpp" +#include "fls/expression/transpose_operator.hpp" +#include "fls/expression/validitymask_operator.hpp" +#include "fls/reader/column_view.hpp" +#include "fls/std/type_traits.hpp" +#include // size_t +#include // uint32_t, uint64_t + +namespace fastlanes { + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_uncompressed_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_uncompressed_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + const InterpreterState& /*state*/) { + const auto* rpn = column_view.column_descriptor.encoding_rpn(); + FLS_ASSERT_NOT_NULL_POINTER(rpn); + + const auto* operands = rpn->operand_tokens(); + FLS_ASSERT_NOT_NULL_POINTER(operands); + + FLS_ASSERT_E(operands->size(), 1); + + const uint64_t last = operands->Get(operands->size() - 1); + + physical_expr.operators.emplace_back(std::make_shared>(column_view, last)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_validitymask_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_validitymask_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + const InterpreterState& /*state*/) { + const auto* rpn = column_view.column_descriptor.encoding_rpn(); + FLS_ASSERT_NOT_NULL_POINTER(rpn); + + const auto* operands = rpn->operand_tokens(); + FLS_ASSERT_NOT_NULL_POINTER(operands); + + FLS_ASSERT_E(operands->size(), 1); + + const uint64_t last = operands->Get(operands->size() - 1); + physical_expr.operators.emplace_back(std::make_shared(column_view, last)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fls_str_uncompressed_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_fls_str_uncompressed_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + const auto* rpn = column_view.column_descriptor.encoding_rpn(); + FLS_ASSERT_NOT_NULL_POINTER(rpn); + + physical_expr.operators.emplace_back(std::make_shared(column_view, *rpn)); + + state.cur_operator += 1; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); + state.cur_operator = state.cur_operator + 2; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_delta_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_delta_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); + state.cur_operator = state.cur_operator + 3; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_delta_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_delta_slpatch_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); + state.cur_operator = state.cur_operator + 3; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>>(column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_ffor_sl_patch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_ffor_slpatch_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_alp_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_alp_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + physical_expr.operators.emplace_back(make_shared>(column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_galp_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_galp_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + // Note: dec_alp_opr uses hardcoded segment indices (0-7), so cur_operand is unused. + // Unlike other decoders, GALP/ALP encoding does not emit operand_tokens, so + // accessing operand_tokens() here would dereference a null pointer. + physical_expr.operators.emplace_back(make_shared>(column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_alp_rd_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_alp_rd_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + physical_expr.operators.emplace_back(make_shared>(column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_dict_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_dict_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_null_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_null_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_frequency_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_frequency_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_frequency_str_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_frequency_str_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_cross_rle_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_cross_rle_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_dict_ffor_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_dict_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_dict_ffor_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_dict_ffor_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fsst_dict_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_fsst_dict_expr(RowgroupReader& reader, + PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + const auto* rpn = column_view.column_descriptor.encoding_rpn(); + const auto* operand_tokens = rpn->operand_tokens(); + + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + physical_expr.operators.emplace_back(reader.m_expressions[static_cast(operand_tokens->Get(0))]); + physical_expr.operators.emplace_back(make_shared(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_dict_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_dict_expr(RowgroupReader& reader, + PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + const auto* operand_tokens = column_view.column_descriptor.encoding_rpn()->operand_tokens(); + + physical_expr.operators.emplace_back( + reader.m_expressions[static_cast(operand_tokens->Get(static_cast(state.cur_operand++)))]); + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_rle_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_rle_expr(RowgroupReader& reader, + PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + state.cur_operator = 0; + + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_rle_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_rle_slpatch_expr(RowgroupReader& reader, + PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + state.cur_operator = 0; + + physical_expr.operators.emplace_back(make_shared>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_delta_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_delta_expr(RowgroupReader& reader, + PhysicalExpr& physical_expr, + const ColumnView& column_view, + InterpreterState& state) { + state.cur_operand = column_view.column_descriptor.encoding_rpn()->operand_tokens()->size() - 1; + state.cur_operator = 0; + + physical_expr.operators.emplace_back(make_shared>>(column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); + physical_expr.operators.emplace_back(make_shared>(physical_expr, column_view, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_fls_str_uncompressed_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_expr(PhysicalExpr& physical_expr, ColumnView& column_view, InterpreterState& state) { + + physical_expr.operators.emplace_back(make_shared>(column_view)); + state.cur_operator = state.cur_operator + 1; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_constant_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_dec_constant_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + + physical_expr.operators.emplace_back(make_shared>(column_view)); + state.cur_operator = state.cur_operator + 1; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_constant_str_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_constant_str_expr(PhysicalExpr& physical_expr, const ColumnView& column_view, InterpreterState& state) { + physical_expr.operators.emplace_back(make_shared(column_view)); + state.cur_operator = state.cur_operator + 1; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_equality_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_equality_expr(PhysicalExpr& physical_expr, + RowgroupReader& reader, + const flatbuffers::Vector* operand_tokens) { + FLS_ASSERT_NOT_NULL_POINTER(operand_tokens); + FLS_ASSERT_FB_NOT_EMPTY(operand_tokens); + + const auto idx = static_cast(operand_tokens->Get(0)); + physical_expr.operators.emplace_back(reader.m_expressions[idx]->operators.back()); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_dec_struct_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_dec_struct_expr(const ColumnDescriptor& column_descriptor, + const ColumnView& column_view, + PhysicalExpr& physical_expr, + InterpreterState& state, + RowgroupReader& reader) { + + physical_expr.operators.emplace_back(make_shared(column_descriptor, column_view, state, reader)); + state.cur_operator = state.cur_operator + 1; +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * Interpreter +\*--------------------------------------------------------------------------------------------------------------------*/ +void Interpreter::Decoding::Interpret(const ColumnDescriptor& column_descriptor, + const ColumnView& column_view, + PhysicalExpr& physical_expr, + InterpreterState& state, + RowgroupReader& reader) { + const auto* rpn = column_descriptor.encoding_rpn(); + FLS_ASSERT_NOT_NULL_POINTER(rpn); + + const auto* operator_tokens = rpn->operator_tokens(); + const auto* operand_tokens = rpn->operand_tokens(); + + FLS_ASSERT_NOT_NULL_POINTER(operator_tokens); + + using enum OperatorToken; // if you already use this in the switch + + for (std::uint32_t i = 0; i < operator_tokens->size(); ++i) { + const auto operator_token = operator_tokens->Get(i); + + switch (operator_token) { + case EXP_UNCOMPRESSED_I64: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_I32: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_I16: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_U08: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_DBL: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_FLT: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_STR: { + make_dec_fls_str_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_UNCOMPRESSED_I08: { + make_dec_uncompressed_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST: { + make_dec_fsst_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST_DELTA: { + make_dec_fsst_delta_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DELTA: { + make_dec_fsst_delta_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST12: { + make_dec_fsst_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_I64: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_I32: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_I16: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_I08: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_U08: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_BOOL: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_DBL: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_FLT: { + make_dec_constant_expr(physical_expr, column_view, state); + break; + } + case EXP_CONSTANT_STR: { + make_dec_constant_str_expr(physical_expr, column_view, state); + break; + } + case EXP_EQUAL: { + make_dec_equality_expr(physical_expr, reader, operand_tokens); + break; + } + case EXP_STRUCT: { + make_dec_struct_expr(column_descriptor, column_view, physical_expr, state, reader); + break; + } + case EXP_FFOR_I64: { + make_dec_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_I32: { + make_dec_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_I16: { + make_dec_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_I08: { + make_dec_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_U08: { + make_dec_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_FFOR_U32: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_FFOR_U32: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I08_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_U32: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_FLT_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_FLT_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_U32: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_U32: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_U16: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_U16: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_U16: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_I08_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_U08_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_FLT_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_U32: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_U16: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_U32: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_U16: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_U08: { + make_dec_dict_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_ALP_DBL: { + make_dec_alp_expr(physical_expr, column_view, state); + break; + } + case EXP_ALP_FLT: { + make_dec_alp_expr(physical_expr, column_view, state); + break; + } + case EXP_GALP_FLT: { + make_dec_galp_expr(physical_expr, column_view, state); + break; + } + case EXP_GALP_DBL: { + make_dec_galp_expr(physical_expr, column_view, state); + break; + } + case EXP_ALP_RD_DBL: { + make_dec_alp_rd_expr(physical_expr, column_view, state); + break; + } + case EXP_ALP_RD_FLT: { + make_dec_alp_rd_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_U32: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_U16: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_U08: { + make_dec_dict_ffor_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U32: { + make_dec_fsst_dict_ffor_expr, u32_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U16: { + make_dec_fsst_dict_ffor_expr, u16_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U08: { + make_dec_fsst_dict_ffor_expr, u08_pt>(physical_expr, column_view, state); + break; + } + case EXP_RLE_DBL_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_FLT_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I64_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I32_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I16_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I08_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_U08_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_STR_U16: { + make_dec_rle_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DELTA_I64: { + make_dec_delta_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DELTA_I32: { + make_dec_delta_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DELTA_I16: { + make_dec_delta_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DELTA_I08: { + make_dec_delta_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_DELTA_U08: { + make_dec_delta_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_FFOR_SLPATCH_I64: { + make_dec_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_SLPATCH_I32: { + make_dec_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_SLPATCH_I16: { + make_dec_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_SLPATCH_I08: { + make_dec_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FFOR_SLPATCH_U08: { + make_dec_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U32: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I08_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I16_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_FLT_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_FLT_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U32: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_FFOR_SLPATCH_U08: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I32_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_DICT_I64_FFOR_SLPATCH_U16: { + make_dec_dict_ffor_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U32: { + make_dec_fsst_dict_ffor_slpatch_expr, u32_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U16: { + make_dec_fsst_dict_ffor_slpatch_expr, u16_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U08: { + make_dec_fsst_dict_ffor_slpatch_expr, u08_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U32: { + make_dec_fsst_dict_ffor_slpatch_expr, u32_pt>( + physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U16: { + make_dec_fsst_dict_ffor_slpatch_expr, u16_pt>( + physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U08: { + make_dec_fsst_dict_ffor_slpatch_expr, u08_pt>( + physical_expr, column_view, state); + break; + } + case EXP_NULL_DBL: { + make_dec_null_expr(physical_expr, column_view, state); + break; + } + case EXP_NULL_FLT: { + make_dec_null_expr(physical_expr, column_view, state); + break; + } + case EXP_NULL_I32: { + make_dec_null_expr(physical_expr, column_view, state); + break; + } + case EXP_NULL_I16: { + make_dec_null_expr(physical_expr, column_view, state); + break; + } + case EXP_RLE_I64_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I32_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I16_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_I08_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_U08_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_STR_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_DBL_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_RLE_FLT_SLPATCH_U16: { + make_dec_rle_slpatch_expr(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_U32: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_U16: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST_DICT_STR_U08: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST_DELTA_SLPATCH: { + make_dec_fsst_delta_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DELTA_SLPATCH: { + make_dec_fsst_delta_slpatch_expr(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_U32: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_U16: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_U08: { + make_dec_fsst_dict_expr>(reader, physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U32: { + make_dec_fsst_dict_ffor_expr, u32_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U16: { + make_dec_fsst_dict_ffor_expr, u16_pt>(physical_expr, column_view, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U08: { + make_dec_fsst_dict_ffor_expr, u08_pt>(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_DBL: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_FLT: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_I08: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_U08: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_I16: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_I32: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_I64: { + make_dec_frequency_expr(physical_expr, column_view, state); + break; + } + case EXP_FREQUENCY_STR: { + make_dec_frequency_str_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_I08: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_U08: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_I16: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_I32: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_I64: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_DBL: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_FLT: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_CROSS_RLE_STR: { + make_dec_cross_rle_expr(physical_expr, column_view, state); + break; + } + case EXP_VALIDITY_MASK: { + make_dec_validitymask_expr(physical_expr, column_view, state); + break; + } + case INVALID: + default: + FLS_UNREACHABLE(); + } + } +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_decoding_expression +\*--------------------------------------------------------------------------------------------------------------------*/ +sp make_decoding_expression(const ColumnDescriptor& column_descriptor, + const ColumnView& column_view, + RowgroupReader& reader, + InterpreterState& state) { + auto physical_expr = make_shared(); + Interpreter::Decoding::Interpret(column_descriptor, column_view, *physical_expr, state, reader); + + return physical_expr; +} + +} // namespace fastlanes diff --git a/src/expression/interpreter_encoding.cpp b/src/expression/interpreter_encoding.cpp new file mode 100644 index 00000000..84d7d147 --- /dev/null +++ b/src/expression/interpreter_encoding.cpp @@ -0,0 +1,1045 @@ +// ──────────────────────────────────────────────────────── +// | FastLanes | +// ──────────────────────────────────────────────────────── +// src/expression/interpreter_encoding.cpp +// ──────────────────────────────────────────────────────── +#include "fls/common/alias.hpp" +#include "fls/common/common.hpp" +#include "fls/common/exception.hpp" +#include "fls/common/string.hpp" +#include "fls/expression/alp_expression.hpp" +#include "fls/expression/analyze_operator.hpp" +#include "fls/expression/cross_rle_operator.hpp" +#include "fls/expression/data_parallelize_patch_operator.hpp" +#include "fls/expression/data_type.hpp" +#include "fls/expression/dict_expression.hpp" +#include "fls/expression/encoding_operator.hpp" +#include "fls/expression/frequency_operator.hpp" +#include "fls/expression/fsst12_dict_operator.hpp" +#include "fls/expression/fsst12_expression.hpp" +#include "fls/expression/fsst_dict_operator.hpp" +#include "fls/expression/fsst_expression.hpp" +#include "fls/expression/interpreter.hpp" +#include "fls/expression/null_operator.hpp" +#include "fls/expression/physical_expression.hpp" +#include "fls/expression/rle_expression.hpp" +#include "fls/expression/rpn.hpp" +#include "fls/expression/rsum_operator.hpp" +#include "fls/expression/scan_operator.hpp" +#include "fls/expression/slpatch_operator.hpp" +#include "fls/expression/transpose_operator.hpp" +#include "fls/expression/validitymask_operator.hpp" +#include "fls/std/type_traits.hpp" +#include "fls/table/rowgroup.hpp" + +namespace fastlanes { +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_uncompressed_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_uncompressed_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; + operand_tokens.emplace_back(0); + + const auto& column = rowgroup[column_descriptor.idx]; + physical_expr.operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_validitymask_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_enc_validitymask_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; + operand_tokens.emplace_back(0); + + const auto& column = rowgroup[column_descriptor.idx]; + physical_expr.operators.emplace_back( + make_shared(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_struct_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_enc_struct_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + const auto& col = rowgroup[column_descriptor.idx]; + + physical_expr.operators.emplace_back(make_shared(col, column_descriptor)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_fls_str_uncompressed_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_fls_str_uncompressed_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; + operand_tokens.emplace_back(0); + operand_tokens.emplace_back(1); + + const auto& column = rowgroup[column_descriptor.idx]; + physical_expr.operators.emplace_back(make_shared(column)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_fsst_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_fsst_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + physical_expr.operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_fsst_delta_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_fsst_delta_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_fsst_delta_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_fsst_delta_slpatch_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_ffor_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_ffor_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_ffor_slpatch_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_null_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_null_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_null_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_frequency_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * enc_frequency_str_opr +\*--------------------------------------------------------------------------------------------------------------------*/ +void make_enc_frequency_str_opr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_cross_rle_opr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_cross_rle_opr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + const auto& column = rowgroup[column_descriptor.idx]; + auto& operators = physical_expr.operators; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_dict_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_dict_ffor_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_dict_ffor_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_fsst_dict_ffor_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_fsst_dict_ffor_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_fsst_dict_ffor_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_fsst_dict_ffor_slpatch_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_fsst_dict_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_fsst_dict_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_enc_dict_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_dict_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_alp_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_alp_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_galp_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_galp_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_rle_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_rle_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_rle_slpatch_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_rle_slpatch_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_delta_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_delta_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); + operators.emplace_back( + make_shared>>(physical_expr, column, column_descriptor, state)); +} +/*--------------------------------------------------------------------------------------------------------------------*\ + * make_alp_expr +\*--------------------------------------------------------------------------------------------------------------------*/ +template +void make_enc_alp_rd_expr(PhysicalExpr& physical_expr, + const rowgroup_pt& rowgroup, + ColumnDescriptorT& column_descriptor, + InterpreterState& state) { + auto& operators = physical_expr.operators; + const auto& column = rowgroup[column_descriptor.idx]; + + operators.emplace_back(make_shared>(physical_expr, column, column_descriptor, state)); +} + +/*--------------------------------------------------------------------------------------------------------------------*\ + * Interpreter::Encoding +\*--------------------------------------------------------------------------------------------------------------------*/ + +sp Interpreter::Encoding::Interpret(ColumnDescriptorT& column_descriptor, + const rowgroup_pt& physical_rowgroup, + InterpreterState& state) { + // return + auto physical_expr = make_shared(); + + auto& [operator_tokens, operand_tokens] = *column_descriptor.encoding_rpn; + for (const auto& operator_token : operator_tokens) { + using enum OperatorToken; + switch (operator_token) { + case EXP_UNCOMPRESSED_I64: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_I32: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_I16: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_U08: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_I64: { + make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_I32: { + make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_I16: { + make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_I08: { + make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_U08: { + make_enc_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_DBL: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_FLT: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_I08: { + make_enc_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_UNCOMPRESSED_STR: { + make_fls_str_uncompressed_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CONSTANT_DBL: + case EXP_CONSTANT_I64: + case EXP_CONSTANT_I32: + case EXP_CONSTANT_I16: + case EXP_CONSTANT_I08: + case EXP_CONSTANT_STR: + case EXP_CONSTANT_U08: + case EXP_CONSTANT_FLT: + case EXP_CONSTANT_BOOL: + case EXP_EQUAL: { + break; + } + case EXP_STRUCT: { + make_enc_struct_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_U32: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_U32: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I16_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_U32: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I16_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I08_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_FLT_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_FLT_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_U08: + case EXP_DICT_I64_U16: + case EXP_DICT_I64_U32: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_U08: + case EXP_DICT_I32_U16: + case EXP_DICT_I32_U32: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I16_U08: + case EXP_DICT_I16_U16: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I08_U08: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_U08_U08: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_FLT_U08: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_U08: + case EXP_DICT_DBL_U16: + case EXP_DICT_DBL_U32: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_U08: + case EXP_DICT_STR_U16: + case EXP_DICT_STR_U32: { + make_enc_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_ALP_DBL: { + make_enc_alp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_ALP_FLT: { + make_enc_alp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_GALP_FLT: { + make_enc_galp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_GALP_DBL: { + make_enc_galp_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_ALP_RD_DBL: { + make_enc_alp_rd_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_ALP_RD_FLT: { + make_enc_alp_rd_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST: { + make_fsst_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12: { + make_fsst_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_U32: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_U16: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_U08: { + make_enc_dict_ffor_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U32: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U16: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_U08: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + + case EXP_RLE_DBL_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_FLT_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I64_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I32_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I16_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I08_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_U08_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_STR_U16: { + make_enc_rle_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DELTA: { + make_fsst_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DELTA: { + make_fsst_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DELTA_I64: { + make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DELTA_I32: { + make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DELTA_I16: { + make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DELTA_I08: { + make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DELTA_U08: { + make_enc_delta_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_SLPATCH_I64: { + make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_SLPATCH_I32: { + make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_SLPATCH_I16: { + make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_SLPATCH_I08: { + make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FFOR_SLPATCH_U08: { + make_enc_ffor_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_SLPATCH_U32: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_SLPATCH_U32: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I32_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U32: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_STR_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I16_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I08_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I16_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_I64_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_FLT_FFOR_SLPATCH_U08: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_FLT_FFOR_SLPATCH_U16: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_DICT_DBL_FFOR_SLPATCH_U32: { + make_enc_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U32: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U16: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_FFOR_SLPATCH_U08: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U32: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U16: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_SLPATCH_U08: { + make_enc_fsst_dict_ffor_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_NULL_DBL: { + make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_NULL_FLT: { + make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_NULL_I16: { + make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_NULL_I32: { + make_enc_null_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I64_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I32_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I16_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_I08_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_U08_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_STR_SLPATCH_U16: { + make_enc_rle_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_DBL_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_RLE_FLT_SLPATCH_U16: { + make_enc_rle_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DICT_STR_U32: + case EXP_FSST_DICT_STR_U16: + case EXP_FSST_DICT_STR_U08: { + make_enc_fsst_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST_DELTA_SLPATCH: { + make_enc_fsst_delta_slpatch_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DELTA_SLPATCH: { + make_enc_fsst_delta_slpatch_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case WIZARD_DICTIONARY_ENCODE: { + FLS_UNREACHABLE() + } + case EXP_FSST12_DICT_STR_U32: + case EXP_FSST12_DICT_STR_U16: + case EXP_FSST12_DICT_STR_U08: { + make_enc_fsst_dict_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U32: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U16: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FSST12_DICT_STR_FFOR_U08: { + make_enc_fsst_dict_ffor_expr( + *physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_DBL: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_FLT: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_I08: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_U08: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_I16: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_I32: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_I64: { + make_enc_frequency_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_FREQUENCY_STR: { + make_enc_frequency_str_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_I08: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_U08: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_I16: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_I32: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_I64: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_DBL: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_FLT: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_CROSS_RLE_STR: { + make_enc_cross_rle_opr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case EXP_VALIDITY_MASK: { + make_enc_validitymask_expr(*physical_expr, physical_rowgroup, column_descriptor, state); + break; + } + case INVALID: + default: + throw_not_supported_exception(operator_token); + FLS_UNREACHABLE(); + } + } + + return physical_expr; +} + +} // namespace fastlanes diff --git a/src/expression/rle_expression.cpp b/src/expression/rle_expression.cpp index a98c00a9..da20a2fa 100644 --- a/src/expression/rle_expression.cpp +++ b/src/expression/rle_expression.cpp @@ -17,6 +17,8 @@ #include "fls/std/vector.hpp" #include "fls/table/rowgroup.hpp" #include "fls_gen/untranspose/untranspose.hpp" +#include // for std::max +#include // for size_t #include #include #include // for std::monostate @@ -213,7 +215,9 @@ void dec_rle_map_opr::Decode(n_t vec_idx, length_pointer[val_idx] = next_offset - cur_ofs; if (byte_arr_vec.capacity() - byte_arr_vec.size() < CFG::String::max_bytes_per_string) { - byte_arr_vec.reserve(byte_arr_vec.size() + 1024 * CFG::String::max_bytes_per_string); + byte_arr_vec.reserve( + std::max(byte_arr_vec.capacity() * 2, + byte_arr_vec.size() + static_cast(CFG::String::max_bytes_per_string))); } byte_arr_vec.insert(byte_arr_vec.end(), bytes + cur_ofs, bytes + next_offset); } diff --git a/src/include/alp/decoder.hpp b/src/include/alp/decoder.hpp index 0d0d5b1f..b0104a21 100644 --- a/src/include/alp/decoder.hpp +++ b/src/include/alp/decoder.hpp @@ -9,10 +9,11 @@ #include "alp/common.hpp" #include "alp/config.hpp" #include "alp/state.hpp" +#include "fls/compiler.hpp" #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion" +FLS_DIAG_PUSH +FLS_DIAG_IGNORE_INT_FLOAT_CONV namespace alp { @@ -113,7 +114,8 @@ struct decoder { //! Scalar decoding a single value with ALP static inline PT decode_value(const ST encoded_value, const uint8_t factor, const uint8_t exponent) { - const PT decoded_value = encoded_value * Constants::FACT_ARR[factor] * Constants::FRAC_ARR[exponent]; + const PT decoded_value = + static_cast(encoded_value) * Constants::FACT_ARR[factor] * Constants::FRAC_ARR[exponent]; return decoded_value; } @@ -135,6 +137,6 @@ struct decoder { } // namespace alp -#pragma GCC diagnostic pop +FLS_DIAG_POP #endif // ALP_DECODER_HPP diff --git a/src/include/alp/rd.hpp b/src/include/alp/rd.hpp index e3181b56..00208045 100644 --- a/src/include/alp/rd.hpp +++ b/src/include/alp/rd.hpp @@ -10,12 +10,13 @@ #include "alp/constants.hpp" #include "alp/encoder.hpp" #include "alp/sampler.hpp" +#include "fls/compiler.hpp" #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wfloat-conversion" -#pragma GCC diagnostic ignored "-Wimplicit-int-conversion" +FLS_DIAG_PUSH +FLS_DIAG_IGNORE_SIGN_CONV +FLS_DIAG_IGNORE_FLOAT_CONV +FLS_DIAG_IGNORE_INT_CONV namespace alp { @@ -188,6 +189,6 @@ struct rd_encoder { } // namespace alp -#pragma GCC diagnostic pop +FLS_DIAG_POP #endif // ALP_RD_HPP diff --git a/src/include/fls/common/decimal.hpp b/src/include/fls/common/decimal.hpp index 89a07398..da8e0ee9 100644 --- a/src/include/fls/common/decimal.hpp +++ b/src/include/fls/common/decimal.hpp @@ -6,13 +6,14 @@ #ifndef FLS_COMMON_DECIMAL_HPP #define FLS_COMMON_DECIMAL_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" #include "fls/footer/decimal_type_generated.h" namespace fastlanes { -int64_t make_decimal(const std::string& value, n_t scale); -up make_decimal_t(const std::string& value); +FLS_API int64_t make_decimal(const std::string& value, n_t scale); +FLS_API up make_decimal_t(const std::string& value); } // namespace fastlanes diff --git a/src/include/fls/common/double.hpp b/src/include/fls/common/double.hpp index 235122e5..5d953e6d 100644 --- a/src/include/fls/common/double.hpp +++ b/src/include/fls/common/double.hpp @@ -6,10 +6,11 @@ #ifndef FLS_COMMON_DOUBLE_HPP #define FLS_COMMON_DOUBLE_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" namespace fastlanes { -class Double { +class FLS_API Double { public: static bool is_safely_castable_to_int64(dbl_pt value); }; diff --git a/src/include/fls/common/status.hpp b/src/include/fls/common/status.hpp index 14e1e706..e7b65474 100644 --- a/src/include/fls/common/status.hpp +++ b/src/include/fls/common/status.hpp @@ -6,11 +6,12 @@ #ifndef FOR_NOW_ERROR_HPP #define FOR_NOW_ERROR_HPP +#include "fls/api/api.hpp" #include "fls/std/string.hpp" namespace fastlanes { -class Status { +class FLS_API Status { public: enum class ErrorCode { Ok, diff --git a/src/include/fls/compiler.hpp b/src/include/fls/compiler.hpp new file mode 100644 index 00000000..3fb52c39 --- /dev/null +++ b/src/include/fls/compiler.hpp @@ -0,0 +1,104 @@ +// ──────────────────────────────────────────────────────── +// | FastLanes | +// ──────────────────────────────────────────────────────── +// src/include/fls/compiler.hpp +// ──────────────────────────────────────────────────────── +// Compiler-portability macros for Clang, GCC, and MSVC. +// ──────────────────────────────────────────────────────── +#ifndef FLS_COMPILER_HPP +#define FLS_COMPILER_HPP + +#include + +// ── Vectorize-loop pragmas ────────────────────────────── +// Clang's auto-vectorizer hint. MSVC has no direct equivalent; +// its auto-vectorizer runs unconditionally at /O2. +#if defined(__clang__) +#define FLS_PRAGMA_VECTORIZE _Pragma("clang loop vectorize(enable)") +#elif defined(__GNUC__) +#define FLS_PRAGMA_VECTORIZE _Pragma("GCC ivdep") +#else +#define FLS_PRAGMA_VECTORIZE +#endif + +// Clang vectorize-width hint (e.g. FLS_PRAGMA_VECTORIZE_WIDTH(64)). +#if defined(__clang__) +#define FLS_PRAGMA_VECTORIZE_WIDTH_IMPL(s) _Pragma(#s) +#define FLS_PRAGMA_VECTORIZE_WIDTH(n) FLS_PRAGMA_VECTORIZE_WIDTH_IMPL(clang loop vectorize_width(n)) +#else +#define FLS_PRAGMA_VECTORIZE_WIDTH(n) +#endif + +// ── MSVC compat for __restrict__ and __builtin_ctzl ───── +#if defined(_MSC_VER) && !defined(__clang__) +#include +#ifndef __restrict__ +#define __restrict__ +#endif +#ifndef __BYTE_ORDER__ +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __ORDER_LITTLE_ENDIAN__ 2 +#endif +static __forceinline int __builtin_ctzl(unsigned long long x) { + unsigned long ret; + _BitScanForward64(&ret, x); + return (int)ret; +} +#elif defined(_MSC_VER) && defined(__clang__) +#include +#endif + +// ── Count Leading Zeros ───────────────────────────────── +#if defined(_MSC_VER) +static inline int fls_clzll(uint64_t x) { + unsigned long idx; + _BitScanReverse64(&idx, x); + return 63 - static_cast(idx); +} +static inline int fls_clz(uint32_t x) { + unsigned long idx; + _BitScanReverse(&idx, x); + return 31 - static_cast(idx); +} +#else +static inline int fls_clzll(uint64_t x) { + return __builtin_clzll(x); +} +static inline int fls_clz(uint32_t x) { + return __builtin_clz(x); +} +#endif + +// ── Diagnostic push / pop / ignore ────────────────────── +// Check __clang__ before _MSC_VER because clang-cl defines both, +// but uses clang-style diagnostics, not MSVC warning numbers. +#if defined(__clang__) +#define FLS_DIAG_PUSH _Pragma("clang diagnostic push") +#define FLS_DIAG_POP _Pragma("clang diagnostic pop") +#define FLS_DIAG_IGNORE_SIGN_CONV _Pragma("clang diagnostic ignored \"-Wsign-conversion\"") +#define FLS_DIAG_IGNORE_FLOAT_CONV _Pragma("clang diagnostic ignored \"-Wfloat-conversion\"") +#define FLS_DIAG_IGNORE_CONVERSION _Pragma("clang diagnostic ignored \"-Wconversion\"") +#define FLS_DIAG_IGNORE_SHORTEN_64_32 _Pragma("clang diagnostic ignored \"-Wshorten-64-to-32\"") +#define FLS_DIAG_IGNORE_INT_FLOAT_CONV _Pragma("clang diagnostic ignored \"-Wimplicit-int-float-conversion\"") +#define FLS_DIAG_IGNORE_INT_CONV _Pragma("clang diagnostic ignored \"-Wimplicit-int-conversion\"") +#elif defined(_MSC_VER) +#define FLS_DIAG_PUSH __pragma(warning(push)) +#define FLS_DIAG_POP __pragma(warning(pop)) +#define FLS_DIAG_IGNORE_SIGN_CONV __pragma(warning(disable : 4245 4365)) +#define FLS_DIAG_IGNORE_FLOAT_CONV __pragma(warning(disable : 4244)) +#define FLS_DIAG_IGNORE_CONVERSION __pragma(warning(disable : 4244 4267)) +#define FLS_DIAG_IGNORE_SHORTEN_64_32 +#define FLS_DIAG_IGNORE_INT_FLOAT_CONV __pragma(warning(disable : 4244)) +#define FLS_DIAG_IGNORE_INT_CONV __pragma(warning(disable : 4244 4267)) +#elif defined(__GNUC__) +#define FLS_DIAG_PUSH _Pragma("GCC diagnostic push") +#define FLS_DIAG_POP _Pragma("GCC diagnostic pop") +#define FLS_DIAG_IGNORE_SIGN_CONV _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") +#define FLS_DIAG_IGNORE_FLOAT_CONV _Pragma("GCC diagnostic ignored \"-Wfloat-conversion\"") +#define FLS_DIAG_IGNORE_CONVERSION _Pragma("GCC diagnostic ignored \"-Wconversion\"") +#define FLS_DIAG_IGNORE_SHORTEN_64_32 +#define FLS_DIAG_IGNORE_INT_FLOAT_CONV _Pragma("GCC diagnostic ignored \"-Wfloat-conversion\"") +#define FLS_DIAG_IGNORE_INT_CONV _Pragma("GCC diagnostic ignored \"-Wconversion\"") +#endif + +#endif // FLS_COMPILER_HPP diff --git a/src/include/fls/connection.hpp b/src/include/fls/connection.hpp index f0e37424..88ebcdcf 100644 --- a/src/include/fls/connection.hpp +++ b/src/include/fls/connection.hpp @@ -28,7 +28,7 @@ class Dir; /*--------------------------------------------------------------------------------------------------------------------*\ * Config \*--------------------------------------------------------------------------------------------------------------------*/ -class Config { +class FLS_API Config { public: Config(); @@ -62,6 +62,11 @@ class FLS_API Connection { Connection(); explicit Connection(const Config& config); + Connection(const Connection&) = delete; + Connection& operator=(const Connection&) = delete; + Connection(Connection&&) = default; + Connection& operator=(Connection&&) = default; + public: /// READ CSV Connection& read_csv(const path& dir_path); diff --git a/src/include/fls/cor/lyt/buf.hpp b/src/include/fls/cor/lyt/buf.hpp index 7c22920f..a36f9841 100644 --- a/src/include/fls/cor/lyt/buf.hpp +++ b/src/include/fls/cor/lyt/buf.hpp @@ -6,11 +6,12 @@ #ifndef FLS_COR_LYT_BUF_HPP #define FLS_COR_LYT_BUF_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" #include "fls/std/span.hpp" namespace fastlanes { -class Buf { +class FLS_API Buf { public: // fixed size buffer; explicit Buf(); diff --git a/src/include/fls/cor/prm/fsst/fsst.h b/src/include/fls/cor/prm/fsst/fsst.h index 7b85d603..d027091f 100644 --- a/src/include/fls/cor/prm/fsst/fsst.h +++ b/src/include/fls/cor/prm/fsst/fsst.h @@ -62,15 +62,7 @@ #define FSST_INCLUDED_H #ifdef _MSC_VER -#define __restrict__ -#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ -#define __ORDER_LITTLE_ENDIAN__ 2 -#include -static inline int __builtin_ctzl(unsigned long long x) { - unsigned long ret; - _BitScanForward64(&ret, x); - return (int)ret; -} +#include "fls/compiler.hpp" #endif #ifdef __cplusplus diff --git a/src/include/fls/cor/prm/fsst/libfsst.hpp b/src/include/fls/cor/prm/fsst/libfsst.hpp index 25cd5793..984b4817 100644 --- a/src/include/fls/cor/prm/fsst/libfsst.hpp +++ b/src/include/fls/cor/prm/fsst/libfsst.hpp @@ -7,7 +7,8 @@ #define FLS_COR_PRM_FSST_LIBFSST_HPP // NOLINTBEGIN -#pragma clang diagnostic ignored "-Wconversion" +#include "fls/compiler.hpp" +FLS_DIAG_IGNORE_CONVERSION // this software is distributed under the MIT License (http://www.opensource.org/licenses/MIT): // diff --git a/src/include/fls/cor/prm/fsst12/fsst12.h b/src/include/fls/cor/prm/fsst12/fsst12.h index d7a5e87f..5aee8179 100644 --- a/src/include/fls/cor/prm/fsst12/fsst12.h +++ b/src/include/fls/cor/prm/fsst12/fsst12.h @@ -62,6 +62,10 @@ #ifndef FSST12_INCLUDED_H #define FSST12_INCLUDED_H +#ifdef _MSC_VER +#include "fls/compiler.hpp" +#endif + #include "assert.h" using ulong = unsigned long; @@ -140,9 +144,9 @@ fsst12_decompress(fsst12_decoder_t* decoder, /* IN: use this dictionary for comp unsigned long size, /* IN: byte-length of output buffer. */ unsigned char* output /* OUT: memory buffer to put the decompressed string in. */ ) { - unsigned char* __restrict__ len = (unsigned char* __restrict__)decoder->len; - unsigned long* __restrict__ symbol = (unsigned long* __restrict__)decoder->symbol; - unsigned char* __restrict__ strOut = (unsigned char* __restrict__)output; + unsigned char* __restrict__ len = (unsigned char* __restrict__)decoder->len; + unsigned long long* __restrict__ symbol = (unsigned long long* __restrict__)decoder->symbol; + unsigned char* __restrict__ strOut = (unsigned char* __restrict__)output; unsigned long posOut = 0, posIn = 0; #define FSST12_UNALIGNED_STORE(dst, src) memcpy((unsigned long long*)(dst), &(src), sizeof(unsigned long long)) while (posIn + 3 <= lenIn) { diff --git a/src/include/fls/cor/prm/fsst12/libfsst12.hpp b/src/include/fls/cor/prm/fsst12/libfsst12.hpp index 8981dd3f..7975901f 100644 --- a/src/include/fls/cor/prm/fsst12/libfsst12.hpp +++ b/src/include/fls/cor/prm/fsst12/libfsst12.hpp @@ -7,8 +7,9 @@ #define FLS_COR_PRM_FSST12_LIBFSST12_HPP // NOLINTBEGIN -#pragma clang diagnostic ignored "-Wconversion" -#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#include "fls/compiler.hpp" +FLS_DIAG_IGNORE_CONVERSION +FLS_DIAG_IGNORE_SHORTEN_64_32 // this software is distributed under the MIT License (http://www.opensource.org/licenses/MIT): // diff --git a/src/include/fls/csv/csv-parser/parser.hpp b/src/include/fls/csv/csv-parser/parser.hpp index 8247973a..67b3358a 100644 --- a/src/include/fls/csv/csv-parser/parser.hpp +++ b/src/include/fls/csv/csv-parser/parser.hpp @@ -14,7 +14,8 @@ #ifndef ARIA_CSV_H #define ARIA_CSV_H -#pragma clang diagnostic ignored "-Wconversion" +#include "fls/compiler.hpp" +FLS_DIAG_IGNORE_CONVERSION #include #include diff --git a/src/include/fls/encoder/assert_eq.hpp b/src/include/fls/encoder/assert_eq.hpp index 9a0136a5..5a02d2b4 100644 --- a/src/include/fls/encoder/assert_eq.hpp +++ b/src/include/fls/encoder/assert_eq.hpp @@ -6,7 +6,8 @@ #ifndef FLS_ENCODER_ASSERT_EQ_HPP #define FLS_ENCODER_ASSERT_EQ_HPP -#pragma clang diagnostic ignored "-Wconversion" +#include "fls/compiler.hpp" +FLS_DIAG_IGNORE_CONVERSION #include "fls/common/string.hpp" #include "fls/cor/exp/exp.hpp" diff --git a/src/include/fls/encoder/encoder.hpp b/src/include/fls/encoder/encoder.hpp index d31884a9..3170a059 100644 --- a/src/include/fls/encoder/encoder.hpp +++ b/src/include/fls/encoder/encoder.hpp @@ -6,6 +6,7 @@ #ifndef FLS_ENCODER_ENCODER_HPP #define FLS_ENCODER_ENCODER_HPP +#include "fls/api/api.hpp" #include "fls/std/filesystem.hpp" namespace fastlanes { @@ -14,7 +15,7 @@ class Connection; class Buf; /*--------------------------------------------------------------------------------------------------------------------*/ -class Encoder { +class FLS_API Encoder { public: static void encode(const Connection& connection, const path& file_path); }; diff --git a/src/include/fls/expression/data_type.hpp b/src/include/fls/expression/data_type.hpp index 276f32c6..e8b2be6e 100644 --- a/src/include/fls/expression/data_type.hpp +++ b/src/include/fls/expression/data_type.hpp @@ -6,6 +6,7 @@ #ifndef FLS_EXPRESSION_DATA_TYPE_HPP #define FLS_EXPRESSION_DATA_TYPE_HPP +#include "fls/api/api.hpp" #include "fls/footer/datatype_generated.h" #include #include @@ -15,17 +16,17 @@ namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*\ * ToSt : \*--------------------------------------------------------------------------------------------------------------------*/ -std::string ToStr(DataType type); +FLS_API std::string ToStr(DataType type); /*--------------------------------------------------------------------------------------------------------------------*\ * SizeOf : \*--------------------------------------------------------------------------------------------------------------------*/ -uint64_t SizeOf(DataType datatype); +FLS_API uint64_t SizeOf(DataType datatype); /*--------------------------------------------------------------------------------------------------------------------*\ * Overload << operator \*--------------------------------------------------------------------------------------------------------------------*/ -std::ostream& operator<<(std::ostream& os, DataType type); +FLS_API std::ostream& operator<<(std::ostream& os, DataType type); /*--------------------------------------------------------------------------------------------------------------------*\ * PT diff --git a/src/include/fls/expression/physical_expression.hpp b/src/include/fls/expression/physical_expression.hpp index 065256dc..561e8f1f 100644 --- a/src/include/fls/expression/physical_expression.hpp +++ b/src/include/fls/expression/physical_expression.hpp @@ -375,7 +375,7 @@ using physical_operator = variant; using physical_operands = vector; -class PhysicalExpr { +class FLS_API PhysicalExpr { public: physical_operators operators; physical_operands operands; @@ -384,6 +384,11 @@ class PhysicalExpr { ~PhysicalExpr(); PhysicalExpr(); + PhysicalExpr(const PhysicalExpr&) = delete; + PhysicalExpr& operator=(const PhysicalExpr&) = delete; + PhysicalExpr(PhysicalExpr&&) = default; + PhysicalExpr& operator=(PhysicalExpr&&) = default; + public: // void PointTo(n_t vec_idx) const; diff --git a/src/include/fls/expression/rpn.hpp b/src/include/fls/expression/rpn.hpp index 6b86376a..064b3023 100644 --- a/src/include/fls/expression/rpn.hpp +++ b/src/include/fls/expression/rpn.hpp @@ -6,6 +6,7 @@ #ifndef FLS_EXPRESSION_NEW_RPN_HPP #define FLS_EXPRESSION_NEW_RPN_HPP +#include "fls/api/api.hpp" #include "fls/footer/operator_token_generated.h" #include "fls/footer/rpn_generated.h" #include "fls/std/string.hpp" @@ -15,13 +16,13 @@ namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ struct InterpreterState; /*--------------------------------------------------------------------------------------------------------------------*/ -std::ostream& operator<<(std::ostream& os, const RPNT& rpn); +FLS_API std::ostream& operator<<(std::ostream& os, const RPNT& rpn); /*--------------------------------------------------------------------------------------------------------------------*/ /* Helper Functions */ /*--------------------------------------------------------------------------------------------------------------------*/ -string token_to_string(OperatorToken token); -bool is_1_to_1(OperatorToken token); +FLS_API string token_to_string(OperatorToken token); +FLS_API bool is_1_to_1(OperatorToken token); } // namespace fastlanes diff --git a/src/include/fls/expression/selection_ds.hpp b/src/include/fls/expression/selection_ds.hpp index e8b18460..ebe068f8 100644 --- a/src/include/fls/expression/selection_ds.hpp +++ b/src/include/fls/expression/selection_ds.hpp @@ -6,6 +6,7 @@ #ifndef FLS_EXPRESSION_SELECTION_DS_HPP #define FLS_EXPRESSION_SELECTION_DS_HPP +#include "fls/api/api.hpp" #include "fls/cfg/cfg.hpp" #include "fls/common/common.hpp" #include "fls/std/array.hpp" @@ -15,7 +16,7 @@ namespace fastlanes { class LogicalExpr; /*--------------------------------------------------------------------------------------------------------------------*/ -class SelectionDS { +class FLS_API SelectionDS { using bitmap_unit_t = uint64_t; public: diff --git a/src/include/fls/ffor_util.hpp b/src/include/fls/ffor_util.hpp index 9aba646c..61e825a7 100644 --- a/src/include/fls/ffor_util.hpp +++ b/src/include/fls/ffor_util.hpp @@ -6,6 +6,7 @@ #ifndef FLS_FFOR_UTIL_HPP #define FLS_FFOR_UTIL_HPP +#include "fls/compiler.hpp" #include #include @@ -23,13 +24,13 @@ uint8_t count_bits(PT max, PT min) { return 0; if constexpr (std::is_same_v) { - return static_cast(64 - __builtin_clzll(delta)); + return static_cast(64 - fls_clzll(delta)); } else if constexpr (std::is_same_v) { - return static_cast(32 - __builtin_clz(delta)); + return static_cast(32 - fls_clz(delta)); } else if constexpr (std::is_same_v) { - return static_cast(16 - (__builtin_clz(static_cast(delta)) - 16)); + return static_cast(16 - (fls_clz(static_cast(delta)) - 16)); } else if constexpr (std::is_same_v) { - return static_cast(8 - (__builtin_clz(static_cast(delta)) - 24)); + return static_cast(8 - (fls_clz(static_cast(delta)) - 24)); } return 0; } diff --git a/src/include/fls/footer/column_descriptor.hpp b/src/include/fls/footer/column_descriptor.hpp index 92e7b568..171e48ee 100644 --- a/src/include/fls/footer/column_descriptor.hpp +++ b/src/include/fls/footer/column_descriptor.hpp @@ -6,6 +6,7 @@ #ifndef FLS_FOOTER_COLUMN_DESCRIPTOR_HPP #define FLS_FOOTER_COLUMN_DESCRIPTOR_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" #include "fls/common/decimal.hpp" #include "fls/expression/data_type.hpp" @@ -29,7 +30,7 @@ using ColumnDescriptors = vector>; /*--------------------------------------------------------------------------------------------------------------------*\ * set index \*--------------------------------------------------------------------------------------------------------------------*/ -void set_index(vector>& column_descriptors); +FLS_API void set_index(vector>& column_descriptors); } // namespace fastlanes #endif // FLS_FOOTER_COLUMN_DESCRIPTOR_HPP diff --git a/src/include/fls/footer/rowgroup_descriptor.hpp b/src/include/fls/footer/rowgroup_descriptor.hpp index 8696a052..e27191f6 100644 --- a/src/include/fls/footer/rowgroup_descriptor.hpp +++ b/src/include/fls/footer/rowgroup_descriptor.hpp @@ -6,6 +6,7 @@ #ifndef FLS_FOOTER_ROWGROUP_DESCRIPTOR_HPP #define FLS_FOOTER_ROWGROUP_DESCRIPTOR_HPP +#include "fls/api/api.hpp" #include "fls/footer/column_descriptor.hpp" #include "fls/footer/rowgroup_descriptor_generated.h" #include "fls/std/filesystem.hpp" @@ -19,8 +20,8 @@ enum class DataType : uint8_t; using col_description_it = vector>::iterator; using const_col_description_it = vector>::const_iterator; -up make_rowgroup_descriptor(const Rowgroup& rowgroup); -up make_rowgroup_descriptor(const path& dir_path); +FLS_API up make_rowgroup_descriptor(const Rowgroup& rowgroup); +FLS_API up make_rowgroup_descriptor(const path& dir_path); } // namespace fastlanes diff --git a/src/include/fls/footer/table_descriptor.hpp b/src/include/fls/footer/table_descriptor.hpp index 59b932c4..82163391 100644 --- a/src/include/fls/footer/table_descriptor.hpp +++ b/src/include/fls/footer/table_descriptor.hpp @@ -6,6 +6,7 @@ #ifndef FLS_FOOTER_TABLE_DESCRIPTOR_HPP #define FLS_FOOTER_TABLE_DESCRIPTOR_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // n_t, up #include "fls/footer/table_descriptor_generated.h" #include "fls/std/filesystem.hpp" // path @@ -18,7 +19,7 @@ namespace fastlanes { class Table; -class TableDescriptorHandle { +class FLS_API TableDescriptorHandle { public: TableDescriptorHandle() = default; @@ -81,7 +82,7 @@ class TableDescriptorHandle { │ By-pointer helpers (return up<...>) │ │ These heap-allocate the handle and return unique ownership (up<>). │ └──────────────────────────────────────────────────────────────────────────────*/ -up make_table_descriptor(const Table& table); +FLS_API up make_table_descriptor(const Table& table); inline up make_table_descriptor(const path& file_path, bool verify = true) { return std::make_unique(TableDescriptorHandle::FromFile(file_path, verify)); diff --git a/src/include/fls/json/fls_json.hpp b/src/include/fls/json/fls_json.hpp index faf163be..1841363f 100644 --- a/src/include/fls/json/fls_json.hpp +++ b/src/include/fls/json/fls_json.hpp @@ -6,6 +6,7 @@ #ifndef FLS_JSON_FLS_JSON_HPP #define FLS_JSON_FLS_JSON_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" #include "fls/json/nlohmann/json.hpp" #include "fls/std/filesystem.hpp" @@ -29,57 +30,57 @@ struct ExpressionResultT; /*--------------------------------------------------------------------------------------------------------------------*\ * TableDescriptorT \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const TableDescriptorT& table_descriptor); -void from_json(const nlohmann::json& j, TableDescriptorT& table_descriptor); +FLS_API void to_json(nlohmann::json& j, const TableDescriptorT& table_descriptor); +FLS_API void from_json(const nlohmann::json& j, TableDescriptorT& table_descriptor); /*--------------------------------------------------------------------------------------------------------------------*\ * RowgroupDescriptor \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const RowgroupDescriptorT& rowgroup_descriptor); -void from_json(const nlohmann::json& j, RowgroupDescriptorT& rowgroup_descriptor); +FLS_API void to_json(nlohmann::json& j, const RowgroupDescriptorT& rowgroup_descriptor); +FLS_API void from_json(const nlohmann::json& j, RowgroupDescriptorT& rowgroup_descriptor); /*--------------------------------------------------------------------------------------------------------------------*\ * ColumnDescriptor \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const ColumnDescriptorT& p); -void from_json(const nlohmann::json& j, ColumnDescriptorT& p); +FLS_API void to_json(nlohmann::json& j, const ColumnDescriptorT& p); +FLS_API void from_json(const nlohmann::json& j, ColumnDescriptorT& p); /*--------------------------------------------------------------------------------------------------------------------*\ * LogicalExpr \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const LogicalExpr& p); -void from_json(const nlohmann::json& j, LogicalExpr& p); +FLS_API void to_json(nlohmann::json& j, const LogicalExpr& p); +FLS_API void from_json(const nlohmann::json& j, LogicalExpr& p); /*--------------------------------------------------------------------------------------------------------------------*\ * NewRpn \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const RPNT& p); -void from_json(const nlohmann::json& j, RPNT& p); +FLS_API void to_json(nlohmann::json& j, const RPNT& p); +FLS_API void from_json(const nlohmann::json& j, RPNT& p); /*--------------------------------------------------------------------------------------------------------------------*\ * BinaryValue \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const BinaryValueT& p); -void from_json(const nlohmann::json& j, BinaryValueT& p); +FLS_API void to_json(nlohmann::json& j, const BinaryValueT& p); +FLS_API void from_json(const nlohmann::json& j, BinaryValueT& p); /*--------------------------------------------------------------------------------------------------------------------*\ * ExprSpace \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const ExprSpace& p); -void from_json(const nlohmann::json& j, ExprSpace& p); +FLS_API void to_json(nlohmann::json& j, const ExprSpace& p); +FLS_API void from_json(const nlohmann::json& j, ExprSpace& p); /*--------------------------------------------------------------------------------------------------------------------*\ * SegmentDescriptor \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const SegmentDescriptorT& p); -void from_json(const nlohmann::json& j, SegmentDescriptorT& p); +FLS_API void to_json(nlohmann::json& j, const SegmentDescriptorT& p); +FLS_API void from_json(const nlohmann::json& j, SegmentDescriptorT& p); /*--------------------------------------------------------------------------------------------------------------------*\ * ExpressionResult \*--------------------------------------------------------------------------------------------------------------------*/ -void to_json(nlohmann::json& j, const ExpressionResultT& p); -void from_json(const nlohmann::json& j, ExpressionResultT& p); +FLS_API void to_json(nlohmann::json& j, const ExpressionResultT& p); +FLS_API void from_json(const nlohmann::json& j, ExpressionResultT& p); /*--------------------------------------------------------------------------------------------------------------------*\ * JSON \*--------------------------------------------------------------------------------------------------------------------*/ -class JSON { +class FLS_API JSON { public: static n_t write(const Connection& connection, const path& file_path, TableDescriptorT& table_descriptor); }; diff --git a/src/include/fls/primitive/patch/patch.hpp b/src/include/fls/primitive/patch/patch.hpp index 4f720070..25acb041 100644 --- a/src/include/fls/primitive/patch/patch.hpp +++ b/src/include/fls/primitive/patch/patch.hpp @@ -6,13 +6,14 @@ #ifndef FLS_PRIMITIVE_PATCH_PATCH_HPP #define FLS_PRIMITIVE_PATCH_PATCH_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" namespace fastlanes { n_t calculate_bitpacked_vector_size(bw_t bw); template -class Patch { +class FLS_API Patch { public: static void data_parallelize(const PT* in_exc_arr, const uint16_t* in_pos_arr, diff --git a/src/include/fls/primitive/predicate/equal.hpp b/src/include/fls/primitive/predicate/equal.hpp index 46f72f30..d2169fdc 100644 --- a/src/include/fls/primitive/predicate/equal.hpp +++ b/src/include/fls/primitive/predicate/equal.hpp @@ -6,30 +6,40 @@ #ifndef FLS_PRIMITIVE_PREDICATE_EQUAL_HPP #define FLS_PRIMITIVE_PREDICATE_EQUAL_HPP +#include "fls/common/restrict.hpp" #include "fls/expression/data_type.hpp" namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ class SelectionDS; /*--------------------------------------------------------------------------------------------------------------------*/ + +// MSVC strips __restrict from explicit template instantiation mangling, +// so declarations must omit it. Clang-cl needs it to match definitions. +#if defined(_MSC_VER) && !defined(__clang__) +#define FLS_PREDICATE_RESTRICT +#else +#define FLS_PREDICATE_RESTRICT FLS_RESTRICT +#endif + template -void eq_vector_constant_func(const PT* __restrict array_pointer, PT value, SelectionDS& selection_ds); +void eq_vector_constant_func(const PT* FLS_PREDICATE_RESTRICT array_pointer, PT value, SelectionDS& selection_ds); template -void ge_tvec_tvec(const PT* __restrict array_pointer, const PT* value, SelectionDS& selection_ds); +void ge_tvec_tvec(const PT* FLS_PREDICATE_RESTRICT array_pointer, const PT* value, SelectionDS& selection_ds); template -void ge_tvec_cvec(const PT* __restrict array_pointer, const PT* value, SelectionDS& selection_ds); +void ge_tvec_cvec(const PT* FLS_PREDICATE_RESTRICT array_pointer, const PT* value, SelectionDS& selection_ds); template -void lessthan_func(const PT* __restrict array_pointer, PT value, SelectionDS& selection_ds); +void lessthan_func(const PT* FLS_PREDICATE_RESTRICT array_pointer, PT value, SelectionDS& selection_ds); void and_selection_ds_func(const SelectionDS& selection_ds_1, const SelectionDS& selection_ds_2, SelectionDS& selection_ds_3); template -using predicate_func_p = void (*)(const PT* __restrict left_vec, - const PT* __restrict right_vec, - SelectionDS& selection_ds); +using predicate_func_p = void (*)(const PT* FLS_PREDICATE_RESTRICT left_vec, + const PT* FLS_PREDICATE_RESTRICT right_vec, + SelectionDS& selection_ds); } // namespace fastlanes #endif // FLS_PRIMITIVE_PREDICATE_EQUAL_HPP diff --git a/src/include/fls/reader/column_view.hpp b/src/include/fls/reader/column_view.hpp index 004dcafd..eb435c9a 100644 --- a/src/include/fls/reader/column_view.hpp +++ b/src/include/fls/reader/column_view.hpp @@ -6,6 +6,7 @@ #ifndef FLS_READER_COLUMN_VIEW_HPP #define FLS_READER_COLUMN_VIEW_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" #include "fls/std/span.hpp" #include "fls/std/vector.hpp" @@ -19,7 +20,7 @@ class SegmentView; /*--------------------------------------------------------------------------------------------------------------------*\ * ColumnView \*--------------------------------------------------------------------------------------------------------------------*/ -class ColumnView { +class FLS_API ColumnView { public: explicit ColumnView(span column_span, const ColumnDescriptor& column_descriptor, diff --git a/src/include/fls/reader/csv_reader.hpp b/src/include/fls/reader/csv_reader.hpp index 72c41fc1..5e0a6d41 100644 --- a/src/include/fls/reader/csv_reader.hpp +++ b/src/include/fls/reader/csv_reader.hpp @@ -6,6 +6,7 @@ #ifndef FLS_READER_CSV_READER_HPP #define FLS_READER_CSV_READER_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // for up, idx_t #include "fls/std/filesystem.hpp" @@ -19,7 +20,7 @@ class Connection; /*--------------------------------------------------------------------------------------------------------------------*\ * CsvReader \*--------------------------------------------------------------------------------------------------------------------*/ -class CsvReader { +class FLS_API CsvReader { public: static up Read(const path& dir_path, const Connection& connection); }; diff --git a/src/include/fls/reader/fls_rowgroup.hpp b/src/include/fls/reader/fls_rowgroup.hpp index f1322cd9..4d281ac7 100644 --- a/src/include/fls/reader/fls_rowgroup.hpp +++ b/src/include/fls/reader/fls_rowgroup.hpp @@ -6,6 +6,7 @@ #ifndef FLS_READER_FLS_ROWGROUP_HPP #define FLS_READER_FLS_ROWGROUP_HPP +#include "fls/api/api.hpp" #include "fls/std/span.hpp" #include "fls/std/vector.hpp" @@ -15,7 +16,7 @@ class RowgroupDescriptor; class ColumnView; /*--------------------------------------------------------------------------------------------------------------------*/ -class RowgroupView { +class FLS_API RowgroupView { public: explicit RowgroupView(span ptr, const RowgroupDescriptor& footer); diff --git a/src/include/fls/reader/json_reader.hpp b/src/include/fls/reader/json_reader.hpp index 4e17e340..bef29512 100644 --- a/src/include/fls/reader/json_reader.hpp +++ b/src/include/fls/reader/json_reader.hpp @@ -6,6 +6,7 @@ #ifndef FLS_READER_JSON_READER_HPP #define FLS_READER_JSON_READER_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // for up, idx_t #include "fls/std/filesystem.hpp" @@ -19,7 +20,7 @@ class Connection; /*--------------------------------------------------------------------------------------------------------------------*\ * JsonReader \*--------------------------------------------------------------------------------------------------------------------*/ -class JsonReader { +class FLS_API JsonReader { public: static up
Read(const path& dir_path, const Connection& connection); }; diff --git a/src/include/fls/reader/reader.hpp b/src/include/fls/reader/reader.hpp index f8d0ccd2..5d372ecd 100644 --- a/src/include/fls/reader/reader.hpp +++ b/src/include/fls/reader/reader.hpp @@ -6,24 +6,31 @@ #ifndef FLS_READER_READER_HPP #define FLS_READER_READER_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // for up, n_t #include "fls/cor/lyt/buf.hpp" // for Buf #include "fls/expression/physical_expression.hpp" // for PhysicalExpr #include "fls/reader/fls_rowgroup.hpp" -#include "fls/std/filesystem.hpp" // for path -#include "fls/std/vector.hpp" // for vector -#include "fls/table/chunk.hpp" // for Chunk +#include "fls/reader/rowgroup_view.hpp" // for RowgroupView (complete type needed for dllexport) +#include "fls/std/filesystem.hpp" // for path +#include "fls/std/vector.hpp" // for vector +#include "fls/table/chunk.hpp" // for Chunk namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ class Connection; -class RowgroupView; class Rowgroup; /*--------------------------------------------------------------------------------------------------------------------*/ -class Reader { +class FLS_API Reader { public: explicit Reader(const path& dir_path, Connection& fls); + ~Reader(); + Reader(const Reader&) = delete; + Reader& operator=(const Reader&) = delete; + Reader(Reader&&) noexcept; + Reader& operator=(Reader&&) noexcept; + public: vector>& get_chunk(n_t vec_idx); /// diff --git a/src/include/fls/reader/rowgroup_reader.hpp b/src/include/fls/reader/rowgroup_reader.hpp index aca706d0..95e5fbe7 100644 --- a/src/include/fls/reader/rowgroup_reader.hpp +++ b/src/include/fls/reader/rowgroup_reader.hpp @@ -6,24 +6,31 @@ #ifndef FLS_READER_ROWGROUP_READER_HPP #define FLS_READER_ROWGROUP_READER_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // for up, n_t #include "fls/cor/lyt/buf.hpp" // for Buf #include "fls/expression/physical_expression.hpp" // for PhysicalExpr #include "fls/reader/rowgroup_reader.hpp" -#include "fls/std/filesystem.hpp" // for path -#include "fls/std/vector.hpp" // for vector -#include "fls/table/chunk.hpp" // for Chunk +#include "fls/reader/rowgroup_view.hpp" // for RowgroupView (complete type needed for dllexport) +#include "fls/std/filesystem.hpp" // for path +#include "fls/std/vector.hpp" // for vector +#include "fls/table/chunk.hpp" // for Chunk namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ class Connection; -class RowgroupView; class Rowgroup; /*--------------------------------------------------------------------------------------------------------------------*/ -class RowgroupReader { +class FLS_API RowgroupReader { public: explicit RowgroupReader(const path& file_path, const RowgroupDescriptor& rowgroup_descriptor, Connection& fls); + ~RowgroupReader(); + RowgroupReader(const RowgroupReader&) = delete; + RowgroupReader& operator=(const RowgroupReader&) = delete; + RowgroupReader(RowgroupReader&&) = delete; + RowgroupReader& operator=(RowgroupReader&&) = delete; + public: vector>& get_chunk(n_t vec_idx); /// diff --git a/src/include/fls/reader/rowgroup_view.hpp b/src/include/fls/reader/rowgroup_view.hpp index ea5ca5f0..69af12c2 100644 --- a/src/include/fls/reader/rowgroup_view.hpp +++ b/src/include/fls/reader/rowgroup_view.hpp @@ -6,19 +6,26 @@ #ifndef FLS_READER_ROWGROUP_VIEW_HPP #define FLS_READER_ROWGROUP_VIEW_HPP +#include "fls/api/api.hpp" +#include "fls/reader/column_view.hpp" #include "fls/std/span.hpp" #include "fls/std/vector.hpp" namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ struct RowgroupDescriptor; -class ColumnView; /*--------------------------------------------------------------------------------------------------------------------*/ -class RowgroupView { +class FLS_API RowgroupView { public: explicit RowgroupView(span ptr, const RowgroupDescriptor& footer); + ~RowgroupView(); + RowgroupView(const RowgroupView&) = delete; + RowgroupView& operator=(const RowgroupView&) = delete; + RowgroupView(RowgroupView&&) noexcept; + RowgroupView& operator=(RowgroupView&&) noexcept; + public: ColumnView& operator[](n_t col_idx); const ColumnView& operator[](n_t col_idx) const; diff --git a/src/include/fls/reader/segment.hpp b/src/include/fls/reader/segment.hpp index efd4e9e1..06f2a0b9 100644 --- a/src/include/fls/reader/segment.hpp +++ b/src/include/fls/reader/segment.hpp @@ -6,14 +6,15 @@ #ifndef FLS_READER_SEGMENT_HPP #define FLS_READER_SEGMENT_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" +#include "fls/cor/lyt/buf.hpp" #include "fls/std/span.hpp" #include "fls/std/variant.hpp" #include "fls/std/vector.hpp" namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ -class Buf; struct SegmentDescriptor; struct SegmentDescriptorT; @@ -40,14 +41,14 @@ class EntryPointView { using entry_point_view_t = variant, EntryPointView, EntryPointView>; -n_t get_offset(const entry_point_view_t& entry_point_view, n_t vex_idx); +FLS_API n_t get_offset(const entry_point_view_t& entry_point_view, n_t vex_idx); -n_t get_size(const entry_point_view_t& entry_point_view); +FLS_API n_t get_size(const entry_point_view_t& entry_point_view); /*--------------------------------------------------------------------------------------------------------------------*\ * SegmentView \*--------------------------------------------------------------------------------------------------------------------*/ -class SegmentView { +class FLS_API SegmentView { public: explicit SegmentView(entry_point_view_t entry_point_view, span data_span); @@ -65,15 +66,21 @@ class SegmentView { /*--------------------------------------------------------------------------------------------------------------------*\ * make_segment_view \*--------------------------------------------------------------------------------------------------------------------*/ -SegmentView make_segment_view(span column_span, const SegmentDescriptor& segment_descriptor); +FLS_API SegmentView make_segment_view(span column_span, const SegmentDescriptor& segment_descriptor); /*--------------------------------------------------------------------------------------------------------------------*\ * Segment \*--------------------------------------------------------------------------------------------------------------------*/ -class Segment { +class FLS_API Segment { public: explicit Segment(); + ~Segment(); + Segment(const Segment&) = delete; + Segment& operator=(const Segment&) = delete; + Segment(Segment&&) noexcept; + Segment& operator=(Segment&&) noexcept; + public: void Flush(const void* pointer, n_t size); // diff --git a/src/include/fls/reader/table_reader.hpp b/src/include/fls/reader/table_reader.hpp index 7ef0ae73..1d93521e 100644 --- a/src/include/fls/reader/table_reader.hpp +++ b/src/include/fls/reader/table_reader.hpp @@ -8,6 +8,7 @@ #include "fls/api/api.hpp" #include "fls/common/alias.hpp" +#include "fls/footer/table_descriptor.hpp" // for TableDescriptorHandle (complete type needed for dllexport) #include "fls/std/filesystem.hpp" #include "fls/std/string.hpp" @@ -15,13 +16,18 @@ namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ class Connection; class RowgroupReader; -class TableDescriptorHandle; class Table; /*--------------------------------------------------------------------------------------------------------------------*/ class FLS_API TableReader { public: explicit TableReader(const path& file_path, Connection& fls); + ~TableReader(); + TableReader(const TableReader&) = delete; + TableReader& operator=(const TableReader&) = delete; + TableReader(TableReader&&) = delete; + TableReader& operator=(TableReader&&) = delete; + public: up operator[](n_t rowgroup_idx) const; // diff --git a/src/include/fls/reader/table_view.hpp b/src/include/fls/reader/table_view.hpp index d15909a1..8ba86cec 100644 --- a/src/include/fls/reader/table_view.hpp +++ b/src/include/fls/reader/table_view.hpp @@ -3,23 +3,29 @@ // ──────────────────────────────────────────────────────── // src/include/fls/reader/table_view.hpp // ──────────────────────────────────────────────────────── -#ifndef FLS_READER_ROWGROUP_VIEW_HPP -#define FLS_READER_ROWGROUP_VIEW_HPP +#ifndef FLS_READER_TABLE_VIEW_HPP +#define FLS_READER_TABLE_VIEW_HPP +#include "fls/api/api.hpp" +#include "fls/reader/rowgroup_view.hpp" #include "fls/std/span.hpp" #include "fls/std/vector.hpp" namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ struct TableDescriptorT; -class ColumnView; -class RowgroupView; /*--------------------------------------------------------------------------------------------------------------------*/ -class TableView { +class FLS_API TableView { public: explicit TableView(span ptr, const TableDescriptorT& table_descriptor); + ~TableView(); + TableView(const TableView&) = delete; + TableView& operator=(const TableView&) = delete; + TableView(TableView&&) noexcept; + TableView& operator=(TableView&&) noexcept; + public: RowgroupView& operator[](n_t row_idx); const RowgroupView& operator[](n_t row_idx) const; @@ -30,4 +36,4 @@ class TableView { } // namespace fastlanes -#endif // FLS_READER_ROWGROUP_VIEW_HPP +#endif // FLS_READER_TABLE_VIEW_HPP diff --git a/src/include/fls/table/attribute.hpp b/src/include/fls/table/attribute.hpp index aed29296..362481c0 100644 --- a/src/include/fls/table/attribute.hpp +++ b/src/include/fls/table/attribute.hpp @@ -6,6 +6,7 @@ #ifndef FLS_TABLE_ATTRIBUTE_HPP #define FLS_TABLE_ATTRIBUTE_HPP +#include "fls/api/api.hpp" #include "fls/common/common.hpp" #include "fls/std/string.hpp" #include "fls/table/rowgroup.hpp" @@ -16,7 +17,7 @@ template class TypedCol; enum class DataType : uint8_t; /*--------------------------------------------------------------------------------------------------------------------*/ -class Attribute { +class FLS_API Attribute { public: Attribute() = delete; diff --git a/src/include/fls/table/chunk.hpp b/src/include/fls/table/chunk.hpp index a8e7e021..bb405b24 100644 --- a/src/include/fls/table/chunk.hpp +++ b/src/include/fls/table/chunk.hpp @@ -6,6 +6,7 @@ #ifndef FLS_TABLE_CHUNK_HPP #define FLS_TABLE_CHUNK_HPP +#include "fls/api/api.hpp" #include "fls/cfg/cfg.hpp" #include "fls/common/alias.hpp" #include "fls/expression/data_type.hpp" @@ -27,14 +28,14 @@ using ofs_span_t = span; using length_span_t = span; /*--------------------------------------------------------------------------------------------------------------------*/ -class BaseVector { +class FLS_API BaseVector { public: null_map_span_t null_map_span; bool should_be_stored {false}; }; /*--------------------------------------------------------------------------------------------------------------------*/ -class VariableSizeVector : public BaseVector { +class FLS_API VariableSizeVector : public BaseVector { public: ofs_span_t ofs_span; }; @@ -128,7 +129,14 @@ using fls_chunk = vector; /*--------------------------------------------------------------------------------------------------------------------*\ * list vector \*--------------------------------------------------------------------------------------------------------------------*/ -class ListVector : public VariableSizeVector { +class FLS_API ListVector : public VariableSizeVector { +public: + ListVector() = default; + ListVector(const ListVector&) = delete; + ListVector& operator=(const ListVector&) = delete; + ListVector(ListVector&&) = default; + ListVector& operator=(ListVector&&) = default; + public: fls_vec child; }; @@ -136,7 +144,14 @@ class ListVector : public VariableSizeVector { /*--------------------------------------------------------------------------------------------------------------------*\ * struct vector \*--------------------------------------------------------------------------------------------------------------------*/ -class StructVector : public BaseVector { +class FLS_API StructVector : public BaseVector { +public: + StructVector() = default; + StructVector(const StructVector&) = delete; + StructVector& operator=(const StructVector&) = delete; + StructVector(StructVector&&) = default; + StructVector& operator=(StructVector&&) = default; + public: fls_chunk table; }; diff --git a/src/include/fls/table/column.hpp b/src/include/fls/table/column.hpp index 3a8938ae..e01e0cc1 100644 --- a/src/include/fls/table/column.hpp +++ b/src/include/fls/table/column.hpp @@ -6,12 +6,13 @@ #ifndef FLS_TABLE_COLUMN_HPP #define FLS_TABLE_COLUMN_HPP +#include "fls/api/api.hpp" #include "fls/table/rowgroup.hpp" namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------*/ -class Column { +class FLS_API Column { public: static bool is_good_for_ditionary_encoding(const col_pt& col); }; diff --git a/src/include/fls/table/rowgroup.hpp b/src/include/fls/table/rowgroup.hpp index bd0476b6..45987a1c 100644 --- a/src/include/fls/table/rowgroup.hpp +++ b/src/include/fls/table/rowgroup.hpp @@ -6,6 +6,7 @@ #ifndef FLS_TABLE_ROWGROUP_HPP #define FLS_TABLE_ROWGROUP_HPP +#include "fls/api/api.hpp" #include "fls/cfg/cfg.hpp" #include "fls/common/common.hpp" #include "fls/expression/data_type.hpp" @@ -29,12 +30,12 @@ using byte_arr_t = vector; using ofs_arr_t = vector; using length_arr_t = vector; -class BaseCol { +class FLS_API BaseCol { public: null_map_arr_t null_map_arr; }; -class VariableSizeCol : public BaseCol { +class FLS_API VariableSizeCol : public BaseCol { public: ofs_arr_t ofs_arr; length_arr_t length_arr; @@ -114,7 +115,7 @@ class TypedColumnView { /*--------------------------------------------------------------------------------------------------------------------*\ * NullMapView \*--------------------------------------------------------------------------------------------------------------------*/ -class NullMapView { +class FLS_API NullMapView { public: explicit NullMapView(const col_pt& column); @@ -136,7 +137,7 @@ constexpr n_t TypedColumnView::GetSizeOfOneVector() { /*--------------------------------------------------------------------------------------------------------------------*\ * FLSStringView \*--------------------------------------------------------------------------------------------------------------------*/ -class FlsStrColumnView { +class FLS_API FlsStrColumnView { public: explicit FlsStrColumnView(const col_pt& column); @@ -168,12 +169,19 @@ class FlsStrColumnView { using rowgroup_pt = vector; -class List : public VariableSizeCol { +class FLS_API List : public VariableSizeCol { +public: + List() = default; + List(const List&) = delete; + List& operator=(const List&) = delete; + List(List&&) = default; + List& operator=(List&&) = default; + public: col_pt child; }; -class FLSStrColumn : public VariableSizeCol { +class FLS_API FLSStrColumn : public VariableSizeCol { public: vector byte_arr; vector str_p_arr; @@ -185,12 +193,19 @@ class FLSStrColumn : public VariableSizeCol { vector fls_str_arr; }; -class Struct : public BaseCol { +class FLS_API Struct : public BaseCol { +public: + Struct() = default; + Struct(const Struct&) = delete; + Struct& operator=(const Struct&) = delete; + Struct(Struct&&) = default; + Struct& operator=(Struct&&) = default; + public: rowgroup_pt internal_rowgroup; }; -class RowgroupComparisonResult { +class FLS_API RowgroupComparisonResult { public: bool is_equal {true}; n_t first_failed_column_idx {0}; @@ -198,7 +213,7 @@ class RowgroupComparisonResult { string description; }; -class Rowgroup { +class FLS_API Rowgroup { public: friend class LogicalExpr; friend class column; @@ -253,7 +268,7 @@ class Rowgroup { const n_t capacity; }; -std::ostream& operator<<(std::ostream& output, const Rowgroup& mini_arrow); +FLS_API std::ostream& operator<<(std::ostream& output, const Rowgroup& mini_arrow); } // namespace fastlanes diff --git a/src/include/fls/table/stats.hpp b/src/include/fls/table/stats.hpp index ca217eee..5ae66c36 100644 --- a/src/include/fls/table/stats.hpp +++ b/src/include/fls/table/stats.hpp @@ -6,6 +6,7 @@ #ifndef FLS_TABLE_STATS_HPP #define FLS_TABLE_STATS_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" #include "fls/common/bimap.hpp" #include "fls/common/bimap_frequency.hpp" @@ -44,7 +45,7 @@ class TypedStats { bool is_double_castable; }; -class FlsStringStats { +class FLS_API FlsStringStats { public: FlsStringStats(); diff --git a/src/include/fls/table/table.hpp b/src/include/fls/table/table.hpp index da284cdc..ba0d2f49 100644 --- a/src/include/fls/table/table.hpp +++ b/src/include/fls/table/table.hpp @@ -6,16 +6,17 @@ #ifndef FLS_TABLE_TABLE_HPP #define FLS_TABLE_TABLE_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" #include "fls/std/vector.hpp" +#include "fls/table/rowgroup.hpp" #include namespace fastlanes { /*--------------------------------------------------------------------------------------------------------------------*/ -class Rowgroup; class Connection; /*--------------------------------------------------------------------------------------------------------------------*/ -class TableComparisonResult { +class FLS_API TableComparisonResult { public: bool is_equal {true}; n_t first_failed_rowgroup_idx {0}; @@ -24,10 +25,16 @@ class TableComparisonResult { string description; }; -class Table { +class FLS_API Table { public: Table(const Connection& connection); + ~Table(); + Table(const Table&) = delete; + Table& operator=(const Table&) = delete; + Table(Table&&) = delete; + Table& operator=(Table&&) = delete; + public: n_t get_n_rowgroups() const; diff --git a/src/include/fls/table/vector.hpp b/src/include/fls/table/vector.hpp index ac228ce9..81e320bf 100644 --- a/src/include/fls/table/vector.hpp +++ b/src/include/fls/table/vector.hpp @@ -6,9 +6,10 @@ #ifndef FLS_TABLE_VECTOR_HPP #define FLS_TABLE_VECTOR_HPP #include "chunk.hpp" +#include "fls/api/api.hpp" namespace fastlanes { -class Vector { +class FLS_API Vector { public: explicit Vector(const fls_vec& vector); const fls_vec& internal_vector; diff --git a/src/include/fls/types/integer.hpp b/src/include/fls/types/integer.hpp index 7c273f24..2e6ec7bf 100644 --- a/src/include/fls/types/integer.hpp +++ b/src/include/fls/types/integer.hpp @@ -6,13 +6,14 @@ #ifndef FLS_TYPES_INTEGER_HPP #define FLS_TYPES_INTEGER_HPP +#include "fls/api/api.hpp" #include "fls/std/string.hpp" #include "fls/types/integer.hpp" namespace fastlanes { template -INTEGER_T parse_integer(const string& val_str); +FLS_API INTEGER_T parse_integer(const string& val_str); } // namespace fastlanes diff --git a/src/include/fls/types/timestamp.hpp b/src/include/fls/types/timestamp.hpp index 4680bd8c..7a072a5a 100644 --- a/src/include/fls/types/timestamp.hpp +++ b/src/include/fls/types/timestamp.hpp @@ -6,6 +6,7 @@ #ifndef FLS_TYPES_TIMESTAMP_HPP #define FLS_TYPES_TIMESTAMP_HPP +#include "fls/api/api.hpp" #include "fls/std/string.hpp" #include @@ -33,7 +34,7 @@ namespace fastlanes { * @throws std::out_of_range * If the resulting timestamp exceeds int64_t range */ -int64_t parse_timestamp(string_view ts_str); +FLS_API int64_t parse_timestamp(string_view ts_str); /** * Formats a microseconds-since-epoch timestamp back into an ISO-8601 string: @@ -48,7 +49,7 @@ int64_t parse_timestamp(string_view ts_str); * @throws std::runtime_error * If the reconstructed date falls outside a valid range */ -string timestamp_formatter(int64_t microseconds_since_epoch); +FLS_API string timestamp_formatter(int64_t microseconds_since_epoch); } // namespace fastlanes diff --git a/src/include/fls/types/validitymask.hpp b/src/include/fls/types/validitymask.hpp index 7831fe46..9576e827 100644 --- a/src/include/fls/types/validitymask.hpp +++ b/src/include/fls/types/validitymask.hpp @@ -11,10 +11,11 @@ * @brief Fixed‑size ValidityMask */ +#include "fls/api/api.hpp" #include "fls/cfg/cfg.hpp" namespace fastlanes { -class ValidityMask { +class FLS_API ValidityMask { public: // ───────────────────────────────────── configuration static constexpr n_t BIT_COUNT = CFG::VEC_SZ; ///< Total bits (compile‑time configured). diff --git a/src/include/fls/wizard/sampling_layout.hpp b/src/include/fls/wizard/sampling_layout.hpp index 5eef9032..74cd9fe1 100644 --- a/src/include/fls/wizard/sampling_layout.hpp +++ b/src/include/fls/wizard/sampling_layout.hpp @@ -6,6 +6,7 @@ #ifndef SAMPLING_LAYOUT_HPP #define SAMPLING_LAYOUT_HPP +#include "fls/api/api.hpp" #include "fls/common/alias.hpp" // for n_t #include "fls/std/array.hpp" #include "fls/std/vector.hpp" @@ -68,7 +69,7 @@ inline constexpr auto sampling_layout_64 = sampling_layout<64>(); // ----------------------------------------------------------------------------------------------------------- // Run-time mapping // ----------------------------------------------------------------------------------------------------------- -vector sampling_layout_dynamic(n_t rowgroup_size); +FLS_API vector sampling_layout_dynamic(n_t rowgroup_size); } // namespace fastlanes diff --git a/src/json/fls_json.cpp b/src/json/fls_json.cpp index 83b2cbf8..830a3d64 100644 --- a/src/json/fls_json.cpp +++ b/src/json/fls_json.cpp @@ -29,7 +29,7 @@ namespace fastlanes { DataType TypeLookUp(const string& str) { // 1) Normalize to uppercase std::string s = str; - std::ranges::transform(s, s.begin(), [](unsigned char c) { return std::toupper(c); }); + std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::toupper(c); }); // 2) Regex for DECIMAL(p,s) static const std::regex decimal_re(R"(DECIMAL\(\d+,\s*\d+\))"); diff --git a/src/primitive/copy/fls_copy.cpp b/src/primitive/copy/fls_copy.cpp index 455b2ffa..7e5a962f 100644 --- a/src/primitive/copy/fls_copy.cpp +++ b/src/primitive/copy/fls_copy.cpp @@ -6,6 +6,7 @@ #include "fls/primitive/copy/fls_copy.hpp" #include "fls/common/common.hpp" #include "fls/common/restrict.hpp" +#include "fls/compiler.hpp" #include "fls/expression/data_type.hpp" #include @@ -155,7 +156,7 @@ static void unpack_32bw_32ow_32crw_1uf(const uint32_t* FLS_RESTRICT a_in_p, uint static void unpack_64bw_64ow_64crw_1uf(const uint64_t* FLS_RESTRICT in, uint64_t* FLS_RESTRICT out) { [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); out[(i * 1) + (0 * 16) + (16 * 0)] = register_0; diff --git a/src/primitive/fls_memset/fls_memset.cpp b/src/primitive/fls_memset/fls_memset.cpp index 6cbcac4e..bf3db262 100644 --- a/src/primitive/fls_memset/fls_memset.cpp +++ b/src/primitive/fls_memset/fls_memset.cpp @@ -6,6 +6,7 @@ #include "fls/primitive/fls_memset/fls_memset.hpp" #include "fls/common/common.hpp" #include "fls/common/restrict.hpp" +#include "fls/compiler.hpp" #include "fls/expression/data_type.hpp" #include #include @@ -98,7 +99,7 @@ static void unffor_0bw_64ow_64crw_1uf(const uint64_t* FLS_RESTRICT base_p, uint6 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(base_p); -#pragma clang loop vectorize(enable) + FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { *(out + (i * 1) + (0 * 16) + (16 * 0)) = base_0; *(out + (i * 1) + (0 * 16) + (16 * 1)) = base_0; diff --git a/src/primitive/fsst/CMakeLists.txt b/src/primitive/fsst/CMakeLists.txt index 6c973ed0..455c5de4 100644 --- a/src/primitive/fsst/CMakeLists.txt +++ b/src/primitive/fsst/CMakeLists.txt @@ -11,7 +11,9 @@ if (ENABLE_IWYU) set_property(TARGET fls_primitive_fsst PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) endif () -target_compile_options(fls_primitive_fsst PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_primitive_fsst PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_primitive_fsst PUBLIC diff --git a/src/primitive/fsst12/CMakeLists.txt b/src/primitive/fsst12/CMakeLists.txt index 0457f6a3..883a0b29 100644 --- a/src/primitive/fsst12/CMakeLists.txt +++ b/src/primitive/fsst12/CMakeLists.txt @@ -12,7 +12,9 @@ if (ENABLE_IWYU) set_property(TARGET fls_primitive_fsst12 PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) endif () -target_compile_options(fls_primitive_fsst12 PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_primitive_fsst12 PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_primitive_fsst12 PUBLIC diff --git a/src/primitive/patch/CMakeLists.txt b/src/primitive/patch/CMakeLists.txt index 8c549b8e..fcf75bcb 100644 --- a/src/primitive/patch/CMakeLists.txt +++ b/src/primitive/patch/CMakeLists.txt @@ -12,7 +12,9 @@ if (ENABLE_IWYU) set_property(TARGET fls_primitive_patch PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) endif () -target_compile_options(fls_primitive_patch PRIVATE -Wno-macro-redefined) +if (NOT MSVC) + target_compile_options(fls_primitive_patch PRIVATE -Wno-macro-redefined) +endif () target_link_libraries(fls_primitive_patch PUBLIC diff --git a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_rsum_src.cpp b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_rsum_src.cpp index 7188f3e5..d13f16d7 100644 --- a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_rsum_src.cpp +++ b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_rsum_src.cpp @@ -5,6 +5,7 @@ // ──────────────────────────────────────────────────────── // generated! // NOLINTBEGIN +#include "fls/compiler.hpp" #include "fls_gen/macros.hpp" #include "fls_gen/rsum/rsum.hpp" namespace generated { namespace rsum::fallback { namespace scalar { @@ -216,7 +217,7 @@ void rsum(const uint64_t* __restrict a_in_p, uint64_t* __restrict a_out_p, const [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = *(base + (0 * 16) + (i * 1)); diff --git a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unffor_src.cpp b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unffor_src.cpp index e2c34def..9b458fa3 100644 --- a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unffor_src.cpp +++ b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unffor_src.cpp @@ -5,6 +5,7 @@ // ──────────────────────────────────────────────────────── // generated! // NOLINTBEGIN +#include "fls/compiler.hpp" #include "fls_gen/macros.hpp" #include "fls_gen/unffor/unffor.hpp" namespace generated { namespace unffor::fallback { namespace scalar { @@ -5917,7 +5918,7 @@ static void unffor_0bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { *(out + (i * 1) + (0 * 16) + (16 * 0)) = base_0; *(out + (i * 1) + (0 * 16) + (16 * 1)) = base_0; @@ -5993,7 +5994,7 @@ static void unffor_1bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 1) - 1); @@ -6198,7 +6199,7 @@ static void unffor_2bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 2) - 1); @@ -6404,7 +6405,7 @@ static void unffor_3bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 3) - 1); @@ -6613,7 +6614,7 @@ static void unffor_4bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 4) - 1); @@ -6821,7 +6822,7 @@ static void unffor_5bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 5) - 1); @@ -7034,7 +7035,7 @@ static void unffor_6bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 6) - 1); @@ -7248,7 +7249,7 @@ static void unffor_7bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 7) - 1); @@ -7465,7 +7466,7 @@ static void unffor_8bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 8) - 1); @@ -7677,7 +7678,7 @@ static void unffor_9bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 9) - 1); @@ -7898,7 +7899,7 @@ static void unffor_10bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 10) - 1); @@ -8120,7 +8121,7 @@ static void unffor_11bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 11) - 1); @@ -8345,7 +8346,7 @@ static void unffor_12bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 12) - 1); @@ -8569,7 +8570,7 @@ static void unffor_13bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 13) - 1); @@ -8798,7 +8799,7 @@ static void unffor_14bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 14) - 1); @@ -9028,7 +9029,7 @@ static void unffor_15bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 15) - 1); @@ -9261,7 +9262,7 @@ static void unffor_16bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 16) - 1); @@ -9481,7 +9482,7 @@ static void unffor_17bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 17) - 1); @@ -9718,7 +9719,7 @@ static void unffor_18bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 18) - 1); @@ -9956,7 +9957,7 @@ static void unffor_19bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 19) - 1); @@ -10197,7 +10198,7 @@ static void unffor_20bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 20) - 1); @@ -10437,7 +10438,7 @@ static void unffor_21bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 21) - 1); @@ -10682,7 +10683,7 @@ static void unffor_22bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 22) - 1); @@ -10928,7 +10929,7 @@ static void unffor_23bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 23) - 1); @@ -11177,7 +11178,7 @@ static void unffor_24bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 24) - 1); @@ -11421,7 +11422,7 @@ static void unffor_25bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 25) - 1); @@ -11674,7 +11675,7 @@ static void unffor_26bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 26) - 1); @@ -11928,7 +11929,7 @@ static void unffor_27bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 27) - 1); @@ -12185,7 +12186,7 @@ static void unffor_28bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 28) - 1); @@ -12441,7 +12442,7 @@ static void unffor_29bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 29) - 1); @@ -12702,7 +12703,7 @@ static void unffor_30bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 30) - 1); @@ -12964,7 +12965,7 @@ static void unffor_31bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 31) - 1); @@ -13229,7 +13230,7 @@ static void unffor_32bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 32) - 1); @@ -13465,7 +13466,7 @@ static void unffor_33bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 33) - 1); @@ -13734,7 +13735,7 @@ static void unffor_34bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 34) - 1); @@ -14004,7 +14005,7 @@ static void unffor_35bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 35) - 1); @@ -14277,7 +14278,7 @@ static void unffor_36bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 36) - 1); @@ -14549,7 +14550,7 @@ static void unffor_37bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 37) - 1); @@ -14826,7 +14827,7 @@ static void unffor_38bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 38) - 1); @@ -15104,7 +15105,7 @@ static void unffor_39bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 39) - 1); @@ -15385,7 +15386,7 @@ static void unffor_40bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 40) - 1); @@ -15661,7 +15662,7 @@ static void unffor_41bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 41) - 1); @@ -15946,7 +15947,7 @@ static void unffor_42bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 42) - 1); @@ -16232,7 +16233,7 @@ static void unffor_43bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 43) - 1); @@ -16521,7 +16522,7 @@ static void unffor_44bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 44) - 1); @@ -16809,7 +16810,7 @@ static void unffor_45bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 45) - 1); @@ -17102,7 +17103,7 @@ static void unffor_46bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 46) - 1); @@ -17396,7 +17397,7 @@ static void unffor_47bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 47) - 1); @@ -17693,7 +17694,7 @@ static void unffor_48bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 48) - 1); @@ -17977,7 +17978,7 @@ static void unffor_49bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 49) - 1); @@ -18278,7 +18279,7 @@ static void unffor_50bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 50) - 1); @@ -18580,7 +18581,7 @@ static void unffor_51bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 51) - 1); @@ -18885,7 +18886,7 @@ static void unffor_52bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 52) - 1); @@ -19189,7 +19190,7 @@ static void unffor_53bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 53) - 1); @@ -19498,7 +19499,7 @@ static void unffor_54bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 54) - 1); @@ -19808,7 +19809,7 @@ static void unffor_55bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 55) - 1); @@ -20121,7 +20122,7 @@ static void unffor_56bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 56) - 1); @@ -20429,7 +20430,7 @@ static void unffor_57bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 57) - 1); @@ -20746,7 +20747,7 @@ static void unffor_58bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 58) - 1); @@ -21064,7 +21065,7 @@ static void unffor_59bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 59) - 1); @@ -21385,7 +21386,7 @@ static void unffor_60bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 60) - 1); @@ -21705,7 +21706,7 @@ static void unffor_61bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 61) - 1); @@ -22030,7 +22031,7 @@ static void unffor_62bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 62) - 1); @@ -22356,7 +22357,7 @@ static void unffor_63bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 63) - 1); @@ -22685,7 +22686,7 @@ static void unffor_64bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = *(a_base_p); -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); register_0 += base_0; diff --git a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unpack_src.cpp b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unpack_src.cpp index 9692c4b1..0fae4da3 100644 --- a/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unpack_src.cpp +++ b/src/primitives/fls_generated/fallback/scalar_aav_uf1/fallback_scalar_aav_1024_uf1_unpack_src.cpp @@ -5,6 +5,7 @@ // ──────────────────────────────────────────────────────── // generated! // NOLINTBEGIN +#include "fls/compiler.hpp" #include "fls_gen/macros.hpp" #include "fls_gen/unpack/unpack.hpp" namespace generated { namespace unpack::fallback { namespace scalar { @@ -4453,7 +4454,7 @@ static void unpack_0bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { out[(i * 1) + (0 * 16) + 0] = base_0; out[(i * 1) + (0 * 16) + 16] = base_0; @@ -4527,7 +4528,7 @@ static void unpack_1bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 1) - 1); @@ -4666,7 +4667,7 @@ static void unpack_2bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 2) - 1); @@ -4806,7 +4807,7 @@ static void unpack_3bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 3) - 1); @@ -4949,7 +4950,7 @@ static void unpack_4bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 4) - 1); @@ -5091,7 +5092,7 @@ static void unpack_5bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 5) - 1); @@ -5238,7 +5239,7 @@ static void unpack_6bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 6) - 1); @@ -5386,7 +5387,7 @@ static void unpack_7bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 7) - 1); @@ -5537,7 +5538,7 @@ static void unpack_8bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 8) - 1); @@ -5683,7 +5684,7 @@ static void unpack_9bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64_ [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 9) - 1); @@ -5838,7 +5839,7 @@ static void unpack_10bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 10) - 1); @@ -5994,7 +5995,7 @@ static void unpack_11bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 11) - 1); @@ -6153,7 +6154,7 @@ static void unpack_12bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 12) - 1); @@ -6311,7 +6312,7 @@ static void unpack_13bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 13) - 1); @@ -6474,7 +6475,7 @@ static void unpack_14bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 14) - 1); @@ -6638,7 +6639,7 @@ static void unpack_15bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 15) - 1); @@ -6805,7 +6806,7 @@ static void unpack_16bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 16) - 1); @@ -6959,7 +6960,7 @@ static void unpack_17bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 17) - 1); @@ -7130,7 +7131,7 @@ static void unpack_18bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 18) - 1); @@ -7302,7 +7303,7 @@ static void unpack_19bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 19) - 1); @@ -7477,7 +7478,7 @@ static void unpack_20bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 20) - 1); @@ -7651,7 +7652,7 @@ static void unpack_21bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 21) - 1); @@ -7830,7 +7831,7 @@ static void unpack_22bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 22) - 1); @@ -8010,7 +8011,7 @@ static void unpack_23bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 23) - 1); @@ -8193,7 +8194,7 @@ static void unpack_24bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 24) - 1); @@ -8371,7 +8372,7 @@ static void unpack_25bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 25) - 1); @@ -8558,7 +8559,7 @@ static void unpack_26bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 26) - 1); @@ -8746,7 +8747,7 @@ static void unpack_27bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 27) - 1); @@ -8937,7 +8938,7 @@ static void unpack_28bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 28) - 1); @@ -9127,7 +9128,7 @@ static void unpack_29bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 29) - 1); @@ -9322,7 +9323,7 @@ static void unpack_30bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 30) - 1); @@ -9518,7 +9519,7 @@ static void unpack_31bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 31) - 1); @@ -9717,7 +9718,7 @@ static void unpack_32bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 32) - 1); @@ -9887,7 +9888,7 @@ static void unpack_33bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 33) - 1); @@ -10090,7 +10091,7 @@ static void unpack_34bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 34) - 1); @@ -10294,7 +10295,7 @@ static void unpack_35bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 35) - 1); @@ -10501,7 +10502,7 @@ static void unpack_36bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 36) - 1); @@ -10707,7 +10708,7 @@ static void unpack_37bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 37) - 1); @@ -10918,7 +10919,7 @@ static void unpack_38bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 38) - 1); @@ -11130,7 +11131,7 @@ static void unpack_39bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 39) - 1); @@ -11345,7 +11346,7 @@ static void unpack_40bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 40) - 1); @@ -11555,7 +11556,7 @@ static void unpack_41bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 41) - 1); @@ -11774,7 +11775,7 @@ static void unpack_42bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 42) - 1); @@ -11994,7 +11995,7 @@ static void unpack_43bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 43) - 1); @@ -12217,7 +12218,7 @@ static void unpack_44bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 44) - 1); @@ -12439,7 +12440,7 @@ static void unpack_45bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 45) - 1); @@ -12666,7 +12667,7 @@ static void unpack_46bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 46) - 1); @@ -12894,7 +12895,7 @@ static void unpack_47bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 47) - 1); @@ -13125,7 +13126,7 @@ static void unpack_48bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 48) - 1); @@ -13343,7 +13344,7 @@ static void unpack_49bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 49) - 1); @@ -13578,7 +13579,7 @@ static void unpack_50bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 50) - 1); @@ -13814,7 +13815,7 @@ static void unpack_51bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 51) - 1); @@ -14053,7 +14054,7 @@ static void unpack_52bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 52) - 1); @@ -14291,7 +14292,7 @@ static void unpack_53bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 53) - 1); @@ -14534,7 +14535,7 @@ static void unpack_54bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 54) - 1); @@ -14778,7 +14779,7 @@ static void unpack_55bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 55) - 1); @@ -15025,7 +15026,7 @@ static void unpack_56bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 56) - 1); @@ -15267,7 +15268,7 @@ static void unpack_57bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 57) - 1); @@ -15518,7 +15519,7 @@ static void unpack_58bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 58) - 1); @@ -15770,7 +15771,7 @@ static void unpack_59bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 59) - 1); @@ -16025,7 +16026,7 @@ static void unpack_60bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 60) - 1); @@ -16279,7 +16280,7 @@ static void unpack_61bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 61) - 1); @@ -16538,7 +16539,7 @@ static void unpack_62bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 62) - 1); @@ -16798,7 +16799,7 @@ static void unpack_63bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); tmp_0 = (register_0) & ((1ULL << 63) - 1); @@ -17061,7 +17062,7 @@ static void unpack_64bw_64ow_64crw_1uf(const uint64_t* __restrict a_in_p, uint64 [[maybe_unused]] uint64_t register_0; [[maybe_unused]] uint64_t tmp_0; [[maybe_unused]] uint64_t base_0 = 0ULL; -#pragma clang loop vectorize(enable) +FLS_PRAGMA_VECTORIZE for (int i = 0; i < 16; ++i) { register_0 = *(in + (0 * 16) + (i * 1) + 0); out[(i * 1) + (0 * 16) + 0] = register_0; diff --git a/src/reader/reader.cpp b/src/reader/reader.cpp index 906d2751..2a162c3f 100644 --- a/src/reader/reader.cpp +++ b/src/reader/reader.cpp @@ -25,6 +25,11 @@ #include // for basic_string namespace fastlanes { + +Reader::~Reader() = default; +Reader::Reader(Reader&&) noexcept = default; +Reader& Reader::operator=(Reader&&) noexcept = default; + Reader::Reader(const path& dir_path, Connection& fls) { // read footer { m_footer = make_rowgroup_descriptor(dir_path / FOOTER_FILE_NAME); } diff --git a/src/reader/rowgroup_reader.cpp b/src/reader/rowgroup_reader.cpp index 5caa9a94..c0b7451d 100644 --- a/src/reader/rowgroup_reader.cpp +++ b/src/reader/rowgroup_reader.cpp @@ -26,6 +26,8 @@ namespace fastlanes { +RowgroupReader::~RowgroupReader() = default; + RowgroupReader::RowgroupReader(const path& file_path, const RowgroupDescriptor& rowgroup_descriptor, Connection& connection) @@ -86,7 +88,6 @@ up RowgroupReader::materialize() { materializer.Materialize(expressions, vec_idx); } - // materializer.rowgroup.Cast(); materializer.rowgroup.Finalize(); materializer.rowgroup.GetStatistics(); diff --git a/src/reader/rowgroup_view.cpp b/src/reader/rowgroup_view.cpp index d5704fbf..655f1de0 100644 --- a/src/reader/rowgroup_view.cpp +++ b/src/reader/rowgroup_view.cpp @@ -13,6 +13,10 @@ namespace fastlanes { +RowgroupView::~RowgroupView() = default; +RowgroupView::RowgroupView(RowgroupView&&) noexcept = default; +RowgroupView& RowgroupView::operator=(RowgroupView&&) noexcept = default; + RowgroupView::RowgroupView(span ptr, const RowgroupDescriptor& footer) { for (const auto& column_descriptor : *footer.m_column_descriptors()) { diff --git a/src/reader/segment.cpp b/src/reader/segment.cpp index 005c02bf..b0e2f7e5 100644 --- a/src/reader/segment.cpp +++ b/src/reader/segment.cpp @@ -99,6 +99,10 @@ n_t SegmentView::Size() const { /*--------------------------------------------------------------------------------------------------------------------*\ * Segment \*--------------------------------------------------------------------------------------------------------------------*/ +Segment::~Segment() = default; +Segment::Segment(Segment&&) noexcept = default; +Segment& Segment::operator=(Segment&&) noexcept = default; + Segment::Segment() : persistent(true) , is_block_based(false) { diff --git a/src/reader/table_reader.cpp b/src/reader/table_reader.cpp index 8170dd0a..d9b75a37 100644 --- a/src/reader/table_reader.cpp +++ b/src/reader/table_reader.cpp @@ -32,8 +32,12 @@ up TableReader::get_rowgroup_reader(const n_t rowgroup_idx) cons up
TableReader::materialize() const { auto table_up = make_unique
(m_connection); - const TableDescriptor* td = m_table_descriptor_handle->Get(); - const auto n_rgs = td->m_rowgroup_descriptors()->size(); // uoffset_t + const TableDescriptor* td = m_table_descriptor_handle->Get(); + const auto* rg_vec = td->m_rowgroup_descriptors(); + if (!rg_vec) { + return table_up; + } + const auto n_rgs = rg_vec->size(); for (flatbuffers::uoffset_t i = 0; i < n_rgs; ++i) { auto rowgroup_up = get_rowgroup_reader(static_cast(i))->materialize(); @@ -44,8 +48,12 @@ up
TableReader::materialize() const { } void TableReader::to_csv(const path& file_path) const { - const TableDescriptor* td = m_table_descriptor_handle->Get(); - const auto n_rgs = td->m_rowgroup_descriptors()->size(); + const TableDescriptor* td = m_table_descriptor_handle->Get(); + const auto* rg_vec = td->m_rowgroup_descriptors(); + if (!rg_vec) { + return; + } + const auto n_rgs = rg_vec->size(); for (flatbuffers::uoffset_t i = 0; i < n_rgs; ++i) { auto rowgroup_up = get_rowgroup_reader(static_cast(i))->materialize(); @@ -61,6 +69,8 @@ void TableReader::to_csv(const char* file_path) const { to_csv(path(file_path)); } +TableReader::~TableReader() = default; + TableReader::TableReader(const path& file_path, Connection& connection) : m_connection(connection) , m_file_path(file_path) { diff --git a/src/reader/table_view.cpp b/src/reader/table_view.cpp index af60a515..68615382 100644 --- a/src/reader/table_view.cpp +++ b/src/reader/table_view.cpp @@ -3,8 +3,12 @@ // ──────────────────────────────────────────────────────── // src/reader/table_view.cpp // ──────────────────────────────────────────────────────── -// #include "fls/reader/table_view.hpp" +#include "fls/reader/table_view.hpp" namespace fastlanes { +TableView::~TableView() = default; +TableView::TableView(TableView&&) noexcept = default; +TableView& TableView::operator=(TableView&&) noexcept = default; + } // namespace fastlanes diff --git a/src/table/attribute.cpp b/src/table/attribute.cpp index f9cd053d..13a2bfe4 100644 --- a/src/table/attribute.cpp +++ b/src/table/attribute.cpp @@ -338,7 +338,7 @@ bool isValidUint32(const std::string& str) { } try { - u64_pt value = std::stoul(str); + u64_pt value = std::stoull(str); return value <= std::numeric_limits::max(); } catch (const std::exception&) { return false; } } @@ -362,7 +362,7 @@ bool isValidInt32(const std::string& str) { try { // Convert string to long and check the range - const int64_t value = std::stol(str); + const int64_t value = std::stoll(str); return value >= std::numeric_limits::min() && value <= std::numeric_limits::max(); } catch (const std::exception&) { return false; // Overflow or invalid conversion @@ -381,7 +381,7 @@ bool isValidUint16(const std::string& str) { try { // Convert string to uint64_t and check the range - uint64_t value = std::stoul(str); + uint64_t value = std::stoull(str); return value <= std::numeric_limits::max(); } catch (const std::exception&) { return false; // Overflow or invalid conversion diff --git a/src/table/rowgroup.cpp b/src/table/rowgroup.cpp index 9ab110de..694bc329 100644 --- a/src/table/rowgroup.cpp +++ b/src/table/rowgroup.cpp @@ -23,6 +23,7 @@ #include "fls/table/attribute.hpp" #include "fls/table/chunk.hpp" #include // if you use asserts, or your macros depend on it +#include // ptrdiff_t #include // int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t, uint64_t #include // std::ifstream #include // std::numeric_limits @@ -258,7 +259,7 @@ struct col_cast_visitor { for (n_t val_idx {0}; val_idx < n_tup; val_idx++) { std::string str(reinterpret_cast(&str_col->byte_arr[cur_offset]), str_col->length_arr[val_idx]); - auto casted_string = std::stol(str); + auto casted_string = std::stoll(str); casted_col->data[val_idx] = static_cast(casted_string); cur_offset += str_col->length_arr[val_idx]; } @@ -430,12 +431,16 @@ void fill_in(col_pt& col, n_t how_many_to_fill) { [&](up& string_col) { const auto last_value_length = string_col->length_arr.back(); + // Copy the last value once to avoid iterator invalidation during push_back. + // push_back can reallocate the vector, invalidating references into it. + const auto last_value_offset = string_col->byte_arr.size() - last_value_length; + vector last_value(string_col->byte_arr.begin() + static_cast(last_value_offset), + string_col->byte_arr.end()); + for (n_t val_idx {0}; val_idx < how_many_to_fill; val_idx++) { - const auto size = string_col->byte_arr.size(); - for (n_t byte_index {last_value_length}; byte_index > 0; byte_index--) { - string_col->byte_arr.push_back(string_col->byte_arr[size - byte_index]); - string_col->fsst_byte_arr.push_back(string_col->byte_arr[size - byte_index]); - } + string_col->byte_arr.insert(string_col->byte_arr.end(), last_value.begin(), last_value.end()); + string_col->fsst_byte_arr.insert( + string_col->fsst_byte_arr.end(), last_value.begin(), last_value.end()); string_col->length_arr.push_back(last_value_length); string_col->fsst_length_arr.push_back(last_value_length); } @@ -487,7 +492,7 @@ struct rowgroup_equality_visitor { for (idx_t idx {0}; idx < org_col->data.size(); ++idx) { const auto& original_val = org_col->data[idx]; const auto& decoded_val = decoded_col->data[idx]; - if (org_col->null_map_arr[idx]) { + if (!org_col->null_map_arr.empty() && org_col->null_map_arr[idx]) { continue; } @@ -519,7 +524,7 @@ struct rowgroup_equality_visitor { } for (idx_t idx {0}; idx < org_col->length_arr.size(); ++idx) { - if (org_col->null_map_arr[idx]) { + if (!org_col->null_map_arr.empty() && org_col->null_map_arr[idx]) { continue; } const fls_string_t org_fls_string {org_col->str_p_arr[idx], org_col->length_arr[idx]}; @@ -658,13 +663,14 @@ n_t Rowgroup::ColCount() const { template TypedColumnView::TypedColumnView(const col_pt& column) : m_vec_idx(INVALID_N) { + static const uint8_t zero_null_map[65536] = {}; visit(overloaded {// [&](const up>& typed_col) { // m_data = typed_col->data.data(); m_stats_p = &typed_col->m_stats; n_vals = typed_col->data.size(); - m_bools = typed_col->null_map_arr.data(); + m_bools = typed_col->null_map_arr.empty() ? zero_null_map : typed_col->null_map_arr.data(); n_tuples = typed_col->data.size(); }, [&](const std::monostate&) { FLS_UNREACHABLE() }, @@ -721,13 +727,18 @@ template class TypedColumnView; \*--------------------------------------------------------------------------------------------------------------------*/ NullMapView::NullMapView(const col_pt& column) { - visit(overloaded { - [&](const up>& typed_col) { m_null_map = typed_col->null_map_arr.data(); }, - [&](const up& fls_str_column) { m_null_map = fls_str_column->null_map_arr.data(); }, - [&](const std::monostate&) { FLS_UNREACHABLE() }, - [&](const auto& arg) { - FLS_UNREACHABLE_WITH_TYPE(arg) - }}, + static const uint8_t zero_null_map[65536] = {}; + visit(overloaded {[&](const up>& typed_col) { + m_null_map = typed_col->null_map_arr.empty() ? zero_null_map : typed_col->null_map_arr.data(); + }, + [&](const up& fls_str_column) { + m_null_map = fls_str_column->null_map_arr.empty() ? zero_null_map + : fls_str_column->null_map_arr.data(); + }, + [&](const std::monostate&) { FLS_UNREACHABLE() }, + [&](const auto& arg) { + FLS_UNREACHABLE_WITH_TYPE(arg) + }}, column); } const uint8_t* NullMapView::NullMap() const { diff --git a/src/table/table.cpp b/src/table/table.cpp index bc1692f5..5080fab2 100644 --- a/src/table/table.cpp +++ b/src/table/table.cpp @@ -11,6 +11,8 @@ namespace fastlanes { +Table::~Table() = default; + Table::Table(const Connection& connection) : m_connection(connection) { } diff --git a/src/types/integer.cpp b/src/types/integer.cpp index 650b01bc..f7049c88 100644 --- a/src/types/integer.cpp +++ b/src/types/integer.cpp @@ -4,6 +4,7 @@ // src/types/integer.cpp // ──────────────────────────────────────────────────────── #include "fls/types/integer.hpp" +#include "fls/api/api.hpp" #include "fls/std/string.hpp" #include // for std::isdigit #include @@ -77,13 +78,13 @@ INTEGER_T parse_integer(const string& val_str) { } } -template uint8_t parse_integer(const string&); -template uint16_t parse_integer(const string&); -template uint32_t parse_integer(const string&); -template uint64_t parse_integer(const string&); -template int8_t parse_integer(const string&); -template int16_t parse_integer(const string&); -template int32_t parse_integer(const string&); -template int64_t parse_integer(const string&); +template FLS_API uint8_t parse_integer(const string&); +template FLS_API uint16_t parse_integer(const string&); +template FLS_API uint32_t parse_integer(const string&); +template FLS_API uint64_t parse_integer(const string&); +template FLS_API int8_t parse_integer(const string&); +template FLS_API int16_t parse_integer(const string&); +template FLS_API int32_t parse_integer(const string&); +template FLS_API int64_t parse_integer(const string&); } // namespace fastlanes diff --git a/src/utl/memory_usage.cpp b/src/utl/memory_usage.cpp index c99cf2d9..431dd38d 100644 --- a/src/utl/memory_usage.cpp +++ b/src/utl/memory_usage.cpp @@ -12,8 +12,9 @@ #elif defined(__linux__) #include #include -#else -#error "Unsupported platform" +#elif defined(_WIN32) +#include +#include #endif namespace fastlanes { @@ -39,6 +40,13 @@ uint64_t memoryUsageBytes() { long page_size = sysconf(_SC_PAGESIZE); return rss_pages * static_cast(page_size); +#elif defined(_WIN32) + PROCESS_MEMORY_COUNTERS pmc; + if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) { + return static_cast(pmc.WorkingSetSize); + } + return 0; + #endif } diff --git a/test/src/CMakeLists.txt b/test/src/CMakeLists.txt index f6a53189..8d8b42e2 100644 --- a/test/src/CMakeLists.txt +++ b/test/src/CMakeLists.txt @@ -1,3 +1,30 @@ +# On MSVC (and clang-cl), large heap allocations can touch guard pages whose +# transient 0xc0000005 exceptions are caught by GoogleTest's SEH wrapper, +# causing spurious test failures. This small static library installs a VEH +# handler that commits those pages before GTest intercepts the fault. +# On non-MSVC toolchains the source compiles to an empty translation unit. +add_library(msvc_heap_guard OBJECT msvc_heap_guard.cpp) + +# Helper: apply MSVC-specific linker/runtime settings to a test target. +# - Static builds: /WHOLEARCHIVE so all symbols are pulled in. +# - Shared builds: copy the DLL next to the test executable. +function(fls_msvc_test_setup TARGET) + if (NOT MSVC) + return() + endif () + if (NOT FLS_BUILD_SHARED_LIBS) + target_link_options(${TARGET} PRIVATE /WHOLEARCHIVE:FastLanes.lib) + else () + add_custom_command( + TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ + $ + COMMAND_EXPAND_LISTS + ) + endif () +endfunction() + add_subdirectory(dataset_tests) add_subdirectory(expression_tests) add_subdirectory(fls_reader_tests) diff --git a/test/src/dataset_tests/CMakeLists.txt b/test/src/dataset_tests/CMakeLists.txt index 21069be7..a2919d78 100644 --- a/test/src/dataset_tests/CMakeLists.txt +++ b/test/src/dataset_tests/CMakeLists.txt @@ -10,7 +10,8 @@ add_executable( tpch.cpp wrong_schema.cpp) -target_link_libraries(dataset_tests PUBLIC gtest_main gmock_main FastLanes) +target_link_libraries(dataset_tests PUBLIC gtest_main gmock_main FastLanes msvc_heap_guard) +fls_msvc_test_setup(dataset_tests) gtest_discover_tests(dataset_tests DISCOVERY_TIMEOUT 60) fls_enable_sanitizers(dataset_tests) diff --git a/test/src/dataset_tests/public_bi.cpp b/test/src/dataset_tests/public_bi.cpp index 40480d46..90b5bc6f 100644 --- a/test/src/dataset_tests/public_bi.cpp +++ b/test/src/dataset_tests/public_bi.cpp @@ -16,23 +16,23 @@ TEST_F(FastLanesReaderTester, Arade) { } TEST_F(FastLanesReaderTester, Bimbo) { - const vector constant_cols = {6}; - constexpr vector equal_cols = {}; // No equal columns found - const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found + const vector constant_cols = {6}; + const vector equal_cols = {}; // No equal columns found + const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found AllTest(public_bi::Bimbo, constant_cols, equal_cols, one_to_one_mapped_col_indexes); } TEST_F(FastLanesReaderTester, CMSprovider) { - const vector constant_cols = {20}; - constexpr vector equal_cols = {}; // No equal columns found - const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found + const vector constant_cols = {20}; + const vector equal_cols = {}; // No equal columns found + const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found AllTest(public_bi::CMSprovider, constant_cols, equal_cols, one_to_one_mapped_col_indexes); } TEST_F(FastLanesReaderTester, CityMaxCapita) { - const vector constant_cols = {10, 19}; - constexpr vector equal_cols = {}; // No equal columns found - const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found + const vector constant_cols = {10, 19}; + const vector equal_cols = {}; // No equal columns found + const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found AllTest(public_bi::CityMaxCapita, constant_cols, equal_cols, one_to_one_mapped_col_indexes); } @@ -67,17 +67,17 @@ TEST_F(FastLanesReaderTester, Eixo) { } TEST_F(FastLanesReaderTester, Euro2016) { - const vector constant_cols = {0}; - constexpr vector equal_cols = {}; + const vector constant_cols = {0}; + const vector equal_cols = {}; // -- one-to-one mapped columns: [(3, 4)] const vector one_to_one_mapped_col_indexes = {4}; AllTest(public_bi::Euro2016, constant_cols, equal_cols, one_to_one_mapped_col_indexes); } TEST_F(FastLanesReaderTester, Food) { - const vector constant_cols = {0}; - constexpr vector equal_cols = {}; // No equal columns found - const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found + const vector constant_cols = {0}; + const vector equal_cols = {}; // No equal columns found + const vector one_to_one_mapped_col_indexes = {}; // No one-to-one mapped columns found AllTest(public_bi::Food, constant_cols, equal_cols, one_to_one_mapped_col_indexes); } diff --git a/test/src/expression_tests/CMakeLists.txt b/test/src/expression_tests/CMakeLists.txt index fb978304..886f644f 100644 --- a/test/src/expression_tests/CMakeLists.txt +++ b/test/src/expression_tests/CMakeLists.txt @@ -1,6 +1,7 @@ macro(fls_add_test NAME SRC) add_executable(test_${NAME} ${SRC}) - target_link_libraries(test_${NAME} PUBLIC gtest_main gmock_main FastLanes) + target_link_libraries(test_${NAME} PUBLIC gtest_main gmock_main FastLanes msvc_heap_guard) + fls_msvc_test_setup(test_${NAME}) add_test(NAME test_${NAME} COMMAND $) fls_enable_sanitizers(test_${NAME}) endmacro() diff --git a/test/src/fls_reader_tests/CMakeLists.txt b/test/src/fls_reader_tests/CMakeLists.txt index 6c296db2..e31e6db0 100644 --- a/test/src/fls_reader_tests/CMakeLists.txt +++ b/test/src/fls_reader_tests/CMakeLists.txt @@ -6,7 +6,8 @@ add_executable( rowgroup_size_test.cpp verify_fastlanes_files_test.cpp) -target_link_libraries(fls_reader_tests PUBLIC gtest_main gmock_main FastLanes) +target_link_libraries(fls_reader_tests PUBLIC gtest_main gmock_main FastLanes msvc_heap_guard) +fls_msvc_test_setup(fls_reader_tests) gtest_discover_tests(fls_reader_tests DISCOVERY_TIMEOUT 60) fls_enable_sanitizers(fls_reader_tests) diff --git a/test/src/msvc_heap_guard.cpp b/test/src/msvc_heap_guard.cpp new file mode 100644 index 00000000..c7b3506c --- /dev/null +++ b/test/src/msvc_heap_guard.cpp @@ -0,0 +1,58 @@ +// ──────────────────────────────────────────────────────── +// | FastLanes | +// ──────────────────────────────────────────────────────── +// test/src/msvc_heap_guard.cpp +// ──────────────────────────────────────────────────────── + +// --------------------------------------------------------------------------- +// On Windows with the static CRT (/MT), large heap allocations (common when +// processing JPEG base64 data) may touch a heap-internal guard page, causing a +// transient STATUS_ACCESS_VIOLATION (0xc0000005). Under normal circumstances +// the NT heap manager's own vectored-exception handler commits the page and +// resumes execution transparently. +// +// GoogleTest, however, wraps every TEST body in an SEH __try/__except frame. +// Because SEH frames are evaluated *after* VEH handlers have all returned +// EXCEPTION_CONTINUE_SEARCH, the heap manager never gets the chance to handle +// the fault — GoogleTest's catch-all __except(EXCEPTION_EXECUTE_HANDLER) +// intercepts it first and reports a spurious test failure. +// +// The workaround below installs a first-chance VEH handler that recognises +// the specific pattern (read-AV on a page-aligned address inside the process +// heap) and commits the faulting page itself, then resumes execution — exactly +// what the heap manager would have done if GoogleTest's SEH frame were absent. +// --------------------------------------------------------------------------- +#ifdef _MSC_VER +#include + +static LONG WINAPI heap_guard_page_handler(EXCEPTION_POINTERS* ep) { + if (ep->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION) { + return EXCEPTION_CONTINUE_SEARCH; + } + + // Only handle *read* AVs (ExceptionInformation[0] == 0). + if (ep->ExceptionRecord->ExceptionInformation[0] != 0) { + return EXCEPTION_CONTINUE_SEARCH; + } + + const auto faulting_addr = reinterpret_cast(ep->ExceptionRecord->ExceptionInformation[1]); + + // Try to commit the faulting page. If it succeeds the page was a + // reserved-but-uncommitted guard region inside the heap — resume. + void* result = VirtualAlloc(faulting_addr, 1, MEM_COMMIT, PAGE_READWRITE); + if (result != nullptr) { + return EXCEPTION_CONTINUE_EXECUTION; // page committed — retry the instruction + } + + // Not a committable page — let something else handle it. + return EXCEPTION_CONTINUE_SEARCH; +} + +struct HeapGuardInstaller { + HeapGuardInstaller() { + AddVectoredExceptionHandler(1 /* first */, heap_guard_page_handler); + } +}; + +static HeapGuardInstaller g_heap_guard; +#endif diff --git a/test/src/primitive_tests/CMakeLists.txt b/test/src/primitive_tests/CMakeLists.txt index 336535d2..8739ae06 100644 --- a/test/src/primitive_tests/CMakeLists.txt +++ b/test/src/primitive_tests/CMakeLists.txt @@ -7,7 +7,9 @@ target_link_libraries(primitive_test PRIVATE gtest_main # GoogleTest’s main first FastLanes # your library second + msvc_heap_guard ) +fls_msvc_test_setup(primitive_test) fls_enable_sanitizers(primitive_test) diff --git a/test/src/quick_fuzz_tests/CMakeLists.txt b/test/src/quick_fuzz_tests/CMakeLists.txt index a48ccdfb..6bd386be 100644 --- a/test/src/quick_fuzz_tests/CMakeLists.txt +++ b/test/src/quick_fuzz_tests/CMakeLists.txt @@ -6,7 +6,9 @@ add_executable(quick_fuzz_test target_link_libraries(quick_fuzz_test PRIVATE GTest::gtest_main - FastLanes) + FastLanes + msvc_heap_guard) +fls_msvc_test_setup(quick_fuzz_test) fls_enable_sanitizers(quick_fuzz_test) diff --git a/test/src/quick_fuzz_tests/fuzz_config.json b/test/src/quick_fuzz_tests/fuzz_config.json index 889bc524..a9c7af5b 100644 --- a/test/src/quick_fuzz_tests/fuzz_config.json +++ b/test/src/quick_fuzz_tests/fuzz_config.json @@ -1,6 +1,6 @@ { "num_cases": 10, - "base_seed": 12, + "base_seed": 13, "delimiter": "|", "min_cols": 1, "max_cols": 2, diff --git a/test/src/unit_tests/CMakeLists.txt b/test/src/unit_tests/CMakeLists.txt index efd3daa3..5ee0a5bb 100644 --- a/test/src/unit_tests/CMakeLists.txt +++ b/test/src/unit_tests/CMakeLists.txt @@ -17,7 +17,9 @@ target_link_libraries(unit_test PRIVATE gtest_main # GoogleTest’s main first FastLanes # your library second + msvc_heap_guard ) +fls_msvc_test_setup(unit_test) fls_enable_sanitizers(unit_test)