Git Product home page Git Product logo

google / graphicsfuzz Goto Github PK

View Code? Open in Web Editor NEW
550.0 23.0 116.0 9.92 MB

A testing framework for automatically finding and simplifying bugs in graphics shader compilers.

License: Apache License 2.0

Dockerfile 0.08% Shell 1.28% JavaScript 1.54% HTML 0.20% GLSL 11.60% ANTLR 0.43% Java 67.38% Python 14.42% Batchfile 0.38% CSS 0.14% Thrift 0.16% CMake 0.07% C++ 2.29% C 0.03%
fuzzing vulkan spirv opengl glsl

graphicsfuzz's Introduction

GraphicsFuzz

License Build Status

GraphicsFuzz is a set of tools for testing shader compilers

GraphicsFuzz provides tools for automatically finding and simplifying bugs in graphics drivers, specifically graphics shader compilers. The glsl-fuzz and glsl-reduce tools manipulate GLSL shaders, targeting SPIR-V compilers via translation. The spirv-fuzz and spirv-reduce tools directly manipulate SPIR-V shaders.

Download and run

Follow the gfauto README. The gfauto command line tool is the recommended way of automatically downloading and running our fuzzers to test Vulkan drivers in a "push-button" fashion with minimal interaction. See below if you want to read about individual tools and/or use them as standalone command line tools.

Tool documentation

  • gfauto: the recommended way of automatically downloading and running our fuzzers to test Vulkan drivers in a "push-button" fashion with minimal interaction
  • glsl-fuzz: a family of tools for testing GLSL shader compilers using randomized metamorphic testing
  • glsl-reduce: a stand-alone GLSL shader reducer
  • spirv-fuzz: a stand-alone SPIR-V shader fuzzer and shrinker that uses randomized metamorphic testing
  • spirv-reduce: a stand-alone SPIR-V shader reducer

glsl-fuzz

glsl-reduce

spirv-fuzz

spirv-reduce

Contribute

Further reading

GraphicsFuzz blog posts:

Academic research project blog posts:

Academic publications:

This is not an officially supported Google product.

graphicsfuzz's People

Contributors

aaronghost avatar abelbriggs1 avatar afd avatar amakin-siru avatar andreperezmaselco avatar asuonpaa avatar dneto0 avatar hevrard avatar ilkkasaa avatar jarisiru avatar jiradeto avatar jonathanmetzman avatar karineek avatar mmoanis avatar mostafa-ashraf19 avatar niazarak avatar nipung314 avatar paulthomson avatar vasniktel avatar vihanakangas avatar vipinanand4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphicsfuzz's Issues

Release binaries are not executable

