-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmcpp.toml
More file actions
69 lines (61 loc) · 2.85 KB
/
Copy pathmcpp.toml
File metadata and controls
69 lines (61 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
[package]
name = "vulkan-saxpy"
namespace = "example"
version = "0.1.0"
description = "A Vulkan compute shader behind a seam module, with a CPU fallback"
accelerators = ["vulkan"]
[language]
standard = "c++23"
modules = true
import_std = true
# The rule that compiles the shaders lives in the official plugin collection,
# selected by its feature; `build.mcpp` imports it as `mcpp.rules.spirv`.
[build-dependencies.mcpp]
plugins = { version = "0.5.2", features = ["rules-spirv"], host-module = true }
# The Khronos loader, built by the index rather than taken from the host, and
# the adapter that makes the host's own ICDs reachable from a binary running
# under mcpp's private loader. Neither one is a driver: a driver has to match
# the kernel module on the machine it runs on, which is why the software one
# below is a payload and the hardware ones are the host's.
[dependencies.compat]
vulkan = "1.4.357.0"
vulkan-runtime = "2026.09.10"
# ONE payload here, and the shader compiler is not it: `mcpp.rules.spirv`
# declares `xim:glslang` for itself. What stays is a DEVICE, and the boundary is
# the point -- a rule declares what it needs to COMPILE, a project declares what
# it needs to RUN. A rule that shipped a software renderer would force one onto
# every consumer that has a GPU.
[xlings.workspace]
# A Vulkan device that needs no GPU: Mesa's lavapipe as a payload, complete
# with its own LLVM. On a machine with a vendor ICD the loader lists both and
# the program picks the discrete GPU; with none -- a CI runner, a sandbox --
# this is the device the artifact runs on. Selected explicitly with
# VK_DRIVER_FILES=<payload>/share/vulkan/icd.d/lvp_icd.x86_64.json.
"xim:mesa-lavapipe" = "26.2.1"
[build]
# What this build compiles device code FOR. `vulkan1.2` is the SPIR-V target
# environment, and the rule package derives `--target-env` from it: the same
# route by which `sm_89` reaches nvcc in examples/09. Unlike CUDA there is no
# architecture set, because SPIR-V is the portable form and which device
# executes it is decided by the driver at run time.
accel = "vulkan1.2"
sources = [
"src/*.cppm",
"src/*.cpp",
# The shaders carry the accel they are for. They are not C++ and the engine
# never offers them to the C++ compiler; the constrained glob is what routes
# them to the build program instead.
{ glob = "shaders/*.comp", accel = "vulkan1.2" },
]
include_dirs = ["include"]
# The Vulkan island, compiled only when the build names the accelerator.
[target.'cfg(accelerator = "vulkan")'.build]
sources = ["src/vulkan/*.cpp"]
# The CPU-only variant: the same seam, a plain loop behind it. This is what
# `mcpp build --no-accel` produces, and the two files define the same symbol
# and are never in one link.
[target.'cfg(not(accelerator = "vulkan"))'.build]
sources = ["src/cpu/*.cpp"]
[targets.vulkan-saxpy]
kind = "bin"
main = "src/main.cpp"