SlideShare a Scribd company logo
I NTRODUCTION     T RANSLATION          R EDUCTION   I NFERENCE




                          GPUVerify
                Section 4 - Verification Method


                          Thomas Wood


                       November 28, 2012
I NTRODUCTION            T RANSLATION          R EDUCTION           I NFERENCE




I NTRODUCTION



      Section 4 describes in detail the the implementation of a verifier
      for the semantics detailed in the previous sections.
I NTRODUCTION         T RANSLATION       R EDUCTION            I NFERENCE




T RANSLATION




      Compiler from OpenCL/CUDA to intermediary Boogie built
      on CLANG/LLVM (a compiler toolset)
I NTRODUCTION                 T RANSLATION                 R EDUCTION   I NFERENCE




S PECIALISED GPU F EATURES


      Although both GPU languages and Boogie are both C-like,
      both extend C in different ways.
      In particular, GPU languages additionally support:
            Vector and Image types
            Intrinsic functions supported by the hardware and
            compiler eg: advanced maths
      Writing translations for these features for Boogie is time
      consuming.
      (And apparently boring, the paper doesn’t say any more on this)
I NTRODUCTION             T RANSLATION         R EDUCTION            I NFERENCE




B OOGIE AND F LOATS



            Boogie doesn’t support floating point numbers directly.
            These are often used in GPU Kernels.
            Modelled using uninterpreted functions (a function
            defined only by signature).
              We know something has been assigned, just not its value.
            Over-approximation could lead to false-positives, but only
            discovered one such case during evaluation.
I NTRODUCTION                 T RANSLATION              R EDUCTION     I NFERENCE




P OINTER H ANDLING



            Boogie doesn’t support pointers (because they get messy)
            GPU Kernels often do less messy things with pointers than
            most C code
            So, let’s assume that all pointers point within arrays, or are
            null, and that anything else is an error
                (Variables can be modelled as single-element arrays)
            So, pointers can be modelled as a pair: (base, offset)
I NTRODUCTION            T RANSLATION          R EDUCTION       I NFERENCE




P OINTER S EMANTICS

      Translation rules of pointer model are straightforward:
       Source       Generated Boogie
       p = A;       p = int_ptr(A_base, 0);
       p = q;       p = q;
       foo(p);      foo(p);
       p = q + 1;   p = int_ptr(q.base, q.offset + 1);
                    if (p.base == A_base)
                      A[p.offset + e] = d;
       p[e] = d;    else if (p.base == B_base)
                      B[p.offset + e] = d;
                    else assert(false);
                    if (p.base == A_base)
                      x = A[p.offset + e];
       x = p[e];    else if (p.base == B_base)
                      x = B[p.offset + e];
                    else assert(false);
I NTRODUCTION            T RANSLATION            R EDUCTION              I NFERENCE




B UT...


      ...if the program manipulates pointer in loops, the if...else if
      clauses make determining the loop invariants hard.

      One solution is to use points-to analysis (Steensgaard’s
      algorithm) to determine which arrays a pointer can possibly
      point to, and eliminate the impossible branches
    if (p.base == A_base)
      A[p.offset + e] = d;                      if (p.base == A_base)
    else if (p.base == B_base)          →         A[p.offset + e] = d;
      B[p.offset + e] = d;                      else assert(false);
    else assert(false);
I NTRODUCTION            T RANSLATION         R EDUCTION          I NFERENCE




R EDUCTION OF RACE - AND DIVERGENCE - CHECKING
TO SEQUENTIAL PROGRAM VERIFICATION




      Basics have already been discussed in lectures:
            Accesses to shared memory are instrumented with logging
            procedures
            Program transformed to model two arbitrary threads
            Checking procedures for race and barrier divergence
            introduced
I NTRODUCTION           T RANSLATION           R EDUCTION            I NFERENCE




A N OPEN QUESTION



      At the end of the last lecture, we decided that:
      P is correct ⇒ All terminating executions of K are free from
      data races and barrier divergence.

      But:
      We might have P incorrect, but all terminating executions of K
      free from data races and barrier divergence. Why?
I NTRODUCTION            T RANSLATION       R EDUCTION            I NFERENCE




   Recall:                                  Consider:
                                            if (A[0]) {
      Stmt        translate(Stmt, P)          A[tid + 1] = tid;
                  LOG_READ_A(P$1, e$1);     } else {
                  CHECK_READ_A(P$2, e$2);     A[tid + 2] = tid;
      x = A[e];   x$1 = P$1 ? * : x$1;      }
                  x$2 = P$2 ? * : x$2;
