Skip to content

feat(compat.spirv-headers): the headers a SPIR-V reader needs - #358

Merged
Sunrisepeak merged 1 commit into
mainfrom
feat/spirv-headers-and-llamacpp-vulkan
Sep 6, 2026
Merged

feat(compat.spirv-headers): the headers a SPIR-V reader needs#358
Sunrisepeak merged 1 commit into
mainfrom
feat/spirv-headers-and-llamacpp-vulkan

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What

A new index entry, compat:spirv-headers@1.4.357.0 — the Khronos
spirv/unified1 tree — plus a workspace test member that decodes a hand-built
SPIR-V module header with it.

Why

A program that only submits SPIR-V to a driver needs nothing from this
package: the module is opaque data and vulkan_core.h describes the call that
takes it. A program that reads one needs the opcode and enum definitions.

llama.cpp's Vulkan backend is such a program — ggml-vulkan.cpp inspects the
modules its own shader generator produced, through
<spirv/unified1/spirv.hpp>. The index carried compat.vulkan-headers and not
this, so that consumer had nowhere in the ecosystem to get it and would have
resolved it from the host's /usr/include.

Split rather than folded into compat.vulkan-headers, following Khronos: they
are separate repositories on separate cadences, and a renderer that never
decodes SPIR-V should not acquire the decoder's headers.

Notes

  • The licence is written as a set. The bulk is MIT; upstream's own LICENSE
    calls out files under CC-BY-4.0 and ships LICENSES/ carrying both texts.
  • The CN mirror is published and verified byte-identical to the upstream
    archive, so the entry takes the table form rather than the plain-string
    fallback.
  • The test decodes rather than compiles. A header-only package that resolves
    and exposes the wrong include root compiles nothing, so "it compiled" would
    pass on a package that delivered an empty tree.

Measured

$ cd tests/examples/spirv-headers && mcpp test
 Downloading compat.spirv-headers v1.4.357.0
   Compiling compat.spirv-headers v1.4.357.0
     Running bin/decode
compat.spirv-headers: SPIR-V 1.6 definitions present
 test result ok. 1 passed; 0 failed

…the index did not carry

A program that only SUBMITS SPIR-V to a driver needs nothing from this package:
the module is opaque data and `vulkan_core.h` describes the call that takes it.
A program that READS one needs the opcode and enum definitions, and llama.cpp's
Vulkan backend is such a program -- it inspects the modules its own shader
generator produced, through `<spirv/unified1/spirv.hpp>`.

The index carried `compat.vulkan-headers` and not this, so that consumer had
nowhere in the ecosystem to get it and would have fallen back to the host's
`/usr/include`, which is exactly the dependency this ecosystem removes.

Split rather than folded into `compat.vulkan-headers`, following Khronos: they
are separate repositories on separate cadences, and a renderer that never
decodes SPIR-V should not acquire the decoder's headers.

The licence is written as a set. The bulk is MIT; upstream's own LICENSE calls
out files under CC-BY-4.0 and ships LICENSES/ carrying both texts.

The CN mirror is published and verified byte-identical to the upstream archive
(sha256 4d703067a7e0...), so the entry takes the table form rather than the
plain-string fallback.

The test decodes a hand-built module header rather than asserting that the
include compiles. A header-only package that resolves and exposes the wrong
include root compiles nothing, so "it compiled" would pass on a package that
delivered an empty tree; reading spv::MagicNumber, spv::OpCapability and
spv::ExecutionModelGLCompute back distinguishes the two.
@Sunrisepeak
Sunrisepeak merged commit 40ce676 into main Sep 6, 2026
11 checks passed
@Sunrisepeak
Sunrisepeak deleted the feat/spirv-headers-and-llamacpp-vulkan branch September 6, 2026 01:20
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