mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 20:31:20 +00:00
tint/uniformity: filter should not affect result
A derivative_uniformity diagnostic filter should not affect the uniformity of the return value of a derivative builtin. Fixed: tint:1815 Change-Id: I58e714978dab747598af5136dc9808a5a658c60e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118001 Commit-Queue: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
d9f659670d
commit
072f83c682
@ -1512,8 +1512,8 @@ class UniformityGraph {
|
|||||||
sem_.DiagnosticSeverity(call, ast::DiagnosticRule::kDerivativeUniformity);
|
sem_.DiagnosticSeverity(call, ast::DiagnosticRule::kDerivativeUniformity);
|
||||||
if (severity != ast::DiagnosticSeverity::kOff) {
|
if (severity != ast::DiagnosticSeverity::kOff) {
|
||||||
callsite_tag = {CallSiteTag::CallSiteRequiredToBeUniform, severity};
|
callsite_tag = {CallSiteTag::CallSiteRequiredToBeUniform, severity};
|
||||||
function_tag = ReturnValueMayBeNonUniform;
|
|
||||||
}
|
}
|
||||||
|
function_tag = ReturnValueMayBeNonUniform;
|
||||||
} else if (builtin->IsAtomic()) {
|
} else if (builtin->IsAtomic()) {
|
||||||
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
||||||
function_tag = ReturnValueMayBeNonUniform;
|
function_tag = ReturnValueMayBeNonUniform;
|
||||||
|
@ -8132,6 +8132,40 @@ test:35:7 note: reading from read_write storage buffer 'non_uniform' may result
|
|||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(UniformityAnalysisDiagnosticFilterTest, BuiltinReturnValueNotAffected) {
|
||||||
|
// Make sure that a diagnostic filter does not affect the uniformity of the return value of a
|
||||||
|
// derivative builtin.
|
||||||
|
std::string src = R"(
|
||||||
|
fn foo() {
|
||||||
|
var x: f32;
|
||||||
|
|
||||||
|
@diagnostic(off,derivative_uniformity) {
|
||||||
|
x = dpdx(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < 0.5) {
|
||||||
|
_ = dpdy(1.0); // Should trigger an error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)";
|
||||||
|
|
||||||
|
RunTest(src, false);
|
||||||
|
EXPECT_EQ(error_,
|
||||||
|
R"(test:10:9 error: 'dpdy' must only be called from uniform control flow
|
||||||
|
_ = dpdy(1.0); // Should trigger an error
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
test:9:3 note: control flow depends on possibly non-uniform value
|
||||||
|
if (x < 0.5) {
|
||||||
|
^^
|
||||||
|
|
||||||
|
test:6:9 note: return value of 'dpdx' may be non-uniform
|
||||||
|
x = dpdx(1.0);
|
||||||
|
^^^^
|
||||||
|
)");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(UniformityAnalysisDiagnosticFilterTest, BarriersNotAffected) {
|
TEST_F(UniformityAnalysisDiagnosticFilterTest, BarriersNotAffected) {
|
||||||
// Make sure that the diagnostic filter does not affect barriers.
|
// Make sure that the diagnostic filter does not affect barriers.
|
||||||
std::string src = R"(
|
std::string src = R"(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user