Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
933f314
fix: don't discard optimized code when post-split perf estimate fails
thisisjube Jun 10, 2026
bcce0d7
examples: add keccak examples and adjust _example.py
thisisjube Apr 1, 2026
2ecae71
examples: add dilithium_basemul rvv
thisisjube Apr 1, 2026
2b8abda
examples: add kyber_basemul rvv implementations
thisisjube Apr 1, 2026
fc0855e
examples: add kyber_sampling files
thisisjube Apr 1, 2026
dd9fbfb
examples: add ntt_dilithium rvv versions and adjust _example.py
thisisjube Apr 1, 2026
155eab5
examples: adjust kyber_basemul _example.py
thisisjube Apr 1, 2026
5a9d577
examples: adjust dilithium_basemul _example.py
thisisjube Apr 1, 2026
77635f5
examples: add ntt_kyber rvv versions and adjust _example.py
thisisjube Apr 1, 2026
d90ebea
examples: add optimized rvv code
thisisjube Apr 1, 2026
1fa8204
feat: add rvv features
thisisjube Apr 1, 2026
e7b71ee
fix: fix instructions in xuantie_c908
thisisjube Apr 1, 2026
0b6c8b4
refactor: satisfy linter
thisisjube Apr 1, 2026
6b76f69
feat: add LMUL support
thisisjube Apr 8, 2026
1286308
fix: quick fix for riscv_lmul_comprehensive_c908
thisisjube Apr 8, 2026
1308fd0
fix: fix combination list for expanded instructions with fixed masked…
thisisjube Apr 15, 2026
6fcb30a
feat: add riscv to cli, fix RISC_V_nf_load_store_whole_reg_test (enfo…
thisisjube Apr 15, 2026
a32986c
fix: add individual optimization regions for intt_kyber_rvv_vlen128 a…
thisisjube Apr 15, 2026
d81e71f
refactor: linting
thisisjube Apr 15, 2026
127c0f4
fix: fix _extract_base_registers which assumed that register groups b…
thisisjube Apr 15, 2026
5573f63
refactor: change comments from # to //
thisisjube Apr 15, 2026
f16a7e1
fix: add missing macros to kyber_normal2ntt_order_rvv_vlen128 and kyb…
thisisjube Apr 15, 2026
0ddb595
fix: mistake in kyber_poly_tomont_rvv_vlen128.s
thisisjube Apr 16, 2026
f1c0ac0
refactor: satisfy linter
thisisjube Apr 22, 2026
bd26c6a
feat: advance BranchLoop to recognizing addi AND add as loop incremen…
thisisjube Apr 22, 2026
aea63e3
feat: store expansion_factor per object to fix second parsing round a…
thisisjube Apr 22, 2026
8b26149
feat: allow multiple vsetvl* istructions in the same optimization region
thisisjube May 6, 2026
ad208ef
refactor: add explicit LMUL declaration to all rvv examples
thisisjube May 6, 2026
1532be3
refactor: satisfy linter
thisisjube May 6, 2026
c2d17ca
feat: add check after parsing whether LMUL is set when vector instruc…
thisisjube May 6, 2026
ca1c7be
fix
thisisjube May 6, 2026
e68d451
fix: fix documentation
thisisjube May 6, 2026
533ff37
optimize ntt_kyber_rvv_vlen128
thisisjube May 13, 2026
a8f072a
fix: correct config for ntt_kyber_rvv example
thisisjube May 13, 2026
01ad2ff
fix: push/ pop scalar registers in ntt_kyber_rvv example
thisisjube May 13, 2026
3dddfa8
feat: get instruction inverse throughput depending on lmul and sew. S…
thisisjube May 20, 2026
a9ff332
optimize ntt_kyber_rvv_vlen128
thisisjube May 13, 2026
12aeb13
optimize ntt_kyber_rvv_vlen128 with better params
thisisjube May 20, 2026
5a88817
fix: correct execution units
thisisjube May 20, 2026
d294424
next optimize try
thisisjube May 20, 2026
cfef421
optimize ntt_kyber_rvv
thisisjube May 20, 2026
bb4a09b
optimize rvv
thisisjube May 24, 2026
5c75d14
feat/ fix: enhance modeling of latencies for vector instructions (som…
thisisjube Jun 10, 2026
45227a1
feat: enhance modeling of inverse tp for vector instructions (some ve…
thisisjube Jun 10, 2026
3eeaaee
refactor: adjust example params
thisisjube Jun 10, 2026
5059346
refactor: adjust params
thisisjube Jun 10, 2026
c3fa992
refactor: adjust params
thisisjube Jun 10, 2026
cc35313
refactor: adjust params
thisisjube Jun 10, 2026
2b2305c
opt
thisisjube Jun 10, 2026
b2a82b4
refactor: adjust params
thisisjube Jun 10, 2026
b83c735
optimized ntt_rvv_kyber
thisisjube Jun 10, 2026
8aeda1c
adjust params
thisisjube Jun 10, 2026
6cd300c
optimize rvv
thisisjube Jun 11, 2026
7a9e5cd
opt with old config to compare
thisisjube Jun 17, 2026
b085d2e
refactor: adjust examples
thisisjube Jun 17, 2026
eb57bb4
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jun 17, 2026
2e97309
refactor: adjust examples
thisisjube Jun 17, 2026
2ae4ee5
opt ntt_dilithium_rvv_vlen128
thisisjube Jun 17, 2026
c35ccd6
refactor: add save/ restore regs to ntt_dilitihium_rvv_vlen128_unfold…
thisisjube Jun 17, 2026
48d580d
optimize kyber rvv with estimation
thisisjube Jun 22, 2026
c24b7ae
refactor: enable performance estimation
thisisjube Jun 22, 2026
ead6636
refactor: add kyber sampling examples
thisisjube Jun 22, 2026
3a90fa8
feat: adjust kyber sampling examples
thisisjube Jun 22, 2026
7e8c819
feat: add widening instruction class for kyber sampling
thisisjube Jun 22, 2026
f8ee98c
feat: optimize all kyber sampling examples
Jun 22, 2026
bb806d7
refactor: adjust kyber examples
thisisjube Jun 22, 2026
4f1a1e0
refactor: adjust example conf
thisisjube Jun 22, 2026
be1d4f5
optimized remaining kyber examples
Jun 22, 2026
14f17a7
add ntt_kyber_dualissue_l32_plant_rv64im
thisisjube Jun 24, 2026
e40f4a8
optimize ntt_kyber_dualissue_l32_plant_rv64im
Jun 24, 2026
c3127c2
optimize kyber_poly_reduce_rvv_vlen128_opt_c908.s
Jun 24, 2026
d70dcec
add script to re-run all rvv examples
thisisjube Jun 24, 2026
d4f24b3
adjust dilithium examples
thisisjube Jun 24, 2026
effea20
adjust examples and add run-failed option to script
thisisjube Jun 24, 2026
950eb45
remove unfolded versions
thisisjube Jun 24, 2026
95f29bb
adjust examples
thisisjube Jun 24, 2026
ae99676
partly oprimize rvv
Jun 25, 2026
7a36831
optimize second part of rvv examples, still some missing
Jun 29, 2026
45c3aa9
adjust examples
thisisjube Jun 29, 2026
404e368
adjust examples
thisisjube Jul 1, 2026
e7a6541
adjust examples
thisisjube Jul 1, 2026
68ff93d
Fix RVV opt-output export/opcode defects in kyber poly reduce/tomont
thisisjube Jul 1, 2026
a963b5e
optimize intt_kyber_rvv, ntt_dilithium_rvv
thisisjube Jul 1, 2026
9c76be5
Fix .globl export in kyber sampling opt outputs (cbd2/cbd3/rej_uniform)
thisisjube Jul 1, 2026
0c3c5ad
opt broken kyber dual
thisisjube Jul 1, 2026
dd6253d
add save/ restore regs to kyber_poly_ examples
thisisjube Jul 1, 2026
ddb4204
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
852dc10
Make re-optimized kyber dual_opt files assemble/link (symbol + opcode)
thisisjube Jul 1, 2026
4cb9e56
fix widening instruction overlap
thisisjube Jul 1, 2026
4ca4af0
Fix two RISC-V codegen bugs in SLOTHY (vsext overlap + branch spacing)
thisisjube Jul 1, 2026
6905b05
opt sampling cbd2
Jul 1, 2026
5940a41
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
6d37415
opt cbd2
Jul 1, 2026
64cce83
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
fab1282
opt kyber rej sampling
Jul 1, 2026
ede52fe
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
4493d10
opt kyber rej samling
Jul 1, 2026
affdb8a
add opt labels
thisisjube Jul 1, 2026
4824223
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
84f68be
enable halving heuristics for failing dual examples
thisisjube Jul 1, 2026
2b429f8
Merge branch 'riscv-rvv' of github.com:thisisjube/slothy into riscv-rvv
thisisjube Jul 1, 2026
27f0fa3
opt kyber_poly dual versions with halving heuristic
Jul 1, 2026
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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Makefile for formatting and linting Python code

# Targets
.PHONY: black flake8 check all

# Format code using black
black:
black --version
black . --exclude venv

# Lint code using flake8
flake8:
flake8 --version
flake8 . --config .flake8 --exclude venv,.venv

# Run both format and lint
check: black flake8

# Alias for check
all: check
5 changes: 5 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
example_instances as example_instances_riscv_kyber_basemul,
)

from examples.naive.riscv.kyber_sampling._example import (
example_instances as example_instances_riscv_kyber_sampling
)

from examples.naive.riscv.keccak._example import (
example_instances as example_instances_riscv_keccak,
)
Expand All @@ -125,6 +129,7 @@ def main():
+ example_instances_riscv_dilithium_basemul
+ example_instances_riscv_ntt_kyber
+ example_instances_riscv_kyber_basemul
+ example_instances_riscv_kyber_sampling
+ example_instances_riscv_keccak
)

Expand Down
67 changes: 67 additions & 0 deletions examples/naive/riscv/dilithium_basemul/_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,70 @@ def core(self, slothy):
slothy.optimize_loop("poly_reduce_rv64im_loop")


class RISC_V_poly_basemul_rvv_vlen128(OptimizationRunner):
def __init__(self, var="", arch=RISC_V, target=Target_XuanTieC908, timeout=None):
name = "dilithium_poly_basemul_rvv_vlen128"
infile = name

super().__init__(
infile,
name,
subfolder=SUBFOLDER,
rename=True,
arch=arch,
target=target,
timeout=timeout,
funcname="poly_basemul_rvv_vlen128",
var=var,
)

def core(self, slothy):
slothy.config.variable_size = True
slothy.config.constraints.stalls_first_attempt = 32
slothy.config.inputs_are_outputs = True

import slothy.targets.riscv.xuantie_c908 as target_module
target_module.lmul = 8
target_module.sew = 32

r = slothy.config.reserved_regs
r += ["x3"]
slothy.config.reserved_regs = r
slothy.config.outputs = ["x3"]
slothy.optimize_loop("poly_basemul_rvv_vlen128_loop")


class RISC_V_poly_basemul_acc_rvv_vlen128(OptimizationRunner):
def __init__(self, var="", arch=RISC_V, target=Target_XuanTieC908, timeout=None):
name = "dilithium_poly_basemul_acc_rvv_vlen128"
infile = name

super().__init__(
infile,
name,
subfolder=SUBFOLDER,
rename=True,
arch=arch,
target=target,
timeout=timeout,
funcname="poly_basemul_acc_rvv_vlen128",
var=var,
)

def core(self, slothy):
slothy.config.variable_size = True
slothy.config.constraints.stalls_first_attempt = 32
slothy.config.inputs_are_outputs = True
import slothy.targets.riscv.xuantie_c908 as target_module
target_module.lmul = 8
target_module.sew = 32
r = slothy.config.reserved_regs
r += ["x3"]
slothy.config.reserved_regs = r
slothy.config.outputs = ["x3"]
slothy.optimize_loop("poly_basemul_acc_rvv_vlen128_loop")


example_instances = [
RISC_V_poly_basemul_8l_init_rv64im(),
RISC_V_poly_basemul_8l_rv64im(),
Expand All @@ -165,4 +229,7 @@ def core(self, slothy):
RISC_V_poly_basemul_8l_acc_rv64im(var="dual"),
RISC_V_poly_basemul_8l_acc_end_rv64im(var="dual"),
RISC_V_poly_reduce_rv64im(var="dual"),
# RVV
RISC_V_poly_basemul_rvv_vlen128(),
RISC_V_poly_basemul_acc_rvv_vlen128(),
]
Loading