-
Notifications
You must be signed in to change notification settings - Fork 15
Add conversion for llvm.alloca, llvm.mul, llvm.sext, llvm.zext in LlvmToNeuraPass
#129
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 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2f537d3
add support for converting llvm ops to neura ops
jiajun12138 ab55ecf
Merge branch 'main' of https://github.com/HobbitQia/dataflow
jiajun12138 7987590
add testcases for llvm to neura
jiajun12138 21224a6
update test
HobbitQia 92f7c02
fix building bug
HobbitQia 0ab67fb
add conversion from llvm.func to func.func
HobbitQia 39c4ca0
comment predicate test in fdiv.mlir
HobbitQia f35d385
fix format
HobbitQia 3a1bbd0
fix comment format
HobbitQia daefc3c
Merge branch 'main' of https://github.com/HobbitQia/dataflow
HobbitQia 3289032
fix relu test
HobbitQia 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // RUN: mlir-neura-opt %s | FileCheck %s | ||
|
|
||
| #include <stdio.h> | ||
|
|
||
| #define NTAPS 32 | ||
|
|
||
| int input[NTAPS] = { | ||
| 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1, 1, 1, 1, 1, 1, 1, 1 | ||
| }; | ||
| int output[NTAPS]; | ||
| int coefficients[NTAPS] = {25, 150, 375, -225, 50, 75, -300, 125, | ||
| 25, 150, 375, -225, 50, 75, -300, 125, | ||
| 25, 150, 375, -225, 50, 75, -300, 125, | ||
| 25, 150, 375, -225, 50, 75, -300, 125}; | ||
|
|
||
| void kernel(int input[], int output[], int coefficient[]); | ||
|
|
||
| int main() | ||
| { | ||
|
|
||
| // input_dsp (input, NTAPS, 0); | ||
|
|
||
| kernel(input, output, coefficients); | ||
|
|
||
| // output_dsp (input, NTAPS, 0); | ||
| // output_dsp (coefficients, NTAPS, 0); | ||
| // output_dsp (output, NTAPS, 0); | ||
| printf("output: %d\n", output[0]); | ||
| return 0; | ||
| } | ||
|
|
||
| /* input : input sample array */ | ||
| /* output: output sample array */ | ||
| /* coefficient: coefficient array */ | ||
| void kernel(int input[], int output[], int coefficient[]) { | ||
| int i, j; | ||
|
|
||
| for (i = 0; i < NTAPS; ++i) { | ||
| for (j = 0; j < NTAPS; ++j) { | ||
| output[j] += input[i] * coefficient[i]; | ||
| } | ||
| } | ||
| } |
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,17 @@ | ||
| // RUN: clang++ -S -emit-llvm kernel2.cpp -o kernel2.ll | ||
| // RUN: mlir-translate --import-llvm kernel2.ll -o kernel2.mlir | ||
| // RUN: mlir-neura-opt --assign-accelerator \ | ||
| // RUN: --lower-llvm-to-neura \ | ||
| // RUN: --canonicalize-live-in \ | ||
| // RUN: --leverage-predicated-value \ | ||
| // RUN: --transform-ctrl-to-data-flow \ | ||
| // RUN: --fold-constant \ | ||
| // RUN: --insert-data-mov \ | ||
| // RUN: --map-to-accelerator="mapping-strategy=heuristic backtrack-config=simple" \ | ||
| // RUN: --generate-code kernel2.mlir | FileCheck %s --check-prefix=CHECK-LLVM2NEURA | ||
|
|
||
| // CHECK-LLVM2NEURA: accelerator = "neura" | ||
| // CHECK-LLVM2NEURA: %25 = neura.alloca %24 : !neura.data<i32, i1> -> !neura.data<!llvm.ptr, i1> | ||
| // CHECK-LLVM2NEURA: %38 = "neura.phi"(%36, %37) : (!neura.data<i32, i1>, !neura.data<i32, i1>) -> !neura.data<i32, i1> | ||
| // CHECK-LLVM2NEURA: %175 = neura.sext %174 : !neura.data<i32, i1> -> !neura.data<i64, i1> | ||
| // CHECK-LLVM2NEURA: %194 = "neura.mul"(%192, %193) : (!neura.data<i32, i1>, !neura.data<i32, i1>) -> !neura.data<i32, i1> |
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.