Skip to content

Restructure llvm-patches into per-version directories - #1414

Merged
pvelesko merged 7 commits into
mainfrom
llvm-patches-simplify
Jul 31, 2026
Merged

Restructure llvm-patches into per-version directories#1414
pvelesko merged 7 commits into
mainfrom
llvm-patches-simplify

Conversation

@pvelesko

Copy link
Copy Markdown
Collaborator

Replaces the flat llvm-patches layout and the ~115 lines of per-patch version gating in configure_llvm.sh with self-contained directories llvm-patches/llvm-{20,21,22} applied in numeric order (script: 412 to 349 lines). LLVM 17/18/19 support is dropped (17/18 could not build), the no-op archive-data-layout and fp_fast_mode patches are deleted, the debug info patch now matches the merged form of llvm/llvm-project#210504 including SPV_INTEL_optnone, and --version latest clones the maintained chipStar-llvm-23 branch. Every series applies cleanly to pristine release branches, and all three versions were built on Aurora with gdb-oneapi -g debugging validated per #1350.

pvelesko added 7 commits July 30, 2026 17:12
Replace the flat llvm-patches/{llvm,spirv-translator} layout, where every
patch was applied to every LLVM version through ~115 lines of skip logic
in configure_llvm.sh, with self-contained per-version directories:

  llvm-patches/llvm-{20,21,22}/{llvm,spirv-translator}/NNNN-*.patch

Patches apply in numeric order to pristine release/<V>.x and
llvm_release_<V>0 trees with no gating and no cross-patch offsets.
Verified per version: the resulting tree is identical to what the old
pipeline produced, except for three intended deltas:

- Dropped 0005-fix-archive-data-layout.patch: verified no-op on every
  supported version; upstream IRMover already inherits the data layout
  (IRMover.cpp, present since llvmorg-17).
- Dropped spirv-translator fp_fast_mode patch: lit-test-only change,
  re-inserting a flag removed upstream; zero product-code effect.
- Added preserve-device-debug-info (was untracked 0007): upstream
  llvm#210504, first ships in LLVM 24.

Old 0001-Allow-up-to-v1.2 + 0004-only-necessary-exts are merged into a
single spirv-version-and-extensions patch per version, retiring the
llvm22-specific combined variant. llvm-21-macos.patch (applied by
nothing, conflicted with configure_llvm.sh output) and the LLVM 17/18
translator variant are deleted. LLVM 17/18/19 support is dropped; 17/18
were unbuildable (macos patch and phi-coalesce patch fail to apply).

Each patch header carries Applies-to and Upstream-Status lines.
Patch application is now: apply everything in
llvm-patches/llvm-${VERSION}/{llvm,spirv-translator}/*.patch in numeric
order, hard-failing on the first error. All per-patch version gating is
gone (412 -> 349 lines).

--version accepts 20, 21, 22, or latest. latest clones the maintained
CHIP-SPV/llvm-project branch chipStar-llvm-23 (single-branch) plus
translator llvm_release_230 and applies no patches; it is labeled
experimental. Everything else (retry, arg parsing, binutils handling,
variant/link-type, -N and --configure-only flows) is unchanged.

presubmit.yml matrix pins move 19 -> 20 since the script now rejects 19.
PoCL 7.1 supports LLVM 20 and chipStar-llvm-20 cache-key branches exist.
README.md: prerequisites and toolchain instructions now name LLVM 20/21/22
(+ experimental latest via the maintained chipStar-llvm-23 branch); manual
steps clone upstream release branches and apply llvm-patches/llvm-<V>/.

MacOS-Issues.md, docs/MacOS.md: llvm-21-macos.patch is gone; macOS support
is applied automatically by configure_llvm.sh from the per-version dirs.
Stale LLVM 19 references in live instructions updated; historical issue
write-ups left as-is.
Sync the preserve-device-debug-info patch in all three version dirs with
the final merged form of llvm#210504: its second commit (f44bf2b4ce5c)
also enables SPV_INTEL_optnone when -g is given. clang emits the optnone
attribute at -O0; without the extension the translator drops it, the
device compiler optimizes the kernel anyway, and gdb-oneapi reports every
local as <optimized out> - the exact symptom of chipStar#1004. Verified
each series still applies cleanly to pristine release/{20,21,22}.x.
LLVMCheck.cmake allowed clang 14+ with CLANG_VERSION_LESS_{15,16,17}
feature flags. With LLVM 17/18/19 toolchain support dropped, raise the
floor to 20 and remove the flag ladder. The remaining
CLANG_VERSION_LESS_* consumers (CMakeLists.txt:366,699,
bitcode/CMakeLists.txt:33) evaluate correctly with the flags never set.
docker.md: DockerfileFull section now states reality - it is stale and
broken (builds LLVM 16, which is no longer supported, and passes
--only-necessary-spirv-exts, an option configure_llvm.sh no longer has)
with rework notes for the supported 20/21/22 set. DockerfileLatest
section: stale LLVM 15 reference corrected to the actual LLVM 22 native
setup. DockerfileBase: patch-dir layout comment updated to the
per-version llvm-patches/llvm-<V>/ scheme.
It built LLVM 16 with a configure_llvm.sh option that no longer exists,
was referenced by nothing, and could not have worked for years. Deleted
along with its docker.md section.
@pvelesko
pvelesko merged commit 294dd5a into main Jul 31, 2026
43 of 44 checks passed
@pvelesko
pvelesko deleted the llvm-patches-simplify branch July 31, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant