Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
f5a8dad
Initial commit
microsoft-github-operations[bot] Oct 8, 2024
1b7ec21
CODE_OF_CONDUCT.md committed
microsoftopensource Oct 8, 2024
7a66bac
SECURITY.md committed
microsoftopensource Oct 8, 2024
019a370
LICENSE committed
microsoftopensource Oct 8, 2024
3c8a7da
README.md committed
microsoftopensource Oct 8, 2024
095e4e9
SUPPORT.md committed
microsoftopensource Oct 8, 2024
426e89d
Created branch, added codeowners
Jan 30, 2025
10d7bb3
Initial migration from internal repo (#5)
STFleming Jan 30, 2025
5ba98f9
BERT builder flow arguments for fifosim n_inferences (#6)
STFleming Feb 17, 2025
ccd023b
[SoftMax] New Improved SoftMax (#11)
STFleming Mar 7, 2025
ad639bc
[BugFix] Issues with incorrect configuration of SIMD for ShuffleB nod…
STFleming Mar 7, 2025
4afffcd
Adding cycle testing to custom op test scripts (#7)
penrosed Mar 7, 2025
fcd7bc3
Added a custom step that extracts metadata for the shell integration …
STFleming Mar 13, 2025
fab2842
[TinyBERT] Removing accidentally included start_step in the endtoend …
STFleming Mar 18, 2025
d7fb002
Removing rtlsim_backend after pyverilator deprecation (#16)
STFleming Mar 19, 2025
0c72dda
Name stylize BrainSmith --> Brainsmith (#17)
tafk7 Mar 20, 2025
dbfbe67
[TinyBERT] Add ref IO to stitched_ip as part of metadata handover (#18)
STFleming Mar 27, 2025
3d8aac0
[Testing] Created OpTest class for abstracting CustomOp tests (#19)
penrosed Apr 3, 2025
99e2aa2
Initial repository structure (#20)
tafk7 Apr 11, 2025
15fb647
Add Custom ONNXSCRIPT repository to BrainSmith (#21)
jsmonson Apr 17, 2025
752bd39
Revert "Add Custom ONNXSCRIPT repository to BrainSmith (#21)" (#22)
tafk7 Apr 18, 2025
17fc5ca
[CustomOps] Update brainsmith custom ops with changes on finn side (#25)
auphelia Apr 28, 2025
3dcfe0b
Initial continuous integration tests (#24)
tafk7 Apr 29, 2025
ff45805
Revert onnxscript add Revert (#26)
jsmonson May 2, 2025
ec39f0d
Fix Dynamic Matmul Initial Config For BERT-Large (#28)
jsmonson May 2, 2025
fc73217
fix argparse arg that could never be false (#30)
jsmonson May 27, 2025
4530385
Patch Pull Request #30: Update args variable to match new argument na…
jsmonson May 28, 2025
7a410b2
update pytorch to 2.7 (#34)
jsmonson May 29, 2025
30e48ad
[Hotfix] Cleanup CI runner artifacts (#33)
tafk7 May 29, 2025
40abeed
update brevitas commit hash (#36)
jsmonson May 30, 2025
937a639
Set onnxscript to a fixed commit id (#37)
jsmonson Jun 2, 2025
84b5301
Hardware Kernel Generator: RTL Parser & wrapper generation (#32)
tafk7 Jun 4, 2025
3b50184
Add BERT-Large CI Test (#40)
jsmonson Jun 11, 2025
9dc7ae8
Docker workflow modernization (#38)
tafk7 Jun 17, 2025
d14fbba
Update FINN (#41)
auphelia Jun 25, 2025
56b90fd
Core DSE & Plugin Library (#44)
tafk7 Aug 1, 2025
cee12b7
Version 0.1.0a1 - Initial Closed Alpha Release (#45)
tafk7 Aug 1, 2025
1ebf35c
[Deps] Update and fix finn and qonnx deps
auphelia Aug 27, 2025
d3e9f4d
Merge remote-tracking branch 'origin/main' into develop-branch-update
Aug 29, 2025
dedc4cc
Merge branch 'dev/update_finn_qonnx' of github.com:microsoft/Brainsmi…
Aug 29, 2025
eee7ee0
Merge branch 'main' of github.com:microsoft/Brainsmith into develop
Aug 29, 2025
b2e4c44
[Deps] Update and fix finn and qonnx deps (#54)
jsmonson Aug 29, 2025
075885e
Hotfix: Update and freeze FINN dependency #2 (#55)
jsmonson Aug 29, 2025
a41bf20
Hotfix: Update and freeze FINN dependency #2 (#55)
jsmonson Aug 29, 2025
87493eb
Kernel Integrator (#48)
tafk7 Sep 1, 2025
f407e99
update tranformers, add onnxscript, update brevitas
Sep 12, 2025
ce6614e
update tranformers, add onnxscript, update brevitas
Sep 12, 2025
c75bd5a
add loop rolling step
Sep 12, 2025
5c5c7f5
add loop rolling step
Sep 12, 2025
4bc48b4
add bert dynamo export
Sep 12, 2025
a27278a
add bert dynamo export
Sep 12, 2025
db18921
preserve metadata through simplify operation
Sep 12, 2025
ab375b6
preserve metadata through simplify operation
Sep 12, 2025
f741dfc
add bert mlo demo
Sep 12, 2025
9c7a702
add bert mlo demo
Sep 12, 2025
85fb1a2
reinster from white space
Sep 12, 2025
4030c96
reinster from white space
Sep 12, 2025
9cecf0d
update to onnxscript 0.5.0
Sep 15, 2025
812f9cb
update to onnxscript 0.5.0
Sep 15, 2025
ce1c84a
remove custom onnxscript repo
Sep 15, 2025
3ebe70f
remove custom onnxscript repo
Sep 15, 2025
2274c77
update additonal onnx script location
Sep 15, 2025
1960795
update additonal onnx script location
Sep 15, 2025
671ee7a
added split large fifo option for MLO
Sep 15, 2025
b6621cd
added split large fifo option for MLO
Sep 15, 2025
216cbb0
Merge pull request #58 from microsoft/develop-branch-update
tafk7 Sep 19, 2025
729d969
Integration tests & updated docs (#59)
tafk7 Sep 22, 2025
66fa33a
Merge branch 'develop' of github.com:microsoft/Brainsmith into dev/jo…
Sep 24, 2025
b47d7a7
Merge branch 'develop' of github.com:microsoft/Brainsmith into dev/jo…
Sep 24, 2025
cd4f3d5
align with devleop branch
Sep 24, 2025
8481ba2
align with devleop branch
Sep 24, 2025
b211b3a
update bash script to match bert_demo.py args
Sep 26, 2025
22b736c
initial testing of a trained single layer BERT model being passed thr…
STFleming Sep 29, 2025
7d652e3
Changing the input datatype to match the new input
STFleming Sep 30, 2025
9634b70
Collapsing some of the additional mul nodes (thanks @auphelia)
STFleming Sep 30, 2025
466eafc
Small changes to work with the indices from the crop node that gets g…
STFleming Sep 30, 2025
96adde7
Getting up initial training script for pipecleaner model
STFleming Oct 2, 2025
9e35722
Merge remote-tracking branch 'origin/develop' into dev/joshmonson/add…
Oct 2, 2025
f87cedb
Merge branch 'dev/joshmonson/add-loop-rolling' of github.com:microsof…
Oct 2, 2025
a8d2ed1
return missing lines
Oct 2, 2025
cac2921
Merge branch 'develop' of github.com:microsoft/Brainsmith into dev/jo…
Oct 2, 2025
64d2cf3
Add Round and Clip Thresholds Step for MLO
Oct 2, 2025
aef87a1
Fixing commit for dynamo export thanks @auphelia
STFleming Oct 3, 2025
a32d7fc
Making Quantization work inside the Brainsmith container
STFleming Oct 3, 2025
db5ee89
FIFO configuration for a single layer for faster deployment
STFleming Oct 3, 2025
995e724
Adding some precalculated FIFO depths
STFleming Oct 3, 2025
d5726d4
Pointing at latest changes from @auphelia
STFleming Oct 3, 2025
51120ab
Produce a dcp
STFleming Oct 3, 2025
91d4916
update finn configs
Oct 9, 2025
452eecc
4-bit weights are current broken due to fetch weights.
Oct 11, 2025
c5ec519
Merging with Josh's latest MLO tests
STFleming Oct 13, 2025
646a4dc
fetch repos pointing at the appropriate branches
STFleming Oct 13, 2025
61ec09a
Fix typo
STFleming Oct 13, 2025
01ebe97
removing cleanup from here in case it is removing metadata
STFleming Oct 13, 2025
d631499
[Transforms] Add node metadata propagation to bsmith transforms
auphelia Oct 13, 2025
5148465
Merge branch 'dev/auphelia/propagate-metadata' into dev/sfleming/trai…
auphelia Oct 13, 2025
ab30a8d
[Transforms] Add node metadata propagation to bsmith transforms (#72)
auphelia Oct 13, 2025
7d5868b
[BertFlow] Add loop body hierarchies
auphelia Oct 14, 2025
a3851a1
fix the metadata issue.
Oct 15, 2025
d8af33c
forgotten file from last commit
Oct 15, 2025
e6e9f2e
Merge pull request #77 from microsoft/dev/joshmonson/trainedbert_mlo_…
STFleming Oct 16, 2025
8c1d0dc
Merge remote-tracking branch 'origin/dev/joshmonson/add-loop-rolling'…
STFleming Oct 20, 2025
a7678e9
Added an initial folding configuration to try and get the end2end flo…
STFleming Oct 20, 2025
a51639f
[BertMLO] Add prefix to folding config
auphelia Oct 20, 2025
95cfca9
[BertMLO] Add first iteration of folding config json containing all n…
auphelia Oct 21, 2025
9474188
update loop_body_hierarhcy to list of lists
Oct 21, 2025
65022cf
Adding back in the head removal to avoid the automated partitioning.
STFleming Oct 22, 2025
93699b1
[TrainedBERT] removing the duplicate generate_reference_io
STFleming Oct 22, 2025
950c494
Merge pull request #78 from microsoft/dev/joshmonson/run_untrained_mlo
STFleming Oct 22, 2025
6aad596
[ShellHandover] Updated the shell handover generation to include spec…
STFleming Oct 30, 2025
6e039d9
[Crop] Update crop node execute node fct to use hlsbackend
auphelia Oct 31, 2025
5f5993b
initial documentation for loop-rolling
Oct 31, 2025
0ed5942
Roll-back some of the claims made by the AI.
Oct 31, 2025
9e3e445
remove GPT since we don't support that
Oct 31, 2025
6f9796e
additional explaninations
Oct 31, 2025
ae06ebc
updates that need to be reviewed.
Oct 31, 2025
ea65d83
[LayernormHLS] Update execute node fct
auphelia Nov 4, 2025
f76211d
almost done
Nov 7, 2025
e1cb39b
asked ai to review and test the code snippets. They at least run but …
Nov 7, 2025
6091c48
Merge branch 'dev/sfleming/trainedbert_mlo' of github.com:microsoft/B…
Nov 7, 2025
68e5bcb
one more fix
Nov 7, 2025
ef131c5
Merge branch 'develop' into dev/joshmonson/add-loop-rolling
tafk7 Nov 9, 2025
d5d015b
Merge branch 'develop' into dev/joshmonson/add-loop-rolling
tafk7 Nov 9, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
"""Shell integration metadata extraction transform."""

import json
import os
import shutil
import numpy as np
from qonnx.transformation.base import Transformation
import qonnx.custom_op.registry as registry

from finn.util.mlo_sim import dat_file_to_numpy_array

class ExtractShellIntegrationMetadata(Transformation):
"""Walks the ONNX graph and extracts all relevant metadata for shell integration
Expand All @@ -19,26 +22,72 @@ def __init__(self, metadata_file: str):
def apply(self, model):
graph = model.graph

# destination dir to copy artifacts
dirname = os.path.dirname(self.metadata_file)

# Search for FINNLoop ops (Does not currently support nested FINNLoops)
finn_loops={}
mlo = False
for node in model.graph.node:
if node.op_type == "FINNLoop":
finnloop_op = registry.getCustomOp(node)
finnloop_body = finnloop_op.get_nodeattr("body");

mvau_hbm_weights = {}
extern_idx = 0
for idx, lb_inp in enumerate(finnloop_body.graph.input):
downstream = finnloop_body.find_consumer(lb_inp.name)
if downstream.op_type.startswith("MVAU"):
mlo = True
mvau_hbm_weights[idx] = {}
mvau_hbm_weights[idx]["name"] = lb_inp.name
datfile = (
f"{finnloop_op.get_nodeattr('code_gen_dir_ipgen')}/memblock_MVAU_rtl_id_{idx}.dat"
)

# Save the weights as a numpy file
np_dat = dat_file_to_numpy_array(datfile)
mvau_hbm_weights[idx]["weight_npy"] = f"memblock_MVAU_rtl_id_{idx}.npy"
np.save(f"{dirname}/{mvau_hbm_weights[idx]['weight_npy']}", np_dat)

# Copy to the destination dir
mvau_hbm_weights[idx]["extern_idx"] = extern_idx
mvau_hbm_weights[idx]["extern_name"] = f"m_axi_MVAU_id_{idx}"
mlo_mvau = registry.getCustomOp(downstream)
mvau_hbm_weights[idx]["PE"] = mlo_mvau.get_nodeattr("PE")
mvau_hbm_weights[idx]["SIMD"] = mlo_mvau.get_nodeattr("SIMD")
mvau_hbm_weights[idx]["MH"] = mlo_mvau.get_nodeattr("MH")
mvau_hbm_weights[idx]["MW"] = mlo_mvau.get_nodeattr("MW")
mvau_hbm_weights[idx]["weightDataType"] = mlo_mvau.get_nodeattr("weightDataType")
extern_idx += 1
finn_loops[node.name] = mvau_hbm_weights
self.md["mlo"] = mlo
self.md["finn_loops"] = finn_loops


# Extract instream widths
instreams = {}
for input_tensor in graph.input:
consumer = model.find_consumer(input_tensor.name)
inst = registry.getCustomOp(consumer)
instreams[input_tensor.name] = {
'width': inst.get_instream_width(),
'shape': inst.get_normal_input_shape()
}
self.md['instreams'] = instreams
instream = {}
instream['width'] = inst.get_instream_width()
instreams[input_tensor.name] = instream
instream['shape'] = inst.get_normal_input_shape()
instream['datatype'] = inst.get_input_datatype().name
self.md['insteams'] = instreams

outstreams = {}
for output_tensor in graph.output:
producer = model.find_producer(output_tensor.name)
inst = registry.getCustomOp(producer)
outstreams[output_tensor.name] = {
'width': inst.get_outstream_width(),
'shape': inst.get_normal_output_shape()
}
self.md['outstreams'] = outstreams

outstream = {}
outstream['width'] = inst.get_outstream_width()
outstreams[output_tensor.name] = outstream
outstream['shape'] = inst.get_normal_output_shape()
outstream['datatype'] = inst.get_output_datatype().name
self.md['outsteams'] = outstreams

static_matmuls = {}
for node in graph.node:
if (node.op_type == "MVAU_rtl"):
Expand All @@ -54,4 +103,4 @@ def apply(self, model):
with open(self.metadata_file, "w") as fp:
json.dump(self.md, fp, indent=4)

return (model, False)
return(model, False)
3 changes: 2 additions & 1 deletion brainsmith/steps/bert_custom_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def bert_streamlining_step(model: Any, cfg: Any) -> Any:
MoveScalarMulPastMatMul(),
MoveScalarLinearPastInvariants(),
AbsorbMulIntoMultiThreshold(),
AbsorbAddIntoMultiThreshold()
AbsorbAddIntoMultiThreshold(),
RoundAndClipThresholds()
]:
model = model.transform(transform)

Expand Down
12 changes: 12 additions & 0 deletions docker/fetch-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,21 @@ fi

# Define our Git dependencies - URLs and revisions
declare -A GIT_DEPS=(
<<<<<<< HEAD
["brevitas"]="https://github.com/Xilinx/brevitas.git@95edaa0bdc8e639e39b1164466278c59df4877be"
["qonnx"]="https://github.com/fastmachinelearning/qonnx.git@custom/brainsmith"
["finn"]="https://github.com/tafk7/finn.git@custom/transformer"
["onnxscript"]="https://github.com/jsmonson/onnxscript.git@62c7110aba46554432ce8e82ba2d8a086bd6227c"
||||||| c35477d
["brevitas"]="https://github.com/Xilinx/brevitas.git@95edaa0bdc8e639e39b1164466278c59df4877be"
["qonnx"]="https://github.com/fastmachinelearning/qonnx.git@f2c4ccd3e71795c9f116ee5a0c87a7dfd590c6d0"
["finn"]="https://github.com/tafk7/finn.git@custom/transformer"
["onnxscript"]="https://github.com/jsmonson/onnxscript.git@62c7110aba46554432ce8e82ba2d8a086bd6227c"
=======
["brevitas"]="https://github.com/Xilinx/brevitas.git@c10ef8764967e9cacc60347ce185be14e4ad97c4"
["qonnx"]="https://github.com/fastmachinelearning/qonnx.git@f2c4ccd3e71795c9f116ee5a0c87a7dfd590c6d0"
["finn"]="https://github.com/tafk7/finn.git@feature/logging-integration-transformer"
>>>>>>> develop
["finn-experimental"]="https://github.com/Xilinx/finn-experimental.git@0724be21111a21f0d81a072fccc1c446e053f851"
["dataset-loading"]="https://github.com/fbcotter/dataset_loading.git@0.0.4"
)
Expand Down
Loading
Loading