I NTRODUCTION                  T RANSLATION     R EDUCTION   I NFERENCE




                Thread 0:                     Thread 1:
                if (false) {                  if (true) {
                  ...                           A[2] = 1;
                } else {                      } else {
                  A[2] = 0;                     ...
                }                             }

      Because we’ve havoced away the shared state!
I NTRODUCTION             T RANSLATION          R EDUCTION          I NFERENCE




A DVERSARIAL A BSTRACTION




            The strategy we’ve seen in lectures for shared-state is
            Adversarial abstraction - the shared state is thrown away
            and havoced.
            This over-approximation is fine for cases where the shared
            state does not impact upon the control-flow. Otherwise, it
            gives false-posititves.
I NTRODUCTION             T RANSLATION           R EDUCTION            I NFERENCE




E QUALITY A BSTRACTION
            Both threads keep a shadow copy of the shared-state
            At a barrier, the shadow copies are set to be arbitrary, but
            equal
            On leaving the barrier, all threads have a consistent view
            of the shared state


       Stmt         translatea (Stmt, P)        translatee (Stmt, P)
                                                LOG_READ_A(P$1, e$1);
                    LOG_READ_A(P$1, e$1);       CHECK_READ_A(P$2, e$2);
                    CHECK_READ_A(P$2, e$2);     x$1 = P$1 ? A$1[e$1] :
       x = A[e];    x$1 = P$1 ? * : x$1;                      x$1;
                    x$2 = P$2 ? * : x$2;        x$2 = P$2 ? A$2[e$2] :
                                                              x$2;
                                                LOG_WRITE_A(P$1, e$1);
                                                CHECK_WRITE_A(P$2, e$2);
                    LOG_WRITE_A(P$1, e$1);      A$1[e$1] = P$1 ? x$1 :
       A[e] = x;    CHECK_WRITE_A(P$2, e$2);                  A$1[e$1];
                                                A$2[e$2] = P$2 ? x$2 :
                                                              A$2[e$2];
I NTRODUCTION             T RANSLATION           R EDUCTION            I NFERENCE




L IMITATIONS


            Unfortunately, Equality Abstraction is far less efficient
            than Adversarial Abstraction
            GPUVerify only uses Equality Abstraction with the arrays
            that require it, this is determined using control
            dependence analysis

            More complicated uses of the shared-state, such as
            A[B[lid]] = ... cannot be verified

            This is because B[i] != B[j] cannot be verified, as the
            side-effecting actions of other (prior) threads are not
            modelled.
I NTRODUCTION           T RANSLATION          R EDUCTION           I NFERENCE




I NVARIANT I NFERENCE



      To be able to prove race and barrier-divergence free code, then
      the produced Boogie program must be verified.
      Verification depends on finding pre and post conditions for the
      kernel, and loop invariants within.
      GPUVerify uses a heuristically-selected set of invariants and
      the Houdini tool to remove invalid invariants from that set
      until all can be proven.
I NTRODUCTION            T RANSLATION           R EDUCTION             I NFERENCE




M EMORY S TRUCTURE H EURISTICS




      The set of invariant heuristics discussed in the paper are for
      common data structurings in arrays.
      For example, if A[lid + C] = ... occurs in a loop, then a
      candidate invariant is
      WR EXISTS A ⇒ WR ELEM A − C == lid.

More Related Content

What's hot

Advanced Programming C++
Advanced Programming C++Advanced Programming C++
Advanced Programming C++
guestf0562b
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3
karmuhtam
 
Programming For Problem Solving Lecture Notes
Programming For Problem Solving Lecture NotesProgramming For Problem Solving Lecture Notes
Programming For Problem Solving Lecture Notes
Sreedhar Chowdam
 
2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster
Chelsea Battell
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, Recursion
Sreedhar Chowdam
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
Thooyavan Venkatachalam
 
C++ book
C++ bookC++ book
C++ book
mailmerk
 
AI Lesson 13
AI Lesson 13AI Lesson 13
AI Lesson 13
Assistant Professor
 
Ch04
Ch04Ch04
Ch04
Hankyo
 
Ch06
Ch06Ch06
Ch06
Hankyo
 
C++ Overview
C++ OverviewC++ Overview
C++ Overview
kelleyc3
 
Ch03
Ch03Ch03
Ch03
Hankyo
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ Advanced
Vivek Das
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
Waqar Younis
 
AI Lesson 16
AI Lesson 16AI Lesson 16
AI Lesson 16
Assistant Professor
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.in
TIB Academy
 
Pointers
PointersPointers
Pointers
Vardhil Patel
 
