Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dc example #567

Merged
merged 6 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
run: |
lake -R exe cache get # download cache of mathlib docs.
lake -R build SSA.Projects.CIRCT.DC # compile and check CIRCT's DC Dialect
lake -R build SSA.Projects.CIRCT.DCExample # test CIRCT's DC Dialect

- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
Expand Down
1 change: 0 additions & 1 deletion SSA/Projects/CIRCT/DC.lean
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ def mkTy2 : String → MLIR.AST.ExceptM (DC) Ty2
| "Bool" => return (.bool)
| _ => throw .unsupportedType


Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unrelated.

def mkTy : MLIR.AST.MLIRType φ → MLIR.AST.ExceptM DC DC.Ty
| MLIR.AST.MLIRType.undefined s => do
match s.splitOn "_" with
Expand Down
25 changes: 11 additions & 14 deletions SSA/Projects/CIRCT/DCExample.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ import SSA.Core.MLIRSyntax.GenericParser
import SSA.Projects.CIRCT.DC
import SSA.Projects.CIRCT.DC.Stream



Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated.

/-!
## Examples
-/
namespace DC
namespace Examples

unseal String.splitOnAux in
def BranchEg1 := [dc_com| {
^entry(%0: !Stream_Bool, %1: !Stream_Bool):
%out = "dc.branch" (%0, %1) : (!Stream_Bool, !Stream_Bool) -> (!Stream2_Bool)
%0 = "dc.fst" (%out) : (!Stream2_Bool) -> (!Stream_Bool)
%outs = "dc.snd" (%out) : (!Stream2_Bool) -> (!Stream_Bool)
%out2 = "dc.merge" (%outf, %outs) : (!Stream_Bool, !Stream_Bool) -> (!Stream_Bool)
"return" (%out) : (!Stream_Bool) -> ()
^entry(%0: !Stream_Int, %1: !Stream_Bool):
%out = "dc.branch" (%0, %1) : (!Stream_Int, !Stream_Bool) -> (!Stream2_Int)
%outf = "dc.fst" (%out) : (!Stream2_Int) -> (!Stream_Int)
%outs = "dc.snd" (%out) : (!Stream2_Int) -> (!Stream_Int)
%out2 = "dc.merge" (%outs, %outf) : (!Stream_Int, !Stream_Int) -> (!Stream_Int)
"return" (%out2) : (!Stream_Int) -> ()
}]


Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unrelated. Maybe not include this in this commit.

#check BranchEg1
#eval BranchEg1
#reduce BranchEg1
Expand All @@ -30,16 +28,15 @@ def BranchEg1 := [dc_com| {
def ofList (vals : List (Option α)) : Stream α :=
fun i => (vals.get? i).join

def x : Stream Bool := ofList [some true, none, some false, some true, some false]
def c : Stream Bool := ofList [some true, some false, none, some true]
def c : Stream Bool := ofList [some true, none, some false, some true, some false]
def x : Stream Int := ofList [some 1, some 2, none, some 3]

def test : Stream Bool :=
BranchEg1.denote (Valuation.ofPair c x)
def test : Stream Int :=
BranchEg1.denote (Ctxt.Valuation.ofPair c x)

def remNone (lst : List (Option Bool)) : List (Option Bool) :=
lst.filter (fun | some x => true
| none => false)


Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unrelated. Maybe not include this in this commit.

end Examples
end DC
Loading