tint: Simplify workgroup size resolving

A `@workgroup_size()` value must be a constant or override expression.
There's nothing specific here about literals or variable expressions.

Remove the semantic tracking of override variables, as these can be override expressions.
The backends will require the `SubstituteOverride` transform to be run, so gut the workgroup_size override handling from the backends.

Bug: tint:1633
Change-Id: Ib3ff843fc64a3595d49223c661b4d58130c0ab30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100142
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2022-09-21 21:05:45 +00:00
committed by Dawn LUCI CQ
parent 45a2c5193a
commit 490d9889a7
13 changed files with 202 additions and 166 deletions

View File

@@ -148,9 +148,9 @@ EntryPoint Inspector::GetEntryPoint(const tint::ast::Function* func) {
entry_point.stage = PipelineStage::kCompute;
auto wgsize = sem->WorkgroupSize();
if (!wgsize[0].overridable_const && !wgsize[1].overridable_const &&
!wgsize[2].overridable_const) {
entry_point.workgroup_size = {wgsize[0].value, wgsize[1].value, wgsize[2].value};
if (wgsize[0].has_value() && wgsize[1].has_value() && wgsize[2].has_value()) {
entry_point.workgroup_size = {wgsize[0].value(), wgsize[1].value(),
wgsize[2].value()};
}
break;
}
@@ -849,19 +849,18 @@ void Inspector::GenerateSamplerTargets() {
auto* t = c->args[static_cast<size_t>(texture_index)];
auto* s = c->args[static_cast<size_t>(sampler_index)];
GetOriginatingResources(
std::array<const ast::Expression*, 2>{t, s},
[&](std::array<const sem::GlobalVariable*, 2> globals) {
auto texture_binding_point = globals[0]->BindingPoint();
auto sampler_binding_point = globals[1]->BindingPoint();
GetOriginatingResources(std::array<const ast::Expression*, 2>{t, s},
[&](std::array<const sem::GlobalVariable*, 2> globals) {
auto texture_binding_point = globals[0]->BindingPoint();
auto sampler_binding_point = globals[1]->BindingPoint();
for (auto* entry_point : entry_points) {
const auto& ep_name =
program_->Symbols().NameFor(entry_point->Declaration()->symbol);
(*sampler_targets_)[ep_name].Add(
{sampler_binding_point, texture_binding_point});
}
});
for (auto* entry_point : entry_points) {
const auto& ep_name = program_->Symbols().NameFor(
entry_point->Declaration()->symbol);
(*sampler_targets_)[ep_name].Add(
{sampler_binding_point, texture_binding_point});
}
});
}
}