Software Construction Assignment Help
Software Construction Assignment HelpSoftware Construction Assignment Help
Software Construction Assignment Help
Programming Homework Help
 
Cs501 fd nf
Cs501 fd nfCs501 fd nf
Cs501 fd nf
Kamal Singh Lodhi
 
Computer Science Assignment Help
Computer Science Assignment HelpComputer Science Assignment Help
Computer Science Assignment Help
Programming Homework Help
 

What's hot (20)

Advanced Programming C++
Advanced Programming C++Advanced Programming C++
Advanced Programming C++
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3
 
Programming For Problem Solving Lecture Notes
Programming For Problem Solving Lecture NotesProgramming For Problem Solving Lecture Notes
Programming For Problem Solving Lecture Notes
 
2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, Recursion
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
C++ book
C++ bookC++ book
C++ book
 
AI Lesson 13
AI Lesson 13AI Lesson 13
AI Lesson 13
 
Ch04
Ch04Ch04
Ch04
 
Ch06
Ch06Ch06
Ch06
 
C++ Overview
C++ OverviewC++ Overview
C++ Overview
 
Ch03
Ch03Ch03
Ch03
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ Advanced
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
AI Lesson 16
AI Lesson 16AI Lesson 16
AI Lesson 16
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.in
 
Pointers
PointersPointers
Pointers
 
Software Construction Assignment Help
Software Construction Assignment HelpSoftware Construction Assignment Help
Software Construction Assignment Help
 
Cs501 fd nf
Cs501 fd nfCs501 fd nf
Cs501 fd nf
 
Computer Science Assignment Help
Computer Science Assignment HelpComputer Science Assignment Help
Computer Science Assignment Help
 

Viewers also liked

C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro GgsC:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
guest890c1be
 
Innovative Learning Strategies For Small And Midsized Organizations
Innovative Learning Strategies For Small And Midsized OrganizationsInnovative Learning Strategies For Small And Midsized Organizations
Innovative Learning Strategies For Small And Midsized Organizations
Drake Resource Group
 
Multiple intelligence
Multiple intelligenceMultiple intelligence
Whither subject access?
Whither subject access?Whither subject access?
Whither subject access?
kramsey
 
Como Se Titula 85
Como Se Titula 85Como Se Titula 85
Como Se Titula 85
TRIUMARIO
 
Usage and impact of controlled vocabularies in a subject repository for index...
Usage and impact of controlled vocabularies in a subject repository for index...Usage and impact of controlled vocabularies in a subject repository for index...
Usage and impact of controlled vocabularies in a subject repository for index...
redsys
 
RENION DE PADRES
RENION DE PADRESRENION DE PADRES
RENION DE PADRES
coricori
 
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
Yan Yi Lee
 
Semantic Technology 2009: Hybrid Approaches to Taxonomy and Folksonomy
Semantic Technology 2009:  Hybrid  Approaches to Taxonomy and FolksonomySemantic Technology 2009:  Hybrid  Approaches to Taxonomy and Folksonomy
Semantic Technology 2009: Hybrid Approaches to Taxonomy and Folksonomy
Earley Information Science
 

Viewers also liked (9)

C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro GgsC:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
C:\Documents And Settings\Pc3\Documenti\Metafore Per Il Mio Futuro Ggs
 
Innovative Learning Strategies For Small And Midsized Organizations
Innovative Learning Strategies For Small And Midsized OrganizationsInnovative Learning Strategies For Small And Midsized Organizations
Innovative Learning Strategies For Small And Midsized Organizations
 
Multiple intelligence
Multiple intelligenceMultiple intelligence
Multiple intelligence
 
Whither subject access?
Whither subject access?Whither subject access?
Whither subject access?
 
Como Se Titula 85
Como Se Titula 85Como Se Titula 85
Como Se Titula 85
 
Usage and impact of controlled vocabularies in a subject repository for index...
Usage and impact of controlled vocabularies in a subject repository for index...Usage and impact of controlled vocabularies in a subject repository for index...
Usage and impact of controlled vocabularies in a subject repository for index...
 
RENION DE PADRES
RENION DE PADRESRENION DE PADRES
RENION DE PADRES
 
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
Folksonomies as Subject Access: A Survey of Tagging in Library Online Catalog...
 
Semantic Technology 2009: Hybrid Approaches to Taxonomy and Folksonomy
Semantic Technology 2009:  Hybrid  Approaches to Taxonomy and FolksonomySemantic Technology 2009:  Hybrid  Approaches to Taxonomy and Folksonomy
Semantic Technology 2009: Hybrid Approaches to Taxonomy and Folksonomy
 

