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

Draft: Recent Changes #60

Merged
merged 80 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
dc9e029
settings: expose debug_build config and use_ninja to user
PhilippvK Mar 10, 2024
62fff51
examples/cfg/llvm.yml: no not build x86 target
PhilippvK Mar 10, 2024
8ee4e92
demo: add prepatched setting
PhilippvK Mar 10, 2024
75c6769
cdsl writer: fixes
PhilippvK Mar 10, 2024
53a54df
mattr: use +gpr32v by default
PhilippvK Mar 10, 2024
e8c8ca1
add __repr__ for Seal5Operand
PhilippvK Mar 10, 2024
a6ab658
small fix for gen_set_td
PhilippvK Mar 10, 2024
ec67145
examples/cfg/llvm.yml: no not build x86 target
PhilippvK Mar 10, 2024
de32129
update llvm18 patch
PhilippvK Mar 10, 2024
9a6f11c
move pattern gen support patch to PASE_0
PhilippvK Mar 10, 2024
4fe35da
try passing legalizer settings via cmdline
PhilippvK Mar 10, 2024
2a6dd85
WIP: add seal5 prefix to all instrs (workaround)
PhilippvK Mar 10, 2024
a059aa2
demo: expose some options as environment vars
PhilippvK Mar 10, 2024
a3e06cc
fix gen_riscv_instr_info_str
PhilippvK Mar 10, 2024
9de8792
clear filters in flow.settings.reset()
PhilippvK Mar 10, 2024
5fb43cd
pattern-gen: disable-gisel-legality-check
PhilippvK Mar 10, 2024
c06252e
filter_model: allow regex filters
PhilippvK Mar 10, 2024
4b93be2
run pattern_gen using threadpoolexecutor
PhilippvK Mar 11, 2024
2543668
allow gloab file patterns in flow.load()
PhilippvK Mar 11, 2024
ac6cc62
add stage runtimes to metrics
PhilippvK Mar 11, 2024
74897d4
rename test files
PhilippvK Mar 11, 2024
0602401
filter_model: allow regex filters 2
PhilippvK Mar 11, 2024
378e7db
add sha256 examples
PhilippvK Mar 11, 2024
b5cf73d
clear pass settings in flow.reset()
PhilippvK Mar 11, 2024
390ffbd
detect_inouts: fix bug in ternary visitor
PhilippvK Mar 13, 2024
458f7d5
convert_behav_to_tablegen: fix
PhilippvK Mar 13, 2024
2391f5e
Seal5Pass: actually use user-provided overrides
PhilippvK Mar 13, 2024
0df1450
Seal5Settings.reset(): clear user provided tests
PhilippvK Mar 13, 2024
0c0dc2d
seal5.backends.llvmir.writer: use mattr from riscv.yml
PhilippvK Mar 13, 2024
2d79837
update demo files
PhilippvK Mar 13, 2024
c8a5efe
add some prints for debugging
PhilippvK Mar 13, 2024
45125b4
seal5.transform.converter: add --prefix option
PhilippvK Mar 14, 2024
3182d58
lint code
PhilippvK Mar 14, 2024
46eba69
update xcv settings
PhilippvK Mar 19, 2024
60047a0
expose llvm repo to seal5 flow class
PhilippvK Mar 19, 2024
00385c6
lint
PhilippvK Mar 19, 2024
7a573f5
fix typo in example configs
PhilippvK Mar 19, 2024
93a74bf
fix
PhilippvK Mar 19, 2024
00d11c1
fix prefix overrides
PhilippvK Mar 19, 2024
b42577f
fix prefix overrides
PhilippvK Mar 19, 2024
b0b1aef
[ci] expose demo settings as workflow inputs
PhilippvK Mar 19, 2024
219289e
fix
PhilippvK Mar 19, 2024
a3a1ede
fix problems with reset and clean on fresh flow
PhilippvK Mar 19, 2024
2af2a01
raise error if flow.load() does not find file
PhilippvK Mar 19, 2024
e6fe7b4
update LIMITATIONS.md
PhilippvK Mar 20, 2024
c1b5bcb
update filter.yml
PhilippvK Mar 20, 2024
153b147
add custom patch: legalizer_split
PhilippvK Mar 20, 2024
855f0a3
backends: add missing newline
PhilippvK Mar 20, 2024
1168db9
riscv_gisel_legalizer: fix
PhilippvK Mar 20, 2024
41640f4
riscv_isa_info: sort lines alphabetically
PhilippvK Mar 20, 2024
381a04f
insert_markers_llvm18.patch: move riscv_isa_info markers up
PhilippvK Mar 20, 2024
3eb89c7
cdsl2llvm fix
PhilippvK Mar 20, 2024
88aac0e
add new rv_gen files
PhilippvK Mar 20, 2024
8bd61a2
add new rv_tumeda files
PhilippvK Mar 20, 2024
ae236df
refactor cfgs
PhilippvK Mar 20, 2024
49c4b62
provide smaller demo scripts (grouped by corev, gen, s4e)
PhilippvK Mar 20, 2024
a748ae4
notes
PhilippvK Mar 22, 2024
82ce3b0
gen example updates
PhilippvK Mar 25, 2024
80cdd91
add manual uimm12_op.patch
PhilippvK Mar 25, 2024
b5b9585
gen example updates
PhilippvK Mar 26, 2024
5c12094
riscv_instr_info: fix handling of writeback constraints
PhilippvK Mar 26, 2024
5f1e82d
seal5.transform.converter: fix
PhilippvK Mar 26, 2024
1b991c5
seal5.transform.filter_model: make assertions more helpful
PhilippvK Mar 26, 2024
9ffb140
update demo
PhilippvK Mar 26, 2024
09a2608
add custom patches
PhilippvK Mar 26, 2024
62d4a32
coredsl2_seal5: add more helpful error message for missing imports
PhilippvK Mar 27, 2024
aec7b0d
small fix for seal5.backends.coredsl2.writer when list of operands is…
PhilippvK Mar 27, 2024
1392465
whitespace fixes in some backends
PhilippvK Mar 27, 2024
f80d907
fix for filter_model
PhilippvK Mar 27, 2024
6d037bd
examples/corev_demo.py: fixes
PhilippvK Mar 27, 2024
890c038
examples/s4e_demo.py: fixes
PhilippvK Mar 27, 2024
b4f9eab
small fix for seal5.backends.coredsl2.writer when list of operands is…
PhilippvK Mar 27, 2024
7c4e8c2
examples/s4e_demo.py: load test file
PhilippvK Mar 28, 2024
e8719e5
add missing cdsl files for rv_gen
PhilippvK Mar 28, 2024
793f81b
remove rv_gen dir
PhilippvK Mar 28, 2024
ab36a8e
add rv_gen submodule
PhilippvK Mar 28, 2024
39b5e22
[CI] .github/workflows/demo.yml: allow chooing script name for demo
PhilippvK Mar 28, 2024
866c183
update rv_s4e submodule ref
PhilippvK Mar 28, 2024
7220421
[lint] run black formatter
PhilippvK Mar 28, 2024
af31695
[lint] make flake8 happy
PhilippvK Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@
# Seal5 demonstration (also serves as end-to-end testj
name: Usage Demo