This is due to a quirk of Ant (which we use from Maven for custom build tasks); it is not good at maintaining executable permissions. We relocate the binaries from their original location in their respective zip files into assembly-binaries-1.0.zip and this is when they lose their executable permission (we don't relocate going from assembly-binaries-1.0.zip to graphicsfuzz-1.0.zip).

Use image comparison metric that considers alpha channel

The image histogram and PSNR metrics that GraphicsFuzz uses do not consider the alpha channel. They thus miss shader compiler bugs that lead to incorrect alpha computation.

We should consider ways to adjust these metrics so that they do consider alpha (or look at different metrics).

Releases not published

The documentation states that runnable code should be available on the releases page, however it is not.

This isn't super important but I thought I would download it just to try it out.

Exclude .pdb files

We should probably exclude .pdb files (debugging info files) from the Windows binaries; they are large and you can download them manually if needed.

Failed to build on MacOs

Ran into the following error running mvn package:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (1-check-style) on project parent-checkstyle: Failed during checkstyle configuration: Cannot set property 'cacheFile' to '<root path>/graphicsfuzz/parent-checkstyle/target/checkstyle-cache.txt' in module Checker: InvocationTargetException: javax/xml/bind/DatatypeConverter: javax.xml.bind.DatatypeConverter -> [Help 1]

This occurred on my Macbook.

shader_translator gives a "memory exhausted" error fairly easily, necessitating a workaround

Running:

shader_translator exhausts_shader_translator_memory.frag

on this file, which must be renamed from .txt to .frag

leads to:

ERROR: 0:2823: '+' : memory exhausted

I have added a workaround to say that a shader is valid (according to shader_translator) when we get this error, otherwise we chuck away a lot of shaders and cannot reliably test whether we are generating valid shaders.

Let's check whether this reproduces on recent builds of shader_translator, and if so see whether it is intended behaviour.

Document WebUI image borders.

The image borders in the WebUI indicate whether a result is likely a bug (red) or probably just round-off error (blue).

We should make sure the documents properly explain this, to avoid situations where folks run a reduction on a blue-border image.

Provide an option to re-register a worker with the server

At present if a worker with name foo has previously connected to the server, if foo connects again with different platform info, it is rejected. That's good as we want to avoid confusion.

But there are cases where someone might want to use a changed worker with the same name, reusing old test results, if they know what they're doing.

For this, we could provide a mechanism for the check to be over-ridden and the worker's new info to override the old info. I guess having an extra field in the thrift message a worker sends to present itself to the server would do the trick.

Work on making WebUI faster to load.

When lots of results are available, the WebUI can be slow to load. We should think about ways of improving this. Also it can be nice to see results trickle in without having to reload the page, so it might be good to have a facility to avoid refreshes.

Make coverage of builtin function support more comprehensive

The current support for builtin functions is a bit ad hoc: we simply supported a bunch of functions we knew mattered, but have not gone through this systematically per shading language version.

It would be great to get full builtin support for GLSL ES 1.00 and GLSL ES 3.00, for Android and WebGL 1/2 testing.

getBuiltins in TyperHelper.java is the right place to look for this.

Add option to allow transformations to be semantics-changing

When performing metamorphic testing for wrong code bugs, it is essential that transformations are semantics-preserving.

However, when looking for crashes or sanitizer bugs, there is no need to have families of equivalent shaders. Rather, we want many interesting shaders.

With this in mind, it could be good to have a generator option, --preseve-semantics, that is true by default but can be set to false. If true, we get the current behaviour. If false, we get (a) generalized versions of some existing transformations that take less care to preserve semantics, and (b) new transformations that deliberately change semantics.

It would make sense to start with (a).

Here are some examples of where semantics preservation is enforced and could be relaxed:

In DonateLiveCode.java, the prepareStatementToDonate method makes sure that immediate break and continues from the donated code get removed, and that return and discard statements get removed. With --preserve-semantics=false, this care could be dropped. There would still be a requirement to remove a return if its return type would be incompatible with the function being injected into, but otherwise these possibly semantics-changing control flow constructs could be kept.

In OpaqueExpressionGenerator, which is used for application of identity functions to expressions, the AbstractIdentityTransformation has an "exprMustBeSideEffectFree" field. This is used to ensure preservation of semantics. Its use could be relaxed.

The AddWrappingConditionalStmts class wraps a statement S in if(true) { S }, or if (false) { } else { S }, or for(i = 0; i < 1; i++) { S }. If we don't need to preserve semantics, we could do stranger things here.

VectorizeStatements takes a lot of care to preserve semantics; this care could be dropped if --preserve-semantics=false.

Reduce references

References can be reduced manually, but the WebUi won't use the result when showing the diff.

  • Kick off reference reduction when starting a variant reduction from WebUi.
  • In the diff of a reduced variant, use the reduced reference result.

Consider whether the stand-alone reducer should run on a .json file

When used with glsl-fuzz, the reducer needs to be applied to a .json file representing a shader job. The shader job file, as well as identifying the other shaders, holds all the info about uniforms, etc.

For the stand-alone reducer, it seems unnatural to require users to apply it to a JSON file that just contains {}. We might like to let them apply it straight to a .frag file. But the interestingness test gets a .json file by default so we'd have to think about whether to change that.

Logging as an issue here so we do not forget about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.