Similar to GPUVerify - Implementation

Compiler Design Material 2
Compiler Design Material 2Compiler Design Material 2
Compiler Design Material 2
Dr. C.V. Suresh Babu
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
guestf07b62f
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
Babu Pushkaran
 
PCD ?s(MCA)
PCD ?s(MCA)PCD ?s(MCA)
PCD ?s(MCA)
guestf07b62f
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
guestf07b62f
 
Syntaxdirected
SyntaxdirectedSyntaxdirected
Syntaxdirected
SyntaxdirectedSyntaxdirected
Syntaxdirected (1)
Syntaxdirected (1)Syntaxdirected (1)
Syntaxdirected (1)
Royalzig Luxury Furniture
 
random test
random testrandom test
random test
kapilonweb
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
Deepak John
 
Cd2 [autosaved]
Cd2 [autosaved]Cd2 [autosaved]
Cd2 [autosaved]
BBDITM LUCKNOW
 
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax DefinitionCompiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Eelco Visser
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Sean May
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
Logan Chien
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
Eelco Visser
 
Lec7 deeprlbootcamp-svg+scg
Lec7 deeprlbootcamp-svg+scgLec7 deeprlbootcamp-svg+scg
Lec7 deeprlbootcamp-svg+scg
Ronald Teo
 
Anti Patterns
Anti PatternsAnti Patterns
Anti Patterns
Anupom Syam
 
Functional Concepts for OOP Developers
Functional Concepts for OOP DevelopersFunctional Concepts for OOP Developers
Functional Concepts for OOP Developers
brweber2
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
Eelco Visser
 

Similar to GPUVerify - Implementation (20)

Compiler Design Material 2
Compiler Design Material 2Compiler Design Material 2
Compiler Design Material 2
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
 
PCD ?s(MCA)
PCD ?s(MCA)PCD ?s(MCA)
PCD ?s(MCA)
 
Pcd(Mca)
Pcd(Mca)Pcd(Mca)
Pcd(Mca)
 
Syntaxdirected
SyntaxdirectedSyntaxdirected
Syntaxdirected
 
Syntaxdirected
SyntaxdirectedSyntaxdirected
Syntaxdirected
 
Syntaxdirected (1)
Syntaxdirected (1)Syntaxdirected (1)
Syntaxdirected (1)
 
random test
random testrandom test
random test
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
Cd2 [autosaved]
Cd2 [autosaved]Cd2 [autosaved]
Cd2 [autosaved]
 
Compiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax DefinitionCompiler Construction | Lecture 2 | Declarative Syntax Definition
Compiler Construction | Lecture 2 | Declarative Syntax Definition
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
 
Lec7 deeprlbootcamp-svg+scg
Lec7 deeprlbootcamp-svg+scgLec7 deeprlbootcamp-svg+scg
Lec7 deeprlbootcamp-svg+scg
 
Anti Patterns
Anti PatternsAnti Patterns
Anti Patterns
 
Functional Concepts for OOP Developers
Functional Concepts for OOP DevelopersFunctional Concepts for OOP Developers
Functional Concepts for OOP Developers
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
 

Recently uploaded

ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 

Recently uploaded (20)

ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 