on: [workflow_dispatch]
on:
workflow_dispatch:
inputs:
script:
description: "Script"
required: true
default: "demo.py"
verbose:
description: "Verbose (0/1)"
required: true
default: "0"
fast:
description: "Fast (0/1)"
required: true
default: "0"
build_config:
description: "Build Config (debug/release/...)"
required: true
default: "release"
# push:
# branches:
# - main
Expand Down Expand Up @@ -60,7 +78,7 @@ jobs:
- name: Run the demo
run: |
source .venv/bin/activate
python examples/demo.py
VERBOSE=${{ github.event.inputs.verbose }} FAST=${{ github.event.inputs.fast }} BUILD_CONFIG=${{ github.event.inputs.build_config }} python examples/${{ github.event.inputs.script }}
- uses: actions/upload-artifact@v4
with:
name: demo-export
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "examples/cdsl/rv_s4e"]
path = examples/cdsl/rv_s4e
url = https://github.com/DLR-SE/riscv-coredsl-extensions.git
[submodule "examples/cdsl/rv_gen"]
path = examples/cdsl/rv_gen
url = https://github.com/PhilippvK/Gen_ISA_CoreDSL.git
9 changes: 9 additions & 0 deletions LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@
- No memory access
- No branches/jumps
- TODO

## Known Bugs

### Clang `-march` parser does not pick up new extensions

Due to issues with the ordering of extensions in `RISCVISAInfo.cpp` the search algorithm will not find entries which not inserted in the correct order. To deal with this issue the following workaround is recommended:

- Only generate patches for a single model (CoreDSL file)
- Make sure that the `arch` string always starts with an `x`, or better prefix every arch string with `xseal5`.
1 change: 1 addition & 0 deletions examples/cdsl/rv_gen
Submodule rv_gen added at 8c35ff
Empty file removed examples/cdsl/rv_gen/.gitkeep
Empty file.
64 changes: 0 additions & 64 deletions examples/cdsl/rv_gen/test.core_desc

