tint: Implement pointer alias analysis

Track reads and writes to pointer parameters for each function in the
Resolver, as well as accesses to module-scope variables. At function
call sites, check the root identifiers of each pointer argument to
determine if problematic aliasing occurs.

The MSL backend passes pointers to sub-objects to functions when
handling workgroup storage variables, which triggers the alias
analysis. Add a validation override for this scenario.

Bug: tint:1675

Change-Id: I81a40d1309df65521cc5ad39764d6a09a260f51e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110167
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
James Price
2022-11-17 17:27:27 +00:00
committed by Dawn LUCI CQ
parent d6f9a8a253
commit 4d65fc91bb
10 changed files with 1128 additions and 0 deletions

View File

@@ -43,6 +43,8 @@ std::string DisableValidationAttribute::InternalName() const {
return "disable_validation__ignore_stride";
case DisabledValidation::kIgnoreInvalidPointerArgument:
return "disable_validation__ignore_invalid_pointer_argument";
case DisabledValidation::kIgnorePointerAliasing:
return "disable_validation__ignore_pointer_aliasing";
}
return "<invalid>";
}

View File

@@ -42,6 +42,9 @@ enum class DisabledValidation {
/// When applied to a pointer function parameter, the validator will not require a function call
/// argument passed for that parameter to have a certain form.
kIgnoreInvalidPointerArgument,
/// When applied to a function declaration, the validator will not complain if multiple
/// pointer arguments alias when that function is called.
kIgnorePointerAliasing,
};
/// An internal attribute used to tell the validator to ignore specific