-
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.
Error fixes in adding allBlocks to IT #20
- Loading branch information
1 parent
45ac02b
commit 3484653
Showing
11 changed files
with
1,171 additions
and
568 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,19 +1,38 @@ | ||
# Sparse matrix sparse matrix elementwise addition | ||
# Sparse matrix is in CSR format. Currently workspace transformation on the IndexTree dialect works for only CSR format | ||
# RUN: comet-opt --opt-comp-workspace --convert-ta-to-it --convert-to-loops --convert-to-llvm %s &> eltwise_add_CSRxCSR_oCSR.llvm | ||
# RUN: export SPARSE_FILE_NAME0=%comet_integration_test_data_dir/test_rank2.mtx | ||
# RUN: export SPARSE_FILE_NAME1=%comet_integration_test_data_dir/test_rank2_transpose.mtx | ||
# RUN: mlir-cpu-runner eltwise_add_CSRxCSR_oCSR.llvm -O3 -e main -entry-point-result=void -shared-libs=%comet_utility_library_dir/libcomet_runner_utils%shlibext | FileCheck %s | ||
|
||
|
||
def main() { | ||
#IndexLabel Declarations | ||
IndexLabel [a] = [?]; | ||
IndexLabel [b] = [?]; | ||
#IndexLabel Declarations | ||
IndexLabel [i] = [?]; | ||
IndexLabel [j] = [?]; | ||
|
||
#Tensor Declarations | ||
Tensor<double> A([i, j], {CSR}); | ||
Tensor<double> B([i, j], {CSR}); | ||
Tensor<double> C([i, j], {CSR}); | ||
|
||
Tensor<double> A([a, b], {CSR}); | ||
Tensor<double> B([b, a], {Dense}); | ||
Tensor<double> C([b, a], {Dense}); | ||
|
||
A[a, b] = comet_read(0); | ||
B[b, a] = 1.0; | ||
C[b, a] = A[a, b] * B[b, a]; | ||
#C[b, a] = 1.0; | ||
#Tensor Readfile Operation | ||
A[i, j] = comet_read(0); | ||
B[i, j] = comet_read(1); | ||
|
||
print(A); | ||
print(B); | ||
print(C); | ||
#Tensor Contraction | ||
C[i, j] = A[i, j] + B[i, j]; | ||
print(C); | ||
} | ||
|
||
# Print the result for verification. | ||
# CHECK: data = | ||
# CHECK-NEXT: 5, | ||
# CHECK-NEXT: data = | ||
# CHECK-NEXT: 0, | ||
# CHECK-NEXT: data = | ||
# CHECK-NEXT: 0,2,4,5,7,9, | ||
# CHECK-NEXT: data = | ||
# CHECK-NEXT: 0,3,1,4,2,0,3,1,4, | ||
# CHECK-NEXT: data = | ||
# CHECK-NEXT: 2,5.5,4,7.7,6,5.5,8,7.7,10, |
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
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
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,13 @@ | ||
%%MatrixMarket matrix coordinate real general | ||
% | ||
% This is a test sparse matrix in Matrix Market Exchange Format. | ||
% see https://math.nist.gov/MatrixMarket | ||
% | ||
4 6 7 | ||
1 1 5.0 | ||
1 2 1.0 | ||
2 1 7.0 | ||
2 2 3.0 | ||
4 1 8.0 | ||
4 4 4.0 | ||
4 5 9.0 |
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,20 @@ | ||
def main() { | ||
#IndexLabel Declarations | ||
IndexLabel [a] = [4]; | ||
IndexLabel [b] = [?]; | ||
IndexLabel [c] = [?]; | ||
|
||
#Tensor Declarations | ||
Tensor<double> B([b, c], {CSR}); #sparse tensor declarations should be before dense tensor declarations | ||
Tensor<double> A([a, b], {Dense}); | ||
Tensor<double> C([a, c], {Dense}); | ||
|
||
#Tensor Fill Operation | ||
A[a, b] = 1.0; | ||
B[b, c] = comet_read(0); | ||
C[a, c] = 0.0; | ||
|
||
C[a, c] = A[a, b] * B[b, c]; | ||
print(C); | ||
#print(B); | ||
} |