-
Notifications
You must be signed in to change notification settings - Fork 383
Lower MemRef GetGlobal and write data to json files #7301
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
265c493
write external global memory data to json; and build getglobal as an …
jiahanxie353 b2601b9
writing allocOp as all zero's to json
jiahanxie353 91453b4
use ordered json to preserve numerical order
jiahanxie353 086f7bd
replace nlohmann json with llvm json
jiahanxie353 223106e
flush to json file
jiahanxie353 38b4d79
small fix
jiahanxie353 d08cb8b
writing as ieee_754 field to json
jiahanxie353 77fa620
account for empty memory size
jiahanxie353 08f5f23
change writeJson from bool to json file name; add test case
jiahanxie353 b3772e6
force memories to be 1-dim; use uint64 as bitvectors to store memory …
jiahanxie353 6f80741
better code style for checking bits, signess, and delete the split in…
jiahanxie353 34d7e4c
add test for empty-shaped memory
jiahanxie353 8697f29
edit comments and some minor changes
jiahanxie353 0e3e905
fix signless integer
jiahanxie353 fd21254
add si type test and write signed values to json by first explicitly …
jiahanxie353 3572f99
more fixes based on review
jiahanxie353 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // RUN: circt-opt %s --lower-scf-to-calyx="write-json=data" -canonicalize>/dev/null && cat $(dirname %s)/data.json | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: "mem_0": { | ||
| // CHECK: "data": [ | ||
| // CHECK: 0, | ||
| // CHECK: 0, | ||
| // CHECK: 0, | ||
| // CHECK: 0 | ||
| // CHECK: ], | ||
| // CHECK: "format": { | ||
| // CHECK: "is_signed": true, | ||
| // CHECK: "numeric_type": "ieee754_float", | ||
| // CHECK: "width": 32 | ||
| // CHECK: } | ||
| // CHECK: }, | ||
|
|
||
| // CHECK-LABEL: "mem_1": { | ||
| // CHECK: "data": [ | ||
| // CHECK: 0 | ||
| // CHECK: ], | ||
| // CHECK: "format": { | ||
| // CHECK: "is_signed": true, | ||
| // CHECK: "numeric_type": "bitnum", | ||
| // CHECK: "width": 8 | ||
| // CHECK: } | ||
| // CHECK: }, | ||
|
|
||
| // CHECK-LABEL: "mem_2": { | ||
| // CHECK: "data": [ | ||
| // CHECK: 43, | ||
| // CHECK: 8, | ||
| // CHECK: 4294967257, | ||
| // CHECK: 4294967277, | ||
| // CHECK: 70, | ||
| // CHECK: 4294967232, | ||
| // CHECK: 4294967289, | ||
| // CHECK: 4294967269, | ||
| // CHECK: 4294967239, | ||
| // CHECK: 5 | ||
| // CHECK: ], | ||
| // CHECK: "format": { | ||
| // CHECK: "is_signed": false, | ||
jiahanxie353 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // CHECK: "numeric_type": "bitnum", | ||
| // CHECK: "width": 32 | ||
| // CHECK: } | ||
| // CHECK: }, | ||
|
|
||
| // CHECK-LABEL: "mem_3": { | ||
| // CHECK: "data": [ | ||
| // CHECK: 0.69999998807907104, | ||
| // CHECK: -4.1999998092651367, | ||
| // CHECK: 0 | ||
| // CHECK: ], | ||
| // CHECK: "format": { | ||
| // CHECK: "is_signed": true, | ||
| // CHECK: "numeric_type": "ieee754_float", | ||
| // CHECK: "width": 32 | ||
| // CHECK: } | ||
| // CHECK: }, | ||
|
|
||
| // CHECK-LABEL: "mem_4": { | ||
| // CHECK: "data": [ | ||
| // CHECK: -42, | ||
| // CHECK: 35 | ||
| // CHECK: ], | ||
| // CHECK: "format": { | ||
| // CHECK: "is_signed": true, | ||
| // CHECK: "numeric_type": "bitnum", | ||
| // CHECK: "width": 8 | ||
| // CHECK: } | ||
| // CHECK: } | ||
|
|
||
| module { | ||
| memref.global "private" constant @constant_10xi32_0 : memref<10xi32> = dense<[43, 8, -39, -19, 70, -64, -7, -27, -57, 5]> | ||
jiahanxie353 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| memref.global "private" constant @constant_2xsi8_0 : memref<2xsi8> = dense<[-42, 35]> | ||
| memref.global "private" constant @constant_3xf32 : memref<3xf32> = dense<[0.7, -4.2, 0.0]> | ||
| func.func @main(%arg_idx : index) -> i32 { | ||
| %alloc = memref.alloc() : memref<4xf32> | ||
| %zero_dim_mem = memref.alloca() : memref<si8> | ||
| %c2 = arith.constant 2 : index | ||
| %c1 = arith.constant 1 : index | ||
| %0 = memref.get_global @constant_10xi32_0 : memref<10xi32> | ||
| %ret = memref.load %0[%arg_idx] : memref<10xi32> | ||
| %1 = memref.get_global @constant_3xf32 : memref<3xf32> | ||
| %2 = memref.load %1[%c1] : memref<3xf32> | ||
| memref.store %2, %alloc[%c2] : memref<4xf32> | ||
| %3 = memref.get_global @constant_2xsi8_0 : memref<2xsi8> | ||
| %4 = memref.load %3[%c1] : memref<2xsi8> | ||
| memref.store %4, %zero_dim_mem[] : memref<si8> | ||
| return %ret : i32 | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.