okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge branch 'f-139b-arc' into f-139-relad33b8074

main
1.6 KiB26 linesraw
1#!/usr/bin/env bash
2# normalize.sh <dpct-out-dir> <upstream-commit>: a fresh migrate.sh output in the port's shape, for a 3-way merge.
3#   - dpct's `X.cpp.dp.cpp` becomes `X.cpp` (the .cu -> .dp.cpp names stay), its .yaml/report files go
4#   - files dpct left byte-identical to the upstream original go too (sycl/CMakeLists.txt falls back to them)
5#   - the DPCTnnnn:<serial> message numbers are dropped (they renumber on every run and would be pure noise)
6#   - fixups.py runs on the result
7# Updating the port after an upstream merge (docs/INTEL.md "Keeping up with upstream"):
8#   migrate the OLD upstream tree to sycl-base and the merged tree to sycl-new, normalize both with their
9#   commits, then for every file in both:  git merge-file sycl/F sycl-base/F sycl-new/F
10set -euo pipefail
11d=$(cd "$1" && pwd); rev=$2; repo=$(cd "$(dirname "$0")/../.." && pwd)
12cd "$d"
13find . -name '*.yaml' -delete; rm -f dpct_report.*
14find . -name '*.cpp.dp.cpp' | while read -r f; do mv "$f" "${f%.cpp.dp.cpp}.cpp"; done
15n=0
16while read -r f; do
17  rel=${f#./}; orig=$rel; [[ $rel == *.dp.cpp ]] && orig=${rel%.dp.cpp}.cu
18  if git -C "$repo" cat-file -e "$rev:$orig" 2>/dev/null && cmp -s "$f" <(git -C "$repo" show "$rev:$orig"); then
19    rm "$f"; n=$((n+1))
20  fi
21done < <(find src include third_party -type f 2>/dev/null)
22find . -type d -empty -delete
23find src include -type f -exec sed -i -E 's/DPCT([0-9]{4}):[0-9]+:/DPCT\1:/' {} +
24mkdir -p tools && cp "$repo/sycl/tools/fixups.py" tools/
25python3 tools/fixups.py > fixups.log 2>&1 || { tail -5 fixups.log; exit 1; }
26echo "$d: dropped $n unchanged files, $(find src include -type f | wc -l) remain, fixups applied: $(grep -c fixed fixups.log)"