-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed chain tensor multiplication and factorization optimization (#38)
Fixed chain tensor multiplication and factorization optimization (#32)
1 parent
2580bde
commit 5f8d052
Showing
6 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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,30 @@ | ||
# RUN: comet-opt --convert-ta-to-it --convert-to-loops --convert-to-llvm %s &> Dense_chain_mult_matrix.llvm | ||
# RUN: mlir-cpu-runner Dense_chain_mult_matrix.llvm -O3 -e main -entry-point-result=void -shared-libs=%mlir_utility_library_dir/libmlir_runner_utils%shlibext,%comet_utility_library_dir/libcomet_runner_utils%shlibext | FileCheck %s | ||
|
||
|
||
def main() { | ||
#IndexLabel Declarations | ||
IndexLabel [i] = [2]; | ||
IndexLabel [j] = [2]; | ||
IndexLabel [k] = [5]; | ||
IndexLabel [l] = [2]; | ||
|
||
#Tensor Declarations | ||
Tensor<double> A([i, j], {Dense}); | ||
Tensor<double> B([j, k], {Dense}); | ||
Tensor<double> C([k, l], {Dense}); | ||
Tensor<double> D([i, l], {Dense}); | ||
|
||
#Tensor Fill Operation | ||
A[i, j] = 2.2; | ||
B[j, k] = 3.4; | ||
C[k, l] = 1.0; | ||
D[i, l] = 0.0; | ||
|
||
D[i, l] = A[i, j] * B[j, k] * C[k,l]; | ||
print(D); | ||
} | ||
|
||
# Print the result for verification. | ||
# CHECK: data = | ||
# CHECK-NEXT: 74.8,74.8,74.8,74.8, |
This file contains 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,30 @@ | ||
# RUN: comet-opt --opt-multiop-factorize --convert-ta-to-it --convert-to-loops --convert-to-llvm %s &> chain_mult_factorize.llvm | ||
# RUN: mlir-cpu-runner chain_mult_factorize.llvm -O3 -e main -entry-point-result=void -shared-libs=%mlir_utility_library_dir/libmlir_runner_utils%shlibext,%comet_utility_library_dir/libcomet_runner_utils%shlibext | FileCheck %s | ||
|
||
|
||
def main() { | ||
#IndexLabel Declarations | ||
IndexLabel [i] = [2]; | ||
IndexLabel [j] = [2]; | ||
IndexLabel [k] = [5]; | ||
IndexLabel [l] = [2]; | ||
|
||
#Tensor Declarations | ||
Tensor<double> A([i, j], {Dense}); | ||
Tensor<double> B([j, k], {Dense}); | ||
Tensor<double> C([k, l], {Dense}); | ||
Tensor<double> D([i, l], {Dense}); | ||
|
||
#Tensor Fill Operation | ||
A[i, j] = 2.2; | ||
B[j, k] = 3.4; | ||
C[k, l] = 1.0; | ||
D[i, l] = 0.0; | ||
|
||
D[i, l] = A[i, j] * B[j, k] * C[k,l]; | ||
print(D); | ||
} | ||
|
||
# Print the result for verification. | ||
# CHECK: data = | ||
# CHECK-NEXT: 74.8,74.8,74.8,74.8, |
This file contains 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 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 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