-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working Small conversion of arith to qcggi
- Loading branch information
1 parent
80140b0
commit 1e77b0c
Showing
16 changed files
with
566 additions
and
595 deletions.
There are no files selected for viewing
415 changes: 415 additions & 0 deletions
415
lib/Dialect/Arith/Conversions/ArithToCGGIQuart/ArithToCGGIQuart.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
lib/Dialect/Arith/Conversions/ArithToCGGIQuart/ArithToCGGIQuart.h
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,16 @@ | ||
#ifndef LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_ARITHTOCGGIQUART_H_ | ||
#define LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_ARITHTOCGGIQUART_H_ | ||
|
||
#include "mlir/include/mlir/Pass/Pass.h" // from @llvm-project | ||
|
||
namespace mlir::heir::arith { | ||
|
||
#define GEN_PASS_DECL | ||
#include "lib/Dialect/Arith/Conversions/ArithToCGGIQuart/ArithToCGGIQuart.h.inc" | ||
|
||
#define GEN_PASS_REGISTRATION | ||
#include "lib/Dialect/Arith/Conversions/ArithToCGGIQuart/ArithToCGGIQuart.h.inc" | ||
|
||
} // namespace mlir::heir::arith | ||
|
||
#endif // LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_ARITHTOCGGIQUART_H_ |
16 changes: 9 additions & 7 deletions
16
lib/Dialect/Arith/Transforms/Passes.td → ...ions/ArithToCGGIQuart/ArithToCGGIQuart.td
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,25 +1,27 @@ | ||
#ifndef LIB_DIALECT_ARITH_TRANSFORMS_PASSES_TD_ | ||
#define LIB_DIALECT_ARITH_TRANSFORMS_PASSES_TD_ | ||
#ifndef LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_TD_ | ||
#define LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_TD_ | ||
|
||
include "mlir/Pass/PassBase.td" | ||
|
||
def QuarterWideInt : Pass<"arith-quarter-wide-int"> { | ||
|
||
let summary = "Convert high precision arithmetic operations to a sequence of lower precision operations"; | ||
let description = [{ | ||
def ArithToCGGIQuart : Pass<"arith-to-cggi-quart"> { | ||
let summary = "Lower `arith` to `cggi` dialect and divide each operation into smaller parts."; | ||
let description = [{ | ||
This pass converts high precision arithmetic operations, i.e. operations on 32 bit integer, | ||
into a sequence of lower precision operations, i.e 8b operations. | ||
Currently, the pass splits the 32b integer into four 8b integers, using the tensor dialect. | ||
These smaller integers are stored in an 16b integer, so that we don't lose the carry information. | ||
This pass converts the `arith` dialect to the `cggi` dialect. | ||
|
||
Based on the `arith-emulate-wide-int` pass from the MLIR arith dialect. | ||
|
||
General assumption: the first element in the tensor is also the LSB element. | ||
}]; | ||
let dependentDialects = [ | ||
"mlir::arith::ArithDialect", | ||
"mlir::memref::MemRefDialect", | ||
"mlir::tensor::TensorDialect", | ||
"mlir::heir::cggi::CGGIDialect", | ||
]; | ||
} | ||
|
||
#endif // LIB_DIALECT_ARITH_TRANSFORMS_PASSES_TD_ | ||
#endif // LIB_DIALECT_ARITH_CONVERSIONS_ARITHTOCGGIQUART_ARITHTOCGGIQUART_TD_ |
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,46 @@ | ||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library") | ||
|
||
package( | ||
default_applicable_licenses = ["@heir//:license"], | ||
default_visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_library( | ||
name = "ArithToCGGIQuart", | ||
srcs = ["ArithToCGGIQuart.cpp"], | ||
hdrs = ["ArithToCGGIQuart.h"], | ||
deps = [ | ||
":pass_inc_gen", | ||
"@heir//lib/Dialect/CGGI/IR:Dialect", | ||
"@heir//lib/Utils:ConversionUtils", | ||
"@llvm-project//mlir:ArithDialect", | ||
"@llvm-project//mlir:IR", | ||
"@llvm-project//mlir:MemRefDialect", | ||
"@llvm-project//mlir:Pass", | ||
"@llvm-project//mlir:TensorDialect", | ||
"@llvm-project//mlir:Transforms", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "pass_inc_gen", | ||
tbl_outs = [ | ||
( | ||
[ | ||
"-gen-pass-decls", | ||
"-name=ArithToCGGIQuart", | ||
], | ||
"ArithToCGGIQuart.h.inc", | ||
), | ||
( | ||
["-gen-pass-doc"], | ||
"ArithToCGGIQuart.md", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "ArithToCGGIQuart.td", | ||
deps = [ | ||
"@llvm-project//mlir:OpBaseTdFiles", | ||
"@llvm-project//mlir:PassBaseTdFiles", | ||
], | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.