Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SPIR-T as the default IR linker framework #999

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [PR#998](https://github.com/EmbarkStudios/rust-gpu/pull/998) added `extra_arg()` SpirvBuilder API to be able to set codegen args otherwise not supported by the API (for example, to set `--spirv-passes`).

### Changed 🛠
- [PR#999](https://github.com/EmbarkStudios/rust-gpu/pull/999) Made the [`SPIR-🇹` shader IR framework](https://github.com/EmbarkStudios/spirt) the default. You can opt-out using `--no-spirt` codegen arg.
- [PR#992](https://github.com/EmbarkStudios/rust-gpu/pull/992) renamed `rust-toolchain` to `rust-toolchain.toml`.
- [PR#991](https://github.com/EmbarkStudios/rust-gpu/pull/991) updated toolchain to `nightly-2023-01-21`.
- [PR#990](https://github.com/EmbarkStudios/rust-gpu/pull/990) removed return type inference from `Image` API and made `glam` usage mandatory.
Expand Down
6 changes: 3 additions & 3 deletions crates/rustc_codegen_spirv/src/codegen_cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ impl CodegenArgs {

opts.optflag(
"",
"spirt",
"use SPIR-T for legalization (see also `docs/src/codegen-args.md`)",
"no-spirt",
"disable SPIR-T for legalization (see also `docs/src/codegen-args.md`)",
oisyn marked this conversation as resolved.
Show resolved Hide resolved
);
opts.optmulti(
"",
Expand Down Expand Up @@ -537,7 +537,7 @@ impl CodegenArgs {
dce: !matches.opt_present("no-dce"),
compact_ids: !matches.opt_present("no-compact-ids"),
structurize: !matches.opt_present("no-structurize"),
spirt: matches.opt_present("spirt"),
spirt: !matches.opt_present("no-spirt"),
spirt_passes: matches
.opt_strs("spirt-passes")
.iter()
Expand Down
7 changes: 6 additions & 1 deletion docs/src/codegen-args.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ anyway, be careful).

Disables CFG structurization. Probably results in invalid modules.

### `--spirt`
### `--spirt` <sub>_(until 0.6.0)_</sub>

Note: as of `rust-gpu 0.6.0`, `SPIR-🇹` is enabled by default. Use `--no-spirt` to disable.

Enables using the experimental [`SPIR-🇹` shader IR framework](https://github.com/EmbarkStudios/spirt) in the linker - more specifically, this:
- adds a `SPIR-V -> SPIR-🇹 -> SPIR-V` roundtrip
Expand All @@ -149,6 +151,9 @@ Enables using the experimental [`SPIR-🇹` shader IR framework](https://github.

For more information, also see [the `SPIR-🇹` repository](https://github.com/EmbarkStudios/spirt).

### `--no-spirt` <sub>_(0.6.0)_</sup>
Disables the [`SPIR-🇹` shader IR framework](https://github.com/EmbarkStudios/spirt) in the linker.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! I was wondering how we should do this, and I like your choice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you're referring to the version numbers? We should probably add some others retroactively as well :)

### `--spirt-passes PASSES`

Enable additional `SPIR-🇹` passes, as listed in `PASSES` (comma-separated).
Expand Down
4 changes: 2 additions & 2 deletions tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ impl Runner {
.join(DepKind::ProcMacro.target_dir_suffix(&target)),
],
);
if spirt {
flags += " -Cllvm-args=--spirt";
if !spirt {
flags += " -Cllvm-args=--no-spirt";
}

let config = compiletest::Config {
Expand Down