You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A rule package declares what it compiles, so a new device language costs no engine change
Two keys on a feature, and the engine holds no package name, no feature
spelling and no module name:
[features.rules-slang]
sources = ["rules/slang.cppm"]
rule_module = "mcpp.rules.slang"
device_extensions = [".slang"]
`device_extensions` classifies those extensions as device sources in a consumer
that activates the feature. `rule_module` is what a build program imports to
reach the rule. Two things follow.
A NEW DEVICE LANGUAGE NO LONGER TOUCHES THE ENGINE. Adding `.slang` to the
built-in table cost an engine change, a release, and a version bump in the rule
package's CI before the rule could route one file. `.slang` is removed from that
table here and `rules-slang` declares it instead; `tests/slang-consumer` builds
and runs unchanged, which is the only honest test of whether the mechanism
carries a language. The built-in list is now what mcpp knows without being told
-- a compatibility set for languages whose support shipped before the
declaration existed -- rather than a registry a sixth backend joins.
A CONSUMER WRITES ONE EDGE AND NO BUILD PROGRAM. `host-module = true` is implied
by `rule_module`, because a feature naming one has already said that is the only
way to use it. And a package with no `build.mcpp` gets the program its rules
describe written into the build directory:
[build-dependencies.mcpp]
plugins = { version = "0.3.0", features = ["rules-spirv"] }
is the whole declaration in `tests/spirv-zero-config`, which compiles a shader
and reaches it through a generated module. A project that writes its own
`build.mcpp` keeps it: synthesis fills an absence and never overrides.
THE FEATURE IS STILL REQUESTED BY NAME. An earlier revision derived it from the
extensions a project's sources carried, so a consumer could name the package
alone. That was withdrawn for two reasons and neither was cost. Two packages may
claim one extension -- a third-party CUDA rule is a thing someone will write --
and derivation would then guess or refuse where `features = [...]` has already
said which. And a manifest's job is to describe the build: a derived feature set
is information the file no longer states, which is worse for a reader and worse
for anything reading the manifest as context.
Which rules ran is said out loud, for the same reason the resolved toolchain is:
Rules mcpp.rules.spirv (mcpp:plugins)
Two ordering defects were found by running it rather than by reading it. The
collection must sit between feature activation and the extension table that
narrows the constrained globs; placed after, the declared extensions arrived too
late to classify anything and the rule was handed an empty list. And the guard
on the build-program call asked whether the FILE existed while the function
asked whether a program was WANTED, which left the synthesis unreachable. Both
now ask the same question, and the comments say what the failure looked like.
0 commit comments