Skip to content

Commit

Permalink
Merge pull request #148 from opencompl/anton/fix-maxf
Browse files Browse the repository at this point in the history
add sed script for operation renaming to allow xdsl-opt to handle maxf, fixes #142
  • Loading branch information
AntonLydike authored Jan 26, 2024
2 parents c337c80 + f6f534b commit 7971d54
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 6 deletions.
12 changes: 9 additions & 3 deletions kernels/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ pivoted.csv: kernels.csv ../scripts/pivot.py

# Remove all csv files in this folder, recursively
clean:
find . -type f -name "*.csv" -print0 | xargs -0 rm
find . -type f -name "*.csv" -print0 | xargs -0 rm -f
find . -type f -name "*.x" -print0 | xargs -0 rm -f
find . -type d -name "*.x.logs" -print0 | xargs -0 rm -rf
find . -type f -name "*.S" -print0 | xargs -0 rm -f
find . -type f -name "*.bc" -print0 | xargs -0 rm -f
find . -type f -name "*.ll" -print0 | xargs -0 rm -f
find . -type f -name "*.ll.mlir" -print0 | xargs -0 rm -f

# kernels.csv is the aggregation of all kernels

Expand Down Expand Up @@ -127,7 +133,7 @@ MAX_POOL_16_TESTS += $(MAX_POOL_16)/linalg.csv
MAX_POOL_16_TESTS += $(MAX_POOL_16)/snitch_stream.csv
MAX_POOL_16_TESTS += $(MAX_POOL_16)/snrt.csv
# maxf renamed in MLIR 17
# MAX_POOL_16_TESTS += $(MAX_POOL_16)/scf_xdsl.csv
MAX_POOL_16_TESTS += $(MAX_POOL_16)/scf_xdsl.csv

$(MAX_POOL_16)/tests.csv: $(MAX_POOL_16_TESTS)
./generate_tests_csv.sh $@ $^
Expand Down Expand Up @@ -163,7 +169,7 @@ RELU_16_TESTS += $(RELU_16)/linalg.csv
# RELU_16_TESTS += $(RELU_16)/linalg_xdsl.csv
RELU_16_TESTS += $(RELU_16)/snitch_stream.csv
# maxf renamed in MLIR 17
# RELU_16_TESTS += $(RELU_16)/scf_xdsl.csv
RELU_16_TESTS += $(RELU_16)/scf_xdsl.csv

$(RELU_16)/tests.csv: $(RELU_16_TESTS)
./generate_tests_csv.sh $@ $^
Expand Down
2 changes: 2 additions & 0 deletions kernels/kernels.csv
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pooling_nchw_max_d1_s2_3x3,1x1x16x16xf64,baseline,1435
pooling_nchw_max_d1_s2_3x3,1x1x16x16xf64,linalg,1201
pooling_nchw_max_d1_s2_3x3,1x1x16x16xf64,snitch_stream,1118
pooling_nchw_max_d1_s2_3x3,1x1x16x16xf64,snrt,1094
pooling_nchw_max_d1_s2_3x3,1x1x16x16xf64,scf_xdsl,24699
pooling_nchw_sum_d1_s2_3x3,1x1x16x16xf64,baseline,1948
pooling_nchw_sum_d1_s2_3x3,1x1x16x16xf64,linalg,1948
pooling_nchw_sum_d1_s2_3x3,1x1x16x16xf64,snitch_stream,2000
Expand All @@ -45,4 +46,5 @@ relu,16x16xf64,ssr_frep,327
relu,16x16xf64,snrt,334
relu,16x16xf64,linalg,1074
relu,16x16xf64,snitch_stream,322
relu,16x16xf64,scf_xdsl,5020
softmax,16xf64,baseline,32613
4 changes: 2 additions & 2 deletions kernels/pivoted.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dense 8x8xf64,3239,4494,,2734,2709,3239
dsum 8x16xf32,1202,794,3564,194,187,794
fill 16x16xf64,370,347,2676,294,299,347
matmul 8x8xf64,2562,3816,21360,2324,2304,2562
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64,1435,1201,,1118,1094,1201
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64,1435,1201,24699,1118,1094,1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64,1948,1948,24699,2000,1976,1948
relu 16x16xf64,1081,1074,,322,334,1074
relu 16x16xf64,1081,1074,5020,322,334,1074
softmax 16xf64,32613,,,,,32613
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24699
1 change: 1 addition & 0 deletions kernels/pooling_nchw_max_d1_s2_3x3/1x1x16x16xf64/tests.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ baseline,1435
linalg,1201
snitch_stream,1118
snrt,1094
scf_xdsl,24699
1 change: 1 addition & 0 deletions kernels/pooling_nchw_max_d1_s2_3x3/params.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
1x1x16x16xf64,linalg,1201
1x1x16x16xf64,snitch_stream,1118
1x1x16x16xf64,snrt,1094
1x1x16x16xf64,scf_xdsl,24699
1 change: 1 addition & 0 deletions kernels/relu/16x16xf64/scf_xdsl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5020
1 change: 1 addition & 0 deletions kernels/relu/16x16xf64/tests.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ssr_frep,327
snrt,334
linalg,1074
snitch_stream,322
scf_xdsl,5020
1 change: 1 addition & 0 deletions kernels/relu/params.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
16x16xf64,snrt,334
16x16xf64,linalg,1074
16x16xf64,snitch_stream,322
16x16xf64,scf_xdsl,5020
5 changes: 4 additions & 1 deletion snitch/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ XDSLOPT = xdsl-opt
XDSL_DIR = /src/xdsl
XDSL_COMMIT_FILE = /src/xdsl_commit.txt

# conversion script for maxif -> maximumf translation:
TRANSLATE_MAXF_TO_MAXIMUMF=sed 's/arith.maxf/arith.maximumf/g'

# Get the current commit hash of xdsl
CURRENT_XDSL_COMMIT := $(shell git -C $(XDSL_DIR) rev-parse HEAD)

Expand Down Expand Up @@ -137,7 +140,7 @@ XDSLOPTFLAGS += -t riscv-asm
$(MLIROPT) $(MLIROPTFLAGS_SCF_XDSL) --mlir-print-local-scope -o $@ $<

%.S: %.xdsl.mlir $(XDSL_COMMIT_FILE)
$(XDSLOPT) $(XDSLOPTFLAGS) $< -o $@
$(TRANSLATE_MAXF_TO_MAXIMUMF) $< | $(XDSLOPT) $(XDSLOPTFLAGS) -o $@

# cd /src/xdsl; pwd; . ../venv/bin/activate; python -m docs.Toy.toy --emit=snitch-asm $(abspath $<) --ir > $(abspath $@)

Expand Down

0 comments on commit 7971d54

Please sign in to comment.