filecheck learning arithmetic
play

FileCheck: learning arithmetic Thomas Preud'homme Numeric - PowerPoint PPT Presentation

FileCheck: learning arithmetic Thomas Preud'homme Numeric constraints in toolchains Register constraints Memory layout e.g. consecutive 32-bit registers for i64 e.g. alignment of fields in struct/class v o i d f ( l o n g * p t r


  1. FileCheck: learning arithmetic Thomas Preud'homme

  2. Numeric constraints in toolchains Register constraints Memory layout e.g. consecutive 32-bit registers for i64 e.g. alignment of fields in struct/class v o i d f ( l o n g * p t r ) { s t r u c t f o o { ( … ) i n t a ; l o n g r e s = p t r [ 0 ] & p t r [ 1 ] l o n g b ; ( … ) } o b j 1 , o b j 2 ; } and rZ, rX, rY Addr X : obj1 and r(Z+1), r(X+1), r(Y+1) Addr X+16: obj2 2

  3. Numeric constraints in toolchains Register constraints Memory layout e.g. consecutive 32-bit registers for i64 e.g. alignment of fields in struct/class v o i d f ( l o n g a , l o n g b ) { s t r u c t f o o { r e t u r n a & b i n t a ; } l o n g b ; } o b j 1 __attribute__ ((aligned (256))) , o b j 2 ; C H E C K : 0 x [ [ A D D R : [ 0 - 9 A - F ] * ] ] 0 0 : o b j 1 C H E C K : a n d r 0 , r 0 , r 2 C H E C K : 0 x [ [ A D D R ] ] 1 0 : o b j 2 C H E C K : a n d r 1 , r 1 , r 3 Problem: subset of cases tested 3

  4. FileCheck: introducing arithmetic Syntax: [ [ # % f m t , V A R : < r e l o p > e x p r ] ] [ [ # % f m t , V A R + / - n u m ] ] C H E C K : a n d r [ [ # X : ] ] , r [ [ # Y : ] ] , r [ [ # Z : ] ] C H E C K : a n d r [ [ # X + 1 ] ] , r [ [ # Y + 1 ] ] , r [ [ # Z + 1 ] ] 4

  5. FileCheck: introducing arithmetic Syntax: [ [ # % f m t , V A R : < r e l o p > e x p r ] ] [ [ # % f m t , V A R + / - n u m ] ] C H E C K : a n d r [ [ # X : ] ] , r [ [ # Y : ] ] , r [ [ # Z : ] ] C H E C K : a n d r [ [ # X + 1 ] ] , r [ [ # Y + 1 ] ] , r [ [ # Z + 1 ] ] C H E C K : 0 x [ [ # % X , A D D R : ] ] o b j 1 C H E C K : 0 x [ [ # % X , A D D R + 1 6 ] ] o b j 2 5

  6. FileCheck: introducing arithmetic Syntax: [ [ # % f m t , V A R : VAR+/-num ] ] C H E C K : a n d r [ [ # X : ] ] , r [ [ # Y : ] ] , r [ [ # Z : ] ] C H E C K : a n d r [ [ # X + 1 ] ] , r [ [ # Y + 1 ] ] , r [ [ # Z + 1 ] ] C H E C K : 0 x [ [ # % X , A D D R : ] ] o b j 1 C H E C K : 0 x [ [ # % X , A D D R + 1 6 ] ] o b j 2 r e t u r n f o o b a ; C H E C K : f i l e . t x t : [ [ # F O O B A _ L I N E : @ L I N E - 1 ] ] : u n k n o w n v a r i a b l e ‘ f o o b a ’ C H E C K : f i l e . t x t : [ [ # F O O B A _ L I N E ] ] : d i d y o u m e a n ‘ f o o b a r ’ 6

  7. FileCheck: introducing arithmetic Syntax: [ [ # % f m t , V A R : == e x p r ] ] Expr operands: + - C H E C K : a n d r [ [ # X : ] ] , r [ [ # Y : ] ] , r [ [ # Z : ] ] C H E C K : a n d r [ [ # X + 1 ] ] , r [ [ # Y + 1 ] ] , r [ [ # Z + 1 ] ] C H E C K : 0 x [ [ # % X , A D D R : ] ] o b j 1 C H E C K : 0 x [ [ # % X , A D D R + F O O _ S I Z E ] ] o b j 2 r e t u r n f o o b a ; C H E C K : f i l e . t x t : [ [ # F O O B A _ L I N E : @ L I N E - 1 ] ] : u n k n o w n v a r i a b l e ‘ f o o b a ’ C H E C K : f i l e . t x t : [ [ # F O O B A _ L I N E ] ] : d i d y o u m e a n ‘ f o o b a r ’ 7

  8. FileCheck numeric expression: future work Syntax: [ [ # % f m t , V A R : == e x p r ] ] Expr operands: + - 8

  9. FileCheck numeric expression: future work Syntax: [ [ # % f m t , V A R : == e x p r ] ] Expr operands: + - * / ( ) ● Richer expressions C H E C K : a r r a y s i z e = [ [ # S I Z E : 8 * ( E L E M _ B I T S I Z E + G A P ) ] ] b y t e s 9

  10. FileCheck numeric expression: future work Syntax: [ [ # % f m t , V A R : < r e l o p > e x p r ] ] Expr operands: + - * / ( ) ● Richer expressions C H E C K : a r r a y s i z e = [ [ # S I Z E : 8 * ( E L E M _ B I T S I Z E + G A P ) ] ] b y t e s ● Inequalities C H E C K : s i z e = [ [ # S I Z E : < 4 2 ] ] b y t e s 10

  11. FileCheck numeric expression: future work Syntax: [ [ # % f m t , V A R : < r e l o p > e x p r ] ] Expr operands: + - * / ( ) ● Richer expressions C H E C K : a r r a y s i z e = [ [ # S I Z E : 8 * ( E L E M _ B I T S I Z E + G A P ) ] ] b y t e s ● Inequalities C H E C K : s i z e = [ [ # S I Z E : < 4 2 ] ] b y t e s ● Suggestions? Contribute to llvm-dev ML thread 11

  12. THANK YOU Thomas Preud'homme thomasp@graphcore.ai 12

Recommend


More recommend