GPUVerify - Implementation

  • 1. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE GPUVerify Section 4 - Verification Method Thomas Wood November 28, 2012
  • 2. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE I NTRODUCTION Section 4 describes in detail the the implementation of a verifier for the semantics detailed in the previous sections.
  • 3. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE T RANSLATION Compiler from OpenCL/CUDA to intermediary Boogie built on CLANG/LLVM (a compiler toolset)
  • 4. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE S PECIALISED GPU F EATURES Although both GPU languages and Boogie are both C-like, both extend C in different ways. In particular, GPU languages additionally support: Vector and Image types Intrinsic functions supported by the hardware and compiler eg: advanced maths Writing translations for these features for Boogie is time consuming. (And apparently boring, the paper doesn’t say any more on this)
  • 5. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE B OOGIE AND F LOATS Boogie doesn’t support floating point numbers directly. These are often used in GPU Kernels. Modelled using uninterpreted functions (a function defined only by signature). We know something has been assigned, just not its value. Over-approximation could lead to false-positives, but only discovered one such case during evaluation.
  • 6. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE P OINTER H ANDLING Boogie doesn’t support pointers (because they get messy) GPU Kernels often do less messy things with pointers than most C code So, let’s assume that all pointers point within arrays, or are null, and that anything else is an error (Variables can be modelled as single-element arrays) So, pointers can be modelled as a pair: (base, offset)
  • 7. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE P OINTER S EMANTICS Translation rules of pointer model are straightforward: Source Generated Boogie p = A; p = int_ptr(A_base, 0); p = q; p = q; foo(p); foo(p); p = q + 1; p = int_ptr(q.base, q.offset + 1); if (p.base == A_base) A[p.offset + e] = d; p[e] = d; else if (p.base == B_base) B[p.offset + e] = d; else assert(false); if (p.base == A_base) x = A[p.offset + e]; x = p[e]; else if (p.base == B_base) x = B[p.offset + e]; else assert(false);
  • 8. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE B UT... ...if the program manipulates pointer in loops, the if...else if clauses make determining the loop invariants hard. One solution is to use points-to analysis (Steensgaard’s algorithm) to determine which arrays a pointer can possibly point to, and eliminate the impossible branches if (p.base == A_base) A[p.offset + e] = d; if (p.base == A_base) else if (p.base == B_base) → A[p.offset + e] = d; B[p.offset + e] = d; else assert(false); else assert(false);
  • 9. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE R EDUCTION OF RACE - AND DIVERGENCE - CHECKING TO SEQUENTIAL PROGRAM VERIFICATION Basics have already been discussed in lectures: Accesses to shared memory are instrumented with logging procedures Program transformed to model two arbitrary threads Checking procedures for race and barrier divergence introduced
  • 10. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE A N OPEN QUESTION At the end of the last lecture, we decided that: P is correct ⇒ All terminating executions of K are free from data races and barrier divergence. But: We might have P incorrect, but all terminating executions of K free from data races and barrier divergence. Why?
  • 11. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE Recall: Consider: if (A[0]) { Stmt translate(Stmt, P) A[tid + 1] = tid; LOG_READ_A(P$1, e$1); } else { CHECK_READ_A(P$2, e$2); A[tid + 2] = tid; x = A[e]; x$1 = P$1 ? * : x$1; } x$2 = P$2 ? * : x$2;
  • 12. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE Thread 0: Thread 1: if (false) { if (true) { ... A[2] = 1; } else { } else { A[2] = 0; ... } } Because we’ve havoced away the shared state!
  • 13. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE A DVERSARIAL A BSTRACTION The strategy we’ve seen in lectures for shared-state is Adversarial abstraction - the shared state is thrown away and havoced. This over-approximation is fine for cases where the shared state does not impact upon the control-flow. Otherwise, it gives false-posititves.
  • 14. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE E QUALITY A BSTRACTION Both threads keep a shadow copy of the shared-state At a barrier, the shadow copies are set to be arbitrary, but equal On leaving the barrier, all threads have a consistent view of the shared state Stmt translatea (Stmt, P) translatee (Stmt, P) LOG_READ_A(P$1, e$1); LOG_READ_A(P$1, e$1); CHECK_READ_A(P$2, e$2); CHECK_READ_A(P$2, e$2); x$1 = P$1 ? A$1[e$1] : x = A[e]; x$1 = P$1 ? * : x$1; x$1; x$2 = P$2 ? * : x$2; x$2 = P$2 ? A$2[e$2] : x$2; LOG_WRITE_A(P$1, e$1); CHECK_WRITE_A(P$2, e$2); LOG_WRITE_A(P$1, e$1); A$1[e$1] = P$1 ? x$1 : A[e] = x; CHECK_WRITE_A(P$2, e$2); A$1[e$1]; A$2[e$2] = P$2 ? x$2 : A$2[e$2];
  • 15. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE L IMITATIONS Unfortunately, Equality Abstraction is far less efficient than Adversarial Abstraction GPUVerify only uses Equality Abstraction with the arrays that require it, this is determined using control dependence analysis More complicated uses of the shared-state, such as A[B[lid]] = ... cannot be verified This is because B[i] != B[j] cannot be verified, as the side-effecting actions of other (prior) threads are not modelled.
  • 16. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE I NVARIANT I NFERENCE To be able to prove race and barrier-divergence free code, then the produced Boogie program must be verified. Verification depends on finding pre and post conditions for the kernel, and loop invariants within. GPUVerify uses a heuristically-selected set of invariants and the Houdini tool to remove invalid invariants from that set until all can be proven.
  • 17. I NTRODUCTION T RANSLATION R EDUCTION I NFERENCE M EMORY S TRUCTURE H EURISTICS The set of invariant heuristics discussed in the paper are for common data structurings in arrays. For example, if A[lid + C] = ... occurs in a loop, then a candidate invariant is WR EXISTS A ⇒ WR ELEM A − C == lid.