Skip to content

spirv-fuzz: Use validator to check break/continue dominance conditions#3089

Merged
afd merged 1 commit intoKhronosGroup:masterfrom
afd:fuzzer-validate-add-dead-break-and-continue
Dec 6, 2019
Merged

spirv-fuzz: Use validator to check break/continue dominance conditions#3089
afd merged 1 commit intoKhronosGroup:masterfrom
afd:fuzzer-validate-add-dead-break-and-continue

Conversation

@afd
Copy link
Copy Markdown
Contributor

@afd afd commented Dec 6, 2019

The passes that add dead breaks and continues suffer from the
challenge that a new control flow graph edge can change dominance
information, leading to the potenital for definitions to no longer
dominate their uses. The attempt at guarding against this was known
to be incomplete. This change calls on the SPIR-V validator to do the
necessary checking: in deciding whether adding such an edge would be
legitimate, we clone the module, add the edge, and use the validator
to check whether the transformed clone is valid.

This strategy is heavy-weight, and should be used sparingly, but seems
like a good option when the validity of transformations is intricate,
to avoid reimplementing swathes of validation logic in the fuzzer.

Fixes #2919.

The passes that add dead breaks and continues suffer from the
challenge that a new control flow graph edge can change dominance
information, leading to the potenital for definitions to no longer
dominate their uses.  The attempt at guarding against this was known
to be incomplete.  This change calls on the SPIR-V validator to do the
necessary checking: in deciding whether adding such an edge would be
legitimate, we clone the module, add the edge, and use the validator
to check whether the transformed clone is valid.

This strategy is heavy-weight, and should be used sparingly, but seems
like a good option when the validity of transformations is intricate,
to avoid reimplementing swathes of validation logic in the fuzzer.

Fixes KhronosGroup#2919.
@afd afd requested a review from paulthomson December 6, 2019 09:28
Copy link
Copy Markdown
Contributor

@paulthomson paulthomson left a comment

Choose a reason for hiding this comment

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

Looks good. As discussed, we could might be able to save performance a bit by: adding the edge, recompute dominance in opt, check dominance using opt, removing the edge if needed. But recomputing dominance might be the bottleneck anyway.

@afd afd merged commit 983b5b4 into KhronosGroup:master Dec 6, 2019
@afd afd deleted the fuzzer-validate-add-dead-break-and-continue branch December 6, 2019 16:38
dneto0 pushed a commit to dneto0/SPIRV-Tools that referenced this pull request Sep 14, 2024
Roll third_party/glslang/ 0de87ee..6c47979 (4 commits)

KhronosGroup/glslang@0de87ee...6c47979

$ git log 0de87ee..6c47979 --date=short --no-merges --format='%ad %ae %s'
2019-12-09 cepheus Fix KhronosGroup#2020: PR KhronosGroup#1977 broke HLSL member consistency, this finishes it...
2019-12-09 cepheus Fix: KhronosGroup#2014: Don't do "extension-on && version >= ..." keyword checks.
2019-12-09 cepheus Fix KhronosGroup#2007: Fix a couple relative header paths in header files.
2019-12-09 cepheus Fix KhronosGroup#1993: Fully exclude ftransform() from SPIR-V semantics.

Roll third_party/googletest/ ae8d1fc81..78fdd6c00 (6 commits)

google/googletest@ae8d1fc...78fdd6c

$ git log ae8d1fc81..78fdd6c00 --date=short --no-merges --format='%ad %ae %s'
2019-12-05 absl-team Googletest export
2019-12-05 absl-team Googletest export
2019-12-05 absl-team Googletest export
2019-11-27 krystian.kuzniarek Revert "remove MSVC workaround: wmain link error in the static library"
2019-11-27 krystian.kuzniarek Revert "unify googletest and googlemock main functions"
2019-11-17 krystian.kuzniarek remove MSVC workaround: cease const dropping

Roll third_party/re2/ bb8e77755..6a86f6b3f (1 commit)

google/re2@bb8e777...6a86f6b

$ git log bb8e77755..6a86f6b3f --date=short --no-merges --format='%ad %ae %s'
2019-12-09 junyer Simplify the bytecode for the 80-10FFFF rune range.

Roll third_party/spirv-cross/ 15b860eb1..f912c3289 (2 commits)

KhronosGroup/SPIRV-Cross@15b860e...f912c32

$ git log 15b860eb1..f912c3289 --date=short --no-merges --format='%ad %ae %s'
2019-12-10 post GLSL: Fix array of input patch variables.
2019-12-09 post GLSL: Fix EmitStreamVertex/Primitive.

Roll third_party/spirv-tools/ e82a428..0a2b38d (2 commits)

KhronosGroup/SPIRV-Tools@e82a428...0a2b38d

$ git log e82a428..0a2b38d --date=short --no-merges --format='%ad %ae %s'
2019-12-10 afdx spirv-fuzz: function outlining fuzzer pass (KhronosGroup#3078)
2019-12-06 afdx spirv-fuzz: Use validator to check break/continue dominance conditions (KhronosGroup#3089)

Created with:
  roll-dep third_party/effcee third_party/glslang third_party/googletest third_party/re2 third_party/spirv-cross third_party/spirv-headers third_party/spirv-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spirv-fuzz: transformations can (again) lead to invalid shader: ID ... defined in block ... does not dominate its use in block ..."

2 participants