From c7e4b334af1fa122299f1000df70ae19347a55af Mon Sep 17 00:00:00 2001 From: Roman Cattaneo Date: Thu, 5 Sep 2024 15:47:30 +0200 Subject: [PATCH] use svg file with embedded draw.io drawing (#87) This way we can just look at it in markdown files while keeping the option to change the drawing anytime. Works perfectly fine with the VSCode extension too. --- .../gt4py-dace-bridge/README.md | 4 + .../gt4py-dace-bridge/code-blocks.drawio | 81 ------------------- .../gt4py-dace-bridge/code-blocks.drawio.svg | 4 + 3 files changed, 8 insertions(+), 81 deletions(-) delete mode 100644 ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio create mode 100644 ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio.svg diff --git a/ndsl_documentation/gt4py-dace-bridge/README.md b/ndsl_documentation/gt4py-dace-bridge/README.md index cfb025f..ed71f25 100644 --- a/ndsl_documentation/gt4py-dace-bridge/README.md +++ b/ndsl_documentation/gt4py-dace-bridge/README.md @@ -1,3 +1,7 @@ # Improved GT4Py-DaCe bridge Issue: + +## General idea + +![asdf](./code-blocks.drawio.svg) diff --git a/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio b/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio deleted file mode 100644 index 144df07..0000000 --- a/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio.svg b/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio.svg new file mode 100644 index 0000000..b8d715f --- /dev/null +++ b/ndsl_documentation/gt4py-dace-bridge/code-blocks.drawio.svg @@ -0,0 +1,4 @@ + + + +
statement0
statement1

if condition:
  statement2
  statement3

  while condition2:
    statement4
    statement5

  statement6
  statement7

statement8
HorizontalExecution
Condition
Loop
statements are evaluated in a Tasklet
Conditions and Loops translate to nested SDFG
each color denotes one CodeBlock
New things

oir.CodeBlock allows to use visitor pattern in daceir_builder. unused in other backends
dcir.Condition state transitions for conditions (the body is a CodeBlock)
dcir.WhileLoop state transitions for while loops (the body is a CodeBlock)


visit_CodeBlock(node: oir.CodeBlock, ...):
  - acts as a scope for local declarations
  - separates statements from potential nested CodBlocks
  - visit statements and potential nested CodeBlocks
  - wires output from statements to nested CodeBlocks
  - wires output form nested CodeBlocks to statements at the end of the CodeBlock

Funny thing about this is that there exists gtir.BlockStmt (used for describing if statements).
These block statements are then split into single statements as mentioned in [1] because
that works best for numpy's where clause.

[1] https://gridtools.github.io/gt4py/latest/lang_design.html#conditionals
\ No newline at end of file