-
Notifications
You must be signed in to change notification settings - Fork 15
add support to max_ii #153
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 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6141ff2
add support to max_ii
n0thingNoob f2c4d7b
change to 32 regs
n0thingNoob 6f7b21e
fix arch_spec handler and add support for the arg value in code_gen pass
n0thingNoob 9b2478c
add testbench folder to test, including fir and histogram's kernel code
n0thingNoob 77a4a5f
Refactor variable names to snake_case in MapToAcceleratorPass
n0thingNoob 2c42a43
modify variable names
n0thingNoob c48b097
Update GenerateCodePass.cpp, add TODO for Issue #154
n0thingNoob cd34766
Remove testbench directory from remote repository
n0thingNoob 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
tancheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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,42 @@ | ||
| /* 32-tap FIR filter processing 1 point */ | ||
| /* Modified to use arrays - SMP */ | ||
|
|
||
| //#include "traps.h" | ||
|
|
||
| #define NTAPS 32 | ||
|
|
||
| float input[NTAPS]; | ||
| float output[NTAPS]; | ||
| float coefficients[NTAPS] = {0.25, 1.50, 3.75, -2.25, 0.50, 0.75, -3.00, 1.25, | ||
| 0.25, 1.50, 3.75, -2.25, 0.50, 0.75, -3.00, 1.25, | ||
| 0.25, 1.50, 3.75, -2.25, 0.50, 0.75, -3.00, 1.25, | ||
| 0.25, 1.50, 3.75, -2.25, 0.50, 0.75, -3.00, 1.25}; | ||
|
|
||
| void kernel(float input[], float output[], float 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); | ||
| return 0; | ||
| } | ||
|
|
||
| void kernel(float input[], float output[], float coefficient[]) | ||
| /* input : input sample array */ | ||
| /* output: output sample array */ | ||
| /* coefficient: coefficient array */ | ||
| { | ||
| int i; | ||
| float sum = 0.0; | ||
| // #pragma clang loop unroll_count(4) vectorize_width(4) | ||
| for (i = 0; i < NTAPS; ++i) { | ||
| sum += input[i] * coefficient[i]; | ||
| } | ||
| output[0] = sum; | ||
| } |
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,15 @@ | ||
| #define NTAPS 32 | ||
|
|
||
| void kernel(float input[], float output[], float coefficient[]) | ||
| /* input : input sample array */ | ||
| /* output: output sample array */ | ||
| /* coefficient: coefficient array */ | ||
| { | ||
| int i; | ||
| float sum = 0.0; | ||
| // #pragma clang loop unroll_count(4) vectorize_width(4) | ||
| for (i = 0; i < NTAPS; ++i) { | ||
| sum += input[i] * coefficient[i]; | ||
| } | ||
| output[0] = sum; | ||
| } |
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,44 @@ | ||
| ; ModuleID = 'fir_kernel.cpp' | ||
| source_filename = "fir_kernel.cpp" | ||
| target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" | ||
| target triple = "x86_64-unknown-linux-gnu" | ||
|
|
||
| ; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable | ||
| define dso_local void @_Z6kernelPfS_S_(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 { | ||
| br label %4 | ||
|
|
||
| 4: ; preds = %3, %4 | ||
| %5 = phi i64 [ 0, %3 ], [ %13, %4 ] | ||
| %6 = phi float [ 0.000000e+00, %3 ], [ %12, %4 ] | ||
| %7 = getelementptr inbounds nuw float, ptr %0, i64 %5 | ||
| %8 = load float, ptr %7, align 4, !tbaa !5 | ||
| %9 = getelementptr inbounds nuw float, ptr %2, i64 %5 | ||
| %10 = load float, ptr %9, align 4, !tbaa !5 | ||
| %11 = fmul fast float %10, %8 | ||
| %12 = fadd fast float %11, %6 | ||
| %13 = add nuw nsw i64 %5, 1 | ||
| %14 = icmp eq i64 %13, 32 | ||
| br i1 %14, label %15, label %4, !llvm.loop !9 | ||
|
|
||
| 15: ; preds = %4 | ||
| store float %12, ptr %1, align 4, !tbaa !5 | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "approx-func-fp-math"="true" "min-legal-vector-width"="0" "no-builtin-fma" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87,-amx-avx512,-avx10.1-256,-avx10.1-512,-avx10.2-256,-avx10.2-512,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512f,-avx512fp16,-avx512ifma,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-fma" "tune-cpu"="generic" "unsafe-fp-math"="true" } | ||
|
|
||
| !llvm.module.flags = !{!0, !1, !2, !3} | ||
| !llvm.ident = !{!4} | ||
|
|
||
| !0 = !{i32 1, !"wchar_size", i32 4} | ||
| !1 = !{i32 8, !"PIC Level", i32 2} | ||
| !2 = !{i32 7, !"PIE Level", i32 2} | ||
| !3 = !{i32 7, !"uwtable", i32 2} | ||
| !4 = !{!"clang version 20.1.7 (https://github.com/llvm/llvm-project.git 6146a88f60492b520a36f8f8f3231e15f3cc6082)"} | ||
| !5 = !{!6, !6, i64 0} | ||
| !6 = !{!"float", !7, i64 0} | ||
| !7 = !{!"omnipotent char", !8, i64 0} | ||
| !8 = !{!"Simple C++ TBAA"} | ||
| !9 = distinct !{!9, !10, !11} | ||
| !10 = !{!"llvm.loop.mustprogress"} | ||
| !11 = !{!"llvm.loop.unroll.disable"} |
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,28 @@ | ||
| #loop_unroll = #llvm.loop_unroll<disable = true> | ||
| #tbaa_root = #llvm.tbaa_root<id = "Simple C++ TBAA"> | ||
| #loop_annotation = #llvm.loop_annotation<unroll = #loop_unroll, mustProgress = true> | ||
| #tbaa_type_desc = #llvm.tbaa_type_desc<id = "omnipotent char", members = {<#tbaa_root, 0>}> | ||
| #tbaa_type_desc1 = #llvm.tbaa_type_desc<id = "float", members = {<#tbaa_type_desc, 0>}> | ||
| #tbaa_tag = #llvm.tbaa_tag<base_type = #tbaa_type_desc1, access_type = #tbaa_type_desc1, offset = 0> | ||
| module attributes {dlti.dl_spec = #dlti.dl_spec<i64 = dense<64> : vector<2xi64>, !llvm.ptr<272> = dense<64> : vector<4xi64>, !llvm.ptr<271> = dense<32> : vector<4xi64>, !llvm.ptr<270> = dense<32> : vector<4xi64>, i32 = dense<32> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, i1 = dense<8> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, !llvm.ptr = dense<64> : vector<4xi64>, f80 = dense<128> : vector<2xi64>, i128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little", "dlti.stack_alignment" = 128 : i64>, llvm.ident = "clang version 20.1.7 (https://github.com/llvm/llvm-project.git 6146a88f60492b520a36f8f8f3231e15f3cc6082)"} { | ||
| llvm.func local_unnamed_addr @_Z6kernelPfS_S_(%arg0: !llvm.ptr {llvm.nocapture, llvm.noundef, llvm.readonly}, %arg1: !llvm.ptr {llvm.nocapture, llvm.noundef, llvm.writeonly}, %arg2: !llvm.ptr {llvm.nocapture, llvm.noundef, llvm.readonly}) attributes {approx_func_fp_math = true, memory_effects = #llvm.memory_effects<other = none, argMem = readwrite, inaccessibleMem = none>, no_infs_fp_math = true, no_nans_fp_math = true, no_signed_zeros_fp_math = true, no_unwind, passthrough = ["mustprogress", "nofree", "norecurse", "nosync", ["uwtable", "2"], ["min-legal-vector-width", "0"], "no-builtin-fma", ["no-trapping-math", "true"], ["stack-protector-buffer-size", "8"], ["target-cpu", "x86-64"]], target_cpu = "x86-64", target_features = #llvm.target_features<["+cmov", "+cx8", "+fxsr", "+mmx", "+sse", "+sse2", "+x87", "-amx-avx512", "-avx10.1-256", "-avx10.1-512", "-avx10.2-256", "-avx10.2-512", "-avx512bf16", "-avx512bitalg", "-avx512bw", "-avx512cd", "-avx512dq", "-avx512f", "-avx512fp16", "-avx512ifma", "-avx512vbmi", "-avx512vbmi2", "-avx512vl", "-avx512vnni", "-avx512vp2intersect", "-avx512vpopcntdq", "-fma"]>, tune_cpu = "generic", unsafe_fp_math = true} { | ||
| %0 = llvm.mlir.constant(0 : i64) : i64 | ||
| %1 = llvm.mlir.constant(0.000000e+00 : f32) : f32 | ||
| %2 = llvm.mlir.constant(1 : i64) : i64 | ||
| %3 = llvm.mlir.constant(32 : i64) : i64 | ||
| llvm.br ^bb1(%0, %1 : i64, f32) | ||
| ^bb1(%4: i64, %5: f32): // 2 preds: ^bb0, ^bb1 | ||
| %6 = llvm.getelementptr inbounds %arg0[%4] : (!llvm.ptr, i64) -> !llvm.ptr, f32 | ||
| %7 = llvm.load %6 {alignment = 4 : i64, tbaa = [#tbaa_tag]} : !llvm.ptr -> f32 | ||
| %8 = llvm.getelementptr inbounds %arg2[%4] : (!llvm.ptr, i64) -> !llvm.ptr, f32 | ||
| %9 = llvm.load %8 {alignment = 4 : i64, tbaa = [#tbaa_tag]} : !llvm.ptr -> f32 | ||
| %10 = llvm.fmul %9, %7 {fastmathFlags = #llvm.fastmath<fast>} : f32 | ||
| %11 = llvm.fadd %10, %5 {fastmathFlags = #llvm.fastmath<fast>} : f32 | ||
| %12 = llvm.add %4, %2 overflow<nsw, nuw> : i64 | ||
| %13 = llvm.icmp "eq" %12, %3 : i64 | ||
| llvm.cond_br %13, ^bb2, ^bb1(%12, %11 : i64, f32) {loop_annotation = #loop_annotation} | ||
| ^bb2: // pred: ^bb1 | ||
| llvm.store %11, %arg1 {alignment = 4 : i64, tbaa = [#tbaa_tag]} : f32, !llvm.ptr | ||
| llvm.return | ||
| } | ||
| } |
Oops, something went wrong.
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.