Skip to content

Workflow file for this run

name: Check Vectorization by Compiler
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
env:
FILE: src/util/sample.cpp
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
os: ubuntu-latest,
compiler: gcc,
flags: "-O3 -ftree-vectorize -fopt-info-vec-optimized",
}
- {
os: macOS-latest,
compiler: clang,
flags: "-O3 -Rpass=loop-vectorize",
}
- { os: windows-latest, compiler: cl, flags: "/O2 /Qvec-report:2" }
steps:
- name: "Check out repository"
uses: actions/checkout@v4.1.6
with:
# This is necessary for making `git describe` work.
fetch-depth: 0
- name: "Ensure that all tags are fetched"
# Works around an issue where not the latest tag is not fetched when the
# workflow is triggered by a tag push event.
# Possibly related: actions/checkout#290
run: git fetch origin --force --tags
- name: Set up compiler
run: |
if [ "${{ matrix.config.compiler }}" = "gcc" ]; then
sudo apt-get install -y ${{ matrix.config.compiler }}
fi
- name: Compile and check vectorization
id: check
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
OUTPUT=$(pwsh -c "& '${{ matrix.config.compiler }}' ${matrix.config.flags} '${{ env.FILE }}'")
echo "result=$OUTPUT" >> $GITHUB_ENV
else
OUTPUT=$("${{ matrix.config.compiler }}" ${matrix.config.flags} "${{ env.FILE }}")
echo "result=$OUTPUT" >> $GITHUB_ENV
fi
- name: Print vectorization results
id: evaluate
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "result=$OUTPUT" >> $GITHUB_ENV
else
echo "result=$OUTPUT" >> $GITHUB_ENV
fi
- name: Print result
run: echo "${{ env.result }}"
report:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create report
run: |
echo "OS, Compiler, Function, Vectorized"
echo "${{ needs.build.outputs.result }}"