Skip to content
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

Scheduling revamp #53

Merged
merged 11 commits into from
Jan 17, 2025
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
compiler: [g++, clang++]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/synth-sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ jobs:
config: add_int_2
## matrixmul configs.
- kernel: matrixmul2
config: add_int_2_mul_int3
config: add_int_2_mul_int_3
## movingsum configs.
- kernel: movingsum
config: add_int_2
- kernel: movingsum
config: add_int_8
## muxmul configs.
- kernel: muxmul
config: add_int_2_mul_int3
config: add_int_2_mul_int_3
## polynomial2 configs.
- kernel: polynomial2
config: add_int_2_mul_int3
config: add_int_2_mul_int_3
- kernel: polynomial2
config: add_int_8_mul_int15
config: add_int_8_mul_int_15
## scalar3 configs.
- kernel: scalar3
config: add_int_2_mul_int3
config: add_int_2_mul_int_3

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
MODULE_OUTPUT_PATH: "output.sv"
LIBRARY_OUTPUT_PATH: "lib.sv"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ Unless neither of the three arguments is used, first argument is the mode which
* `--config <PATH>`: *required* filesystem-path option; used to specify the file for a JSON latency configuration file. Its format is presented in `docs/latency_config.md`.
* `--out-sv <PATH>`: *optional* filesystem-path option; used to specify the output SystemVerilog file.
* `--out-sv-lib <PATH>`: *optional* filesystem-path option; used to specify the output SystemVerilog file for generated operations library.
* `--out-dfcir <PATH>`: *optional* filesystem-path option; used to specify the output DFCIR file.
* `--out-dfcir <PATH>`: *optional* filesystem-path option; used to specify the output unscheduled DFCIR file.
* `--out-scheduled-dfcir <PATH>`: *optional* filesystem-path option; used to specify the output scheduled DFCIR file.
* `--out-firrtl <PATH>`: *optional* filesystem-path option; used to specify the output FIRRTL file.
* `--out-dot <PATH>`: *optional* filesystem-path option; used to specify the output DOT file.
* `-a` or `-l`: *required* flag; used to specify the chosen scheduling strategy - either as-soon-as-possible or linear programming. **Exactly one of these flags has to be specified**.
Expand Down
17 changes: 9 additions & 8 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"hls": {
"config" : "",
"asap_scheduler" : false,
"lp_scheduler" : false,
"out_sv" : "",
"out_sv_lib" : "",
"out_dfcir" : "",
"out_firrtl" : "",
"out_dot" : ""
"config" : "",
"asap_scheduler" : false,
"lp_scheduler" : false,
"out_sv" : "",
"out_sv_lib" : "",
"out_dfcir" : "",
"out_scheduled_dfcir": "",
"out_firrtl" : "",
"out_dot" : ""
},
"sim": {
"in" : "sim.txt",
Expand Down
4 changes: 3 additions & 1 deletion examples/addconst/add_int_2.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"ADD_INT": 2
"dfcir": {
"ADD_INT": 2
}
}
7 changes: 4 additions & 3 deletions examples/addconst/addconst.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ class AddConst : public dfcxx::Kernel {
const DFType type = dfUInt(32);
DFVariable x = io.input("x", type);
DFVariable const5 = constant.var(type, uint64_t(5));
DFVariable sum1 = x + const5;
DFVariable sum2 = sum1 + x;
DFVariable sum1 = x + x;
DFVariable sum2 = sum1 + const5;
DFVariable sum3 = sum2 + x;
DFVariable out = io.output("out", type);
out.connect(sum2);
out.connect(sum3);
}
};
8 changes: 5 additions & 3 deletions examples/idct/add_int_1_sub_int_1_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"ADD_INT": 1,
"SUB_INT": 1,
"MUL_INT": 3
"dfcir": {
"ADD_INT": 1,
"SUB_INT": 1,
"MUL_INT": 3
}
}
4 changes: 0 additions & 4 deletions examples/matrixmul2/add_int_2_mul_int3.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/matrixmul2/add_int_2_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 2,
"MUL_INT": 3
}
}
6 changes: 4 additions & 2 deletions examples/movingsum/add_int_2.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"ADD_INT": 2
}
"dfcir": {
"ADD_INT": 2
}
}
6 changes: 4 additions & 2 deletions examples/movingsum/add_int_8.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"ADD_INT": 8
}
"dfcir": {
"ADD_INT": 8
}
}
4 changes: 0 additions & 4 deletions examples/muxmul/add_int_2_mul_int3.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/muxmul/add_int_2_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 2,
"MUL_INT": 3
}
}
4 changes: 0 additions & 4 deletions examples/polynomial2/add_int_2_mul_int3.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/polynomial2/add_int_2_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 2,
"MUL_INT": 3
}
}
4 changes: 0 additions & 4 deletions examples/polynomial2/add_int_8_mul_int15.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/polynomial2/add_int_8_mul_int_15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 8,
"MUL_INT": 15
}
}
4 changes: 0 additions & 4 deletions examples/polynomial2_inst/add_int_2_mul_int3.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/polynomial2_inst/add_int_2_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 2,
"MUL_INT": 3
}
}
4 changes: 0 additions & 4 deletions examples/scalar3/add_int_2_mul_int3.json