This file was deleted.

2 changes: 1 addition & 1 deletion examples/cdsl/rv_s4e
216 changes: 216 additions & 0 deletions examples/cdsl/rv_tumeda/OpenASIP.core_desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
import "../rv_base/RV32I.core_desc"

InstructionSet XISE extends RV32I {
// functions {
// unsigned<32> rotl32(unsigned<32> x, unsigned<32> n) {
// return (x << n) | (x >> (32 - n))
// // return (x << n) | (x >> (-(n)&31))
// }
// unsigned<32> rotr32(unsigned<32> x, unsigned<32> n) {
// return (x >> n) | (x << (32 - n))
// // return (x >> n) | (x << (-(n)&31))
// }
// }
instructions {
AES283XOR {
// opcode: custom-0
encoding: 7'b0000000 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.aes283xor", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
unsigned<32> input = X[rs1];
unsigned<32> temp = input << 1;
X[rd] = ((input >> 7) == 1) ? (temp ^ 283) : temp;
}
}
}
AES283XORB {
// opcode: custom-0
encoding: 7'b0000001 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.aes283xorb", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
unsigned<32> input = X[rs1];
unsigned<32> temp = input << 1;
X[rd] = ((input >> 8) == 1) ? (temp ^ 283) : temp;
}
}
}
// REFLECT8 {
// // opcode: custom-0
// encoding: 7'b0000010 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
// assembly: {"oa.reflect8", "{name(rd)}, {name(rs1)}"};
// behavior: {
// if (rd != 0) {
// // unsigned<8> input = X[rs1][7:0];
// // TODO: try loop variant (evantually with automatic unrolling)
// // TODO: try concat (::) version
// // TODO: try 8 bit slice
// X[rd][0] = X[rs1][7];
// X[rd][1] = X[rs1][6];
// X[rd][2] = X[rs1][5];
// X[rd][3] = X[rs1][4];
// X[rd][4] = X[rs1][3];
// X[rd][5] = X[rs1][2];
// X[rd][6] = X[rs1][1];
// X[rd][7] = X[rs1][0];
// }
// }
// }
// REFLECT32 {
// // opcode: custom-0
// encoding: 7'b0000011 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
// assembly: {"oa.reflect32", "{name(rd)}, {name(rs1)}"};
// behavior: {
// if (rd != 0) {
// // TODO: try loop variant (evantually with automatic unrolling)
// // TODO: try concat (::) version
// X[rd][0] = X[rs1][31];
// X[rd][1] = X[rs1][30];
// X[rd][2] = X[rs1][29];
// X[rd][3] = X[rs1][28];
// X[rd][4] = X[rs1][27];
// X[rd][5] = X[rs1][26];
// X[rd][6] = X[rs1][25];
// X[rd][7] = X[rs1][24];
// X[rd][8] = X[rs1][23];
// X[rd][9] = X[rs1][22];
// X[rd][10] = X[rs1][21];
// X[rd][11] = X[rs1][20];
// X[rd][12] = X[rs1][19];
// X[rd][13] = X[rs1][18];
// X[rd][14] = X[rs1][17];
// X[rd][15] = X[rs1][16];
// X[rd][16] = X[rs1][15];
// X[rd][17] = X[rs1][14];
// X[rd][18] = X[rs1][13];
// X[rd][19] = X[rs1][12];
// X[rd][20] = X[rs1][11];
// X[rd][21] = X[rs1][10];
// X[rd][22] = X[rs1][9];
// X[rd][23] = X[rs1][8];
// X[rd][24] = X[rs1][7];
// X[rd][25] = X[rs1][6];
// X[rd][26] = X[rs1][5];
// X[rd][27] = X[rs1][4];
// X[rd][28] = X[rs1][3];
// X[rd][29] = X[rs1][2];
// X[rd][30] = X[rs1][1];
// X[rd][31] = X[rs1][0];
// }
// }
// }
SHA256SIG0 {
// opcode: custom-0
encoding: 7'b0000100 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sig0", "{name(rd)}, {name(rs1)}"};
behavior: {
// TODO: try with inlining or intrinsic detection
if (rd != 0) {
// X[rd] = rotr32(X[rs1], 7) ^ rotr32(X[rs1], 18) ^ (X[rs1] >> 3);
X[rd] = ((X[rs1] >> 7) | (X[rs1] << 25)) ^ ((X[rs1] >> 18) | (X[rs1] << 14)) ^ (X[rs1] >> 3);
}
}
}
SHA256SIG1 {
// opcode: custom-0
encoding: 7'b0000101 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sig1", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotr32(X[rs1], 17) ^ rotr32(X[rs1], 19) ^ (X[rs1] >> 10);
X[rd] = ((X[rs1] >> 17) | (X[rs1] << 15)) ^ ((X[rs1] >> 19) | (X[rs1] << 13)) ^ (X[rs1] >> 10);
}
}
}
SHA256SUM0 {
// opcode: custom-0
encoding: 7'b0000110 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sum0", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotr32(X[rs1], 2) ^ rotr32(X[rs1], 13) ^ rotr32(X[rs1], 22);
X[rd] = ((X[rs1] >> 2) | (X[rs1] << 30)) ^ ((X[rs1] >> 13) | (X[rs1] << 19)) ^ ((X[rs1] >> 22) | (X[rs1] << 10));
}
}
}
SHA256SUM1 {
// opcode: custom-0
encoding: 7'b0000111 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sum1", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotr32(X[rs1], 6) ^ rotr32(X[rs1], 11) ^ rotr32(X[rs1], 25);
X[rd] = ((X[rs1] >> 6) | (X[rs1] << 26)) ^ ((X[rs1] >> 11) | (X[rs1] << 21)) ^ ((X[rs1] >> 25) | (X[rs1] << 7));
}
}
}
SHA256SIG0B {
// opcode: custom-0
encoding: 7'b0001000 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sig0b", "{name(rd)}, {name(rs1)}"};
behavior: {
// TODO: try with inlining or intrinsic detection
if (rd != 0) {
// X[rd] = rotl32(X[rs1], 25) ^ rotl32(X[rs1], 14) ^ (X[rs1] >> 3);
X[rd] = ((X[rs1] << 25) | (X[rs1] >> 7)) ^ ((X[rs1] << 14) | (X[rs1] >> 18)) ^ (X[rs1] >> 3);
}
}
}
SHA256SIG1B {
// opcode: custom-0
encoding: 7'b0001001 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sig1b", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotl32(X[rs1], 15) ^ rotl32(X[rs1], 13) ^ (X[rs1] >> 10);
X[rd] = ((X[rs1] << 15) | (X[rs1] >> 17)) ^ ((X[rs1] << 13) | (X[rs1] >> 19)) ^ (X[rs1] >> 10);
}
}
}
SHA256SUM0B {
// opcode: custom-0
encoding: 7'b0001010 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sum0b", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotl32(X[rs1], 30) ^ rotl32(X[rs1], 19) ^ rotl32(X[rs1], 10);
X[rd] = ((X[rs1] << 30) | (X[rs1] >> 2)) ^ ((X[rs1] << 19) | (X[rs1] >> 13)) ^ ((X[rs1] << 10) | (X[rs1] >> 12));
}
}
}
SHA256SUM1B {
// opcode: custom-0
encoding: 7'b0001011 :: 5'b00000 :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.sha256sum1b", "{name(rd)}, {name(rs1)}"};
behavior: {
if (rd != 0) {
// X[rd] = rotl32(X[rs1], 26) ^ rotl32(X[rs1], 21) ^ rotl32(X[rs1], 7);
X[rd] = ((X[rs1] << 26) | (X[rs1] >> 6)) ^ ((X[rs1] << 21) | (X[rs1] >> 11)) ^ ((X[rs1] << 7) | (X[rs1] >> 25));
}
}
}
ROTL32 {
// opcode: custom-0
encoding: 7'b0010000 :: rs2[4:0] :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.rotl32", "{name(rd)}, {name(rs1)}, {name(rs2)}"};
behavior: {
if (rd != 0) {
// X[rd] = (X[rs1] << X[rs2]) | (X[rs1] >> (32 - X[rs2]));
X[rd] = (X[rs1] << X[rs2][4:0]) | (X[rs1] >> (32 - X[rs2][4:0]));
}
}
}
ROTR32 {
// opcode: custom-0
encoding: 7'b0010001 :: rs2[4:0] :: rs1[4:0] :: 3'b000 :: rd[4:0] :: 7'b0001011;
assembly: {"oa.rotr32", "{name(rd)}, {name(rs1)}, {name(rs2)}"};
behavior: {
if (rd != 0) {
// X[rd] = (X[rs1] >> X[rs2]) | (X[rs1] << (32 - X[rs2]));
X[rd] = (X[rs1] >> X[rs2][4:0]) | (X[rs1] << (32 - X[rs2][4:0]));
}
}
}
}
}
Loading
Loading