[tint] Fail gracefully for subgroup matrices in backends
Most of the backends do not support subgroup matrices yet. Failing
gracefully is required to avoid the fuzzer check failing on the
upcoming E2E tests.
Bug: 348702031
Change-Id: Ic16f79c642d06cf99f43dce29ca91ac69151ee1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/224194
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/glsl/writer/writer.cc b/src/tint/lang/glsl/writer/writer.cc
index eec4486..fd245b8 100644
--- a/src/tint/lang/glsl/writer/writer.cc
+++ b/src/tint/lang/glsl/writer/writer.cc
@@ -41,6 +41,13 @@
namespace tint::glsl::writer {
Result<SuccessType> CanGenerate(const core::ir::Module& ir, const Options& options) {
+ // Check for unsupported types.
+ for (auto* ty : ir.Types()) {
+ if (ty->Is<core::type::SubgroupMatrix>()) {
+ return Failure("subgroup matrices are not supported by the GLSL backend");
+ }
+ }
+
// Make sure that every texture variable is in the texture_builtins_from_uniform binding list,
// otherwise TextureBuiltinsFromUniform will fail.
// Also make sure there is at most one user-declared push_constant, and make a note of its size.
@@ -55,7 +62,7 @@
// The pixel_local extension is not supported by the GLSL backend.
if (ptr->AddressSpace() == core::AddressSpace::kPixelLocal) {
- return Failure("pixel_local address space is not supported by the ");
+ return Failure("pixel_local address space is not supported by the GLSL backend");
}
if (ptr->StoreType()->Is<core::type::Texture>()) {
diff --git a/src/tint/lang/hlsl/writer/writer.cc b/src/tint/lang/hlsl/writer/writer.cc
index 0e08754..7a723df 100644
--- a/src/tint/lang/hlsl/writer/writer.cc
+++ b/src/tint/lang/hlsl/writer/writer.cc
@@ -43,6 +43,13 @@
namespace tint::hlsl::writer {
Result<SuccessType> CanGenerate(const core::ir::Module& ir, const Options& options) {
+ // Check for unsupported types.
+ for (auto* ty : ir.Types()) {
+ if (ty->Is<core::type::SubgroupMatrix>()) {
+ return Failure("subgroup matrices are not supported by the HLSL backend");
+ }
+ }
+
// Check for unsupported module-scope variable address spaces and types.
for (auto* inst : *ir.root_block) {
auto* var = inst->As<core::ir::Var>();
diff --git a/src/tint/lang/spirv/writer/writer.cc b/src/tint/lang/spirv/writer/writer.cc
index cd336a7..9d0d926 100644
--- a/src/tint/lang/spirv/writer/writer.cc
+++ b/src/tint/lang/spirv/writer/writer.cc
@@ -42,6 +42,13 @@
namespace tint::spirv::writer {
Result<SuccessType> CanGenerate(const core::ir::Module& ir, const Options& options) {
+ // Check for unsupported types.
+ for (auto* ty : ir.Types()) {
+ if (ty->Is<core::type::SubgroupMatrix>()) {
+ return Failure("subgroup matrices are not supported by the SPIR-V backend");
+ }
+ }
+
// If a remapped entry point name is provided, it must not be empty, and must not contain
// embedded null characters.
if (!options.remapped_entry_point_name.empty()) {