This file was deleted.

6 changes: 6 additions & 0 deletions examples/scalar3/add_int_2_mul_int_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dfcir": {
"ADD_INT": 2,
"MUL_INT": 3
}
}
88 changes: 85 additions & 3 deletions src/model/dfcir/include/dfcir/DFCIROpInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,95 @@
include "mlir/IR/OpBase.td"

def NamedOpVal : OpInterface<"NamedOpVal"> {
let cppNamespace = "mlir::dfcir";

let methods = [
InterfaceMethod<
"Get the value name",
"llvm::StringRef",
"getValueName",
(ins),
/*methodBody=*/[{ return $_op.getName(); }],
/*defaultImplementation=*/[{}]
>
];
}

def InputOutputOpInterface : OpInterface<"InputOutputOpInterface"> {
let cppNamespace = "mlir::dfcir";
}

def InputOpInterface : OpInterface<"InputOpInterface", [InputOutputOpInterface]> {
let cppNamespace = "mlir::dfcir";
}

def OutputOpInterface : OpInterface<"OutputOpInterface", [InputOutputOpInterface]> {
let cppNamespace = "mlir::dfcir";
}

def NaryOpInterface : OpInterface<"NaryOpInterface"> {
let cppNamespace = "mlir::dfcir";
}

def UnaryOpInterface : OpInterface<"UnaryOpInterface", [NaryOpInterface]> {
let cppNamespace = "mlir::dfcir";
}

def BinaryOpInterface : OpInterface<"BinaryOpInterface", [NaryOpInterface]> {
let cppNamespace = "mlir::dfcir";
}

def ShiftOpInterface : OpInterface<"ShiftOpInterface"> {
let cppNamespace = "mlir::dfcir";
}

def ConstantInputInterface : OpInterface<"ConstantInputInterface"> {
let cppNamespace = "mlir::dfcir";
}

def Scheduled : OpInterface<"Scheduled"> {
let cppNamespace = "mlir::dfcir";

let methods = [
InterfaceMethod<"Get the value name",
"llvm::StringRef", "getValueName", (ins),
/*methodBody=*/[{ return $_op.getName(); }]>
InterfaceMethod<
"Get clock latency (or -1 if not set).",
"int32_t",
"getLatency",
(ins),
/*methodBody=*/[{
return static_cast<int32_t>(getLatencyAttr(impl, $_op).getSInt());
}],
/*defaultImplementation=*/[{}]
>,
InterfaceMethod<
"Get clock latency as an attribute.",
"mlir::IntegerAttr",
"getLatencyAttr",
(ins),
/*methodBody=*/[{ return $_op.getLatencyAttr(); }],
/*defaultImplementation=*/[{}]
>,
InterfaceMethod<
"Set clock latency (-1 means it is not set).",
"void",
"setLatency",
(ins "int32_t":$latency),
/*methodBody=*/[{
auto attr =
mlir::IntegerAttr::get(IntegerType::get($_op.getContext(), 32),
latency);
return setLatencyAttr(impl, $_op, attr);
}],
/*defaultImplementation=*/[{}]
>,
InterfaceMethod<
"Set clock latency as an attribute.",
"void",
"setLatencyAttr",
(ins "mlir::IntegerAttr":$latency),
/*methodBody=*/[{ return $_op.setLatencyAttr(latency); }],
/*defaultImplementation=*/[{}]
>
];
}

Expand Down
Loading