Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
312 commits
Select commit Hold shift + click to select a range
f03f622
Added SciPy to dependencies + formatting
affifboudaoud Jun 25, 2025
008026c
Add pip dependency
and-ivanov Jun 27, 2025
aa4d836
Make daceml tests discoverable
and-ivanov Jun 27, 2025
40e2338
fix frontend test
and-ivanov Jun 30, 2025
0a9f71e
Fix paths
and-ivanov Jun 30, 2025
988e230
Remove obsolete test that ensures only floating point computations ar…
and-ivanov Jun 30, 2025
f693f9b
Remove obsolete single state test
affifboudaoud Jun 30, 2025
b9812f5
Merge branch 'update_efforts' of https://github.com/affifboudaoud/dac…
affifboudaoud Jun 30, 2025
bc314d7
Remove deprecated np.bool
affifboudaoud Jun 30, 2025
636d1ea
Fix API usage in test SDFGBackwardRunner
and-ivanov Jun 30, 2025
d1ade4a
Fix conv implementation for default strides and pads
and-ivanov Jun 30, 2025
884d015
Fix ONNX operator expansions and their tests
and-ivanov Jul 1, 2025
a0dce78
Only use descriptor names to get AD data
affifboudaoud Jul 1, 2025
946d1b9
Added simplify to test_nested to avoid FunctionCallRegions
affifboudaoud Jul 1, 2025
25e3cc1
Added backward pass for Min reduction
affifboudaoud Jul 2, 2025
9353d90
Remove init state transformation and test since we support multiple s…
affifboudaoud Jul 3, 2025
431493b
Update bfs api
affifboudaoud Jul 3, 2025
baecfeb
Forward data if seprate_sdfgs
affifboudaoud Jul 3, 2025
f9e3ab6
Formatting + switch back to CPU
affifboudaoud Jul 3, 2025
71a9761
Formatting + check for signature if seprate_sdfgs
affifboudaoud Jul 3, 2025
c2751ad
Fix for axes_arr of shape 1 + Formatting
affifboudaoud Jul 3, 2025
1c6cf08
Multiple fixes to tests + Added main calls for debugging
affifboudaoud Jul 3, 2025
da7fe58
Make compatible with latest onnxruntime
and-ivanov Jul 7, 2025
ba9600c
Initialize unused arguments + Formatting
affifboudaoud Jul 8, 2025
794cde0
Fix test_input_outputs.py
and-ivanov Jul 8, 2025
9d49d6d
fix expansions
and-ivanov Jul 8, 2025
e3e8b03
fix test_bert.py: express softmax expansion in terms of simpler onnx …
and-ivanov Jul 9, 2025
7b104f3
resolve onnx/onnxruntime versioning issues
and-ivanov Jul 11, 2025
30e8394
Cleanup onnxruntime use
and-ivanov Jul 14, 2025
0998b0b
fix test_shared_input_output.py
and-ivanov Jul 14, 2025
59dc707
Fix expansions for Add,Sub,Mul,Div
and-ivanov Jul 15, 2025
0e2e7d3
fix test_conv2d.py
and-ivanov Jul 15, 2025
afa8256
Changed test dtype to float64
affifboudaoud Jul 15, 2025
bebe5de
Fixed tensors_close print order
affifboudaoud Jul 15, 2025
e09cd82
Fix AccessSets analysis api call
affifboudaoud Jul 15, 2025
6078c77
Formatting with yapf
affifboudaoud Jul 15, 2025
0f5861a
Fix BackwardPass node creation and validation
affifboudaoud Jul 15, 2025
3056c71
Remove FuncitonCallRegions before AD and initialize containers to zero
affifboudaoud Jul 15, 2025
361746b
Fix batchnorm implementation
and-ivanov Jul 16, 2025
70dc170
Express GlobalAveragePool through ReduceMean
and-ivanov Jul 16, 2025
4c39da5
Iterate over state views not loop state views
affifboudaoud Jul 16, 2025
0d5d613
Merge branch 'update_efforts' of https://github.com/affifboudaoud/dac…
affifboudaoud Jul 16, 2025
5193e4f
Refactor ReduceMax,Min,Sum,Mean and fix ambiguity in passing scalars …
and-ivanov Jul 16, 2025
dd580c1
Add Llama Decoder inference test
affifboudaoud Jul 17, 2025
dd6a534
Add LlamaForCausalLM test
affifboudaoud Jul 17, 2025
9e79460
Fix inf initialization + increase size limit for arrays
affifboudaoud Jul 17, 2025
1a25959
Add new tensorproto format
affifboudaoud Jul 31, 2025
4f3a5c1
Add new pure implementations + formatting
affifboudaoud Jul 31, 2025
39f6899
Fix initialization for constant arrays that need to be forwarded to t…
affifboudaoud Jul 31, 2025
21f1c12
Fix initialize_outputs_code call
affifboudaoud Aug 1, 2025
2d85ec9
Added wcr sum to einsum backward output and fixed einsum expansion in…
affifboudaoud Aug 6, 2025
9a75a94
Remove debug code
affifboudaoud Aug 6, 2025
630771d
Add Llama decoder backward test
affifboudaoud Aug 6, 2025
4edeaaa
Additional fixes to inf initializations
affifboudaoud Aug 6, 2025
5a3e5a8
Add support for indirection
affifboudaoud Aug 6, 2025
2f01229
Add initialization for integer tensors
affifboudaoud Aug 7, 2025
0eff710
Remove constant inputs when constructing ONNX op replacements
affifboudaoud Aug 7, 2025
511d9cd
Avoid gradient tracking for ONNX op attributes
affifboudaoud Aug 7, 2025
2488b01
Fix ReduceSum backward implementation
affifboudaoud Aug 7, 2025
4cbac69
Remove debug code
affifboudaoud Aug 7, 2025
33e7e88
Enable ONNX simplify by default
affifboudaoud Aug 7, 2025
447d6ba
Fix ReduceMax backward implementation
affifboudaoud Aug 8, 2025
461a674
Add register storage ONNX codegen
affifboudaoud Aug 8, 2025
741b0b1
Fix ReduceMean reduction conditions
affifboudaoud Aug 8, 2025
1e8a1ca
Remove unnecessary wcr sum check
affifboudaoud Aug 8, 2025
92357d2
Add pure BatchNorm implementation
affifboudaoud Aug 8, 2025
573d753
Remove size limit for arrays
affifboudaoud Aug 8, 2025
c0ff565
Add ninja dependency and limit ONNX to 1.17
affifboudaoud Aug 8, 2025
7f678ab
Add specific SDFG names to avoid folder mismatch with pytest
affifboudaoud Aug 8, 2025
ecced32
Avoid simplifying models for now
affifboudaoud Aug 8, 2025
a580723
Remove unused imports
affifboudaoud Aug 8, 2025
5c068c8
Fix Einsum expansion to avoid duplicate descriptors
affifboudaoud Aug 8, 2025
89846a3
Fix LayerNormalization backward implmenetation
affifboudaoud Aug 12, 2025
c69426a
Add full Llama backward test
affifboudaoud Aug 12, 2025
452e446
Add pure ReduceSum implementation + Extend ReduceMean
affifboudaoud Aug 12, 2025
a71d04e
Fix LayerNormalization reduction axes
affifboudaoud Aug 12, 2025
243b6d7
Remove obsolete tests and transformations
affifboudaoud Aug 14, 2025
2200199
Update ORT C API and raw bindings
affifboudaoud Aug 14, 2025
4215071
Set constant attributes for ONNX nodes
affifboudaoud Aug 14, 2025
9d7dbe9
Improve tests by verifying all gradients + increase batch size
affifboudaoud Aug 15, 2025
f2143b8
Multiple fixes to reduction axes in pure expansions
affifboudaoud Aug 15, 2025
965b327
Attempting to fix ORT C API
affifboudaoud Aug 15, 2025
aae9d13
Remove unnecessary views + obsolete GPU schedule code
affifboudaoud Aug 20, 2025
c977bce
Remove CPP implementations and improve softmax
affifboudaoud Aug 20, 2025
ac72044
Remove old Pow implementation
affifboudaoud Aug 21, 2025
314402c
Fix forwarded value non-zero initialization
affifboudaoud Aug 21, 2025
217fcfa
Remove debug SDFG save
affifboudaoud Aug 22, 2025
86147c4
Add zero initializations
affifboudaoud Aug 22, 2025
9f09de1
Add CopyToMap for GPU pass
affifboudaoud Aug 22, 2025
ea3c0b7
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Aug 22, 2025
d2ad6b9
Merge lefover
affifboudaoud Aug 22, 2025
f04c534
Adapt to new API from merge
affifboudaoud Aug 22, 2025
cbdcc3d
Removed seprate dir for NPBench AD and added AD test prototype to k2mm
affifboudaoud Sep 10, 2025
78fe0e5
Added AD NPBench tests
affifboudaoud Sep 11, 2025
bc52b50
Add expand operator and default value for steps in Slice
affifboudaoud Sep 11, 2025
4b10931
Add all AD NPBench tests
affifboudaoud Sep 24, 2025
5898e30
Fix gradient clearing
affifboudaoud Sep 24, 2025
4137b5d
Formatting
affifboudaoud Sep 24, 2025
052d82b
Remove obsolete tests
affifboudaoud Sep 27, 2025
8fef9c6
Minor changes to tests + Formatting
affifboudaoud Sep 27, 2025
c02a43d
Formatting
affifboudaoud Sep 27, 2025
0ee5b94
Avoid DDE in constant folding + Formatting
affifboudaoud Sep 27, 2025
8045b02
Fix boolean tensor initialization
affifboudaoud Sep 27, 2025
2ccb46d
Add Dropout forward impl + Formatting
affifboudaoud Sep 27, 2025
40daa99
Fixes to BatchNorm + Formatting
affifboudaoud Sep 27, 2025
8dd6764
Disable auto-opt by default
affifboudaoud Sep 27, 2025
6bd42af
Add hooks before function init
affifboudaoud Sep 27, 2025
e2701ad
Formatting
affifboudaoud Sep 27, 2025
84f46e0
Formatting
affifboudaoud Sep 27, 2025
31ee8cb
Check for FunctionCallRegion in autodiff analysis
affifboudaoud Sep 27, 2025
a55aa67
Gradient clearing for single value arrays + Isolated node removal
affifboudaoud Sep 27, 2025
7974ac2
Fix codegen for Indices subsets
affifboudaoud Sep 27, 2025
1ebd677
Set transformers version to 4.5
affifboudaoud Sep 27, 2025
daa3a74
Remove GPU test for now
affifboudaoud Sep 27, 2025
30078b5
Remove GPU tests for now
affifboudaoud Sep 27, 2025
614fc0b
Remove unnecessary fixtures and remaining GPU tests
affifboudaoud Sep 28, 2025
2b492bf
Restructure tests and add onnx marker
affifboudaoud Sep 28, 2025
085d4d4
Update pytest marker
affifboudaoud Sep 28, 2025
725e8d6
Remove AD auto-opt until transformed into passes
affifboudaoud Sep 28, 2025
b80d2b4
Remove ONNXRuntime dependency
affifboudaoud Sep 28, 2025
3e87eb9
Remove AD auto-opt
affifboudaoud Sep 29, 2025
7f4a561
[Restructuring] Moved functions to utils and removed experimental dyn…
affifboudaoud Sep 29, 2025
acf0def
Seprate SDFG element reversal from generator
affifboudaoud Sep 29, 2025
2973c30
Separate more functions to utils and dace_nodes
affifboudaoud Sep 29, 2025
703b1f3
[Restructuring] Moved storing and recomputation strategies into own dir
affifboudaoud Sep 29, 2025
faa472e
Fix typo
affifboudaoud Sep 29, 2025
84dd7fc
Improve documentation
affifboudaoud Sep 29, 2025
afe1ecc
Remove unnecessary ONNXRuntime backend
affifboudaoud Sep 30, 2025
a8f411a
Remove onnx reporter
affifboudaoud Sep 30, 2025
e4ef648
Remove unnecessary testing dir
affifboudaoud Sep 30, 2025
365ff71
Add design documents for each module
affifboudaoud Sep 30, 2025
40c323d
Improve tests error messages and formatting
affifboudaoud Sep 30, 2025
f11ec23
Better documentation
affifboudaoud Sep 30, 2025
fcc14a5
Fix assertion in dlpack test
affifboudaoud Sep 30, 2025
f22dc61
Add comments
affifboudaoud Sep 30, 2025
1b8546a
Make sure to compare to dace gradients when testing
affifboudaoud Sep 30, 2025
595c755
Remove OpenBLAS dependency
affifboudaoud Oct 1, 2025
d65ff92
Add midding test packages
affifboudaoud Oct 1, 2025
e4eb08c
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Oct 1, 2025
8975401
Add missing package + Formatting
affifboudaoud Oct 1, 2025
6168e9f
Allow Python 3.13 and ONNX 1.18
affifboudaoud Oct 1, 2025
1fd631f
Set onnx IR version explicitly
affifboudaoud Oct 1, 2025
073292a
Pre-commit formatting
affifboudaoud Oct 1, 2025
fdc0e3f
Serialization fixes
affifboudaoud Oct 1, 2025
4d0792b
Fix paths for cpp extensions
affifboudaoud Oct 1, 2025
877833a
Unique auto_opt name and expansion edge case
affifboudaoud Oct 2, 2025
4a69aa9
Skip some AD tests until serialization issue is fixed
affifboudaoud Oct 2, 2025
2b5d29a
Revert to main code
affifboudaoud Oct 2, 2025
57168e0
Remove conda specific import
affifboudaoud Oct 2, 2025
37030b1
Use expanded sdfgs instead of function call
affifboudaoud Oct 2, 2025
f096ad0
Make Torch and ONNX dependencies optional
affifboudaoud Oct 2, 2025
747e1e5
Update CI installation
affifboudaoud Oct 2, 2025
1bd2154
Update all CI installations
affifboudaoud Oct 2, 2025
8b73bf5
Avoid conflicting names got batch size in MKL implementation
affifboudaoud Oct 3, 2025
fafc460
Build Torch module in unique dir to avoid baton issues
affifboudaoud Oct 3, 2025
2aa4e3a
Attempting to reduce CI runtime with smaller sizes
affifboudaoud Oct 3, 2025
d2d31b9
Simplify durbin test
affifboudaoud Oct 3, 2025
f4b2c7c
Simplify resent
affifboudaoud Oct 3, 2025
1dc4d8b
Even smaller sizes for cavity_flow
affifboudaoud Oct 3, 2025
ad34aba
Avoid data race in loop lifiting test
affifboudaoud Oct 3, 2025
f07a6e6
Formatting
affifboudaoud Oct 3, 2025
477738b
Set JAX version to avoid conflict with cupy
affifboudaoud Oct 3, 2025
dec4703
set JAX to <= 0.6.2
affifboudaoud Oct 3, 2025
341d3b3
Smaller inputs for Cholesky
affifboudaoud Oct 3, 2025
21a2538
Make ReplacementTransformation abstract to pass coverage tests
affifboudaoud Oct 3, 2025
c998f1e
Remove redundant ReverseReduceMax class
affifboudaoud Oct 7, 2025
adb8873
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Oct 13, 2025
7db9d1c
Remove redundant reduction code
affifboudaoud Oct 13, 2025
af5b3aa
Remove duplicate code and TODOs
affifboudaoud Oct 13, 2025
613f940
Add copyright headers
affifboudaoud Oct 14, 2025
141dee7
Revert SDFG validation changes
affifboudaoud Oct 14, 2025
8dcb470
Enable make_transients_persistent in auto_opt
affifboudaoud Oct 14, 2025
1195dfc
Revert DDE changes
affifboudaoud Oct 14, 2025
5c1c342
Remove comment
affifboudaoud Oct 14, 2025
a958728
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Oct 14, 2025
8dc611e
Remove unused global variable
affifboudaoud Oct 14, 2025
eb6b06e
Allow MKL in ONNX auto opt
affifboudaoud Oct 14, 2025
fa012d7
Improve documentation
affifboudaoud Oct 14, 2025
be1de1a
Improve error message
affifboudaoud Oct 14, 2025
c5f7b23
Merge remote-tracking branch 'origin/dace_ad' into dace_ad
affifboudaoud Oct 14, 2025
5c5a3ef
Add non-pytest test calls in main
affifboudaoud Oct 14, 2025
dd247c8
Categorized ONNX pure implementations
affifboudaoud Oct 15, 2025
838ac7b
Fix race condition view storing and add imports
affifboudaoud Oct 15, 2025
0515a64
Add autodiff test call to main for debugging
affifboudaoud Oct 15, 2025
df0091b
Replace ONNXRuntime shape inference with ONNX shape inference
affifboudaoud Oct 20, 2025
6598235
Merge branch 'main' into dace_ad
affifboudaoud Oct 20, 2025
52439bb
Add onnxscript dependency
affifboudaoud Oct 20, 2025
cfc5cbc
Merge remote-tracking branch 'origin/dace_ad' into dace_ad
affifboudaoud Oct 20, 2025
b592bae
Use ONNXRuntime shape inference from package and keep ONNX as fallback
affifboudaoud Oct 20, 2025
cd99538
Disable Dynamo which is default in torch > 2.9
affifboudaoud Oct 20, 2025
9515d57
Remove ONNXruntime tools fallback
affifboudaoud Oct 20, 2025
b56a90a
Check the shape inference output for incomplete processing
affifboudaoud Oct 20, 2025
48a4005
Update dace/autodiff/autodiff.md
affifboudaoud Oct 29, 2025
a4376b5
Update dace/autodiff/autodiff.md
affifboudaoud Oct 29, 2025
a65e45a
Update dace/autodiff/backward_pass_generator.py
affifboudaoud Oct 29, 2025
3206f16
Fix typo
affifboudaoud Oct 29, 2025
93b7596
Merge branch 'dace_ad' of https://github.com/spcl/dace into dace_ad
affifboudaoud Oct 29, 2025
2013cb8
Fix stringdoc
affifboudaoud Oct 29, 2025
7ac0eb1
Add loss function to the autodiff example
affifboudaoud Oct 29, 2025
d5a1680
Use SDFG API to generate new names and symbols
affifboudaoud Oct 30, 2025
d558984
Fix static dtype in backward implementations
affifboudaoud Oct 30, 2025
da03c60
Use dace pi instead of hardcoded constant
affifboudaoud Oct 30, 2025
bacf827
Use sympy instead of regex matching
affifboudaoud Oct 30, 2025
c03be81
Use mapped tasklet API instead of building store maps manually
affifboudaoud Oct 30, 2025
be79d6e
Use symbolic affine expression matching for loop iterators and fix fi…
affifboudaoud Oct 30, 2025
350b3ae
Add copyright header for test files
affifboudaoud Oct 30, 2025
567cd7c
Remove dead code function and fix isinstance checks
affifboudaoud Oct 30, 2025
d7e981c
Fix is_previously_written analysis and decrease lu test size
affifboudaoud Oct 30, 2025
6449e2b
Fix np.has_path use
affifboudaoud Oct 30, 2025
ca39caa
[Restructuring] Move ML frontends to dace.frontend.ml and enable impo…
affifboudaoud Nov 4, 2025
9ba1608
Added lazy import for torch components and enabled new decorator @dac…
affifboudaoud Nov 5, 2025
9006e42
Remove unnecessary data files and add .onnx .bin files to .gitignore
affifboudaoud Nov 5, 2025
35b8a71
Remove single state requirement from SDFGBackwardRunner
affifboudaoud Nov 5, 2025
d624623
Remove unconditonals (1) from backward InterStateEdges
affifboudaoud Nov 5, 2025
60e14b7
Add multi-state autodiff unit tests
affifboudaoud Nov 5, 2025
5d994a9
Disable serialization for a few tests instead of completely skipping …
affifboudaoud Nov 5, 2025
3a5ec29
Register ONNX expansion class for serialization
affifboudaoud Nov 5, 2025
0e4f25a
Run ML tests as a seprate Action in CI
affifboudaoud Nov 12, 2025
9225664
Add xdist_group for large models to avoid crashing in CI
affifboudaoud Nov 12, 2025
26cffb5
Fix xdist marker
affifboudaoud Nov 12, 2025
a3a8856
Run CI ML tests sequentially and only with Python 3.13
affifboudaoud Nov 12, 2025
f074009
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Nov 13, 2025
30b5b04
Remove unnecessary install of ml deps in hardware CI
affifboudaoud Nov 25, 2025
7a8bf79
Remove unnecessary install of ml deps in heterogeneous CI
affifboudaoud Nov 25, 2025
c1124de
Merge branch 'dace_ad' of https://github.com/spcl/dace into dace_ad
affifboudaoud Nov 25, 2025
d975c87
Update dace/autodiff/data_forwarding/recompute.py
affifboudaoud Nov 25, 2025
8ead6ba
Remove ONNX op files and build models at runtime
affifboudaoud Nov 25, 2025
4b0e88e
Fixes to recomputation + Add dill dependency back
affifboudaoud Nov 25, 2025
45bdcf8
Separate testing and ml-testing extra_requires
affifboudaoud Nov 25, 2025
388131c
Merge remote-tracking branch 'origin/main' into dace_ad
affifboudaoud Nov 25, 2025
1e913c2
Add importorskip for ml only deps + remove redundant forward tests
affifboudaoud Nov 25, 2025
8b031b2
Add tests/data to gitignore
affifboudaoud Nov 25, 2025
535b54b
Improve doc strings and remove unnecessary installs from ml-ci
affifboudaoud Nov 25, 2025
385d2a0
Improve docstrings + avoid asserting function calls + better Symbol h…
affifboudaoud Nov 25, 2025
a7968e7
Multiple CI adaptions + set networkx to 3.5 for now
affifboudaoud Nov 26, 2025
9903346
Remove reduction code duplication + hardcoded datatypes
affifboudaoud Nov 26, 2025
743f4af
rename torch dir to avoid pytest conflict
affifboudaoud Nov 26, 2025
6f5b497
Replace find_str_not_in_set + Simplify ParameterArray creation
affifboudaoud Nov 26, 2025
90c77e2
Removed dace/util
affifboudaoud Nov 27, 2025
a0b2bc0
Use debugprint + Simpler python_pure_op implementations
affifboudaoud Nov 27, 2025
988ae5b
Remove TF imports + Add create_child_generator
affifboudaoud Nov 27, 2025
e3f544d
Update dace/autodiff/data_forwarding/store.py
affifboudaoud Nov 27, 2025
516e8bb
Update dace/autodiff/data_forwarding/store.py
affifboudaoud Nov 27, 2025
63c5292
Typo fixes. Co-Authored-By: Tal Ben-Nun
affifboudaoud Nov 27, 2025
d125416
Fix layernorm type issue
affifboudaoud Nov 27, 2025
1aa572a
Fix extremal reduction backward implementation and add unit tests
affifboudaoud Dec 2, 2025
6f2e7b7
Remove sdfg_name conftest fixture and add unique name to tests
affifboudaoud Dec 2, 2025
b31646d
Fix onnx proto conversion in onnx-1.20
affifboudaoud Dec 2, 2025
141de99
Increase reduction tolerance
affifboudaoud Dec 2, 2025
1196889
Update MD files
affifboudaoud Dec 2, 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
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:

- name: Install DaCe in development mode
run: |
python -m pip install --editable ".[testing,linting]"
python -m pip install --editable ".[testing,linting,ml]"
pre-commit install
pre-commit run
2 changes: 1 addition & 1 deletion .github/workflows/fpga-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python -m pip install --upgrade pip
pip install pytest-xdist flake8 coverage click
pip uninstall -y dace
pip install -e ".[testing]"
pip install -e ".[testing,ml]"
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/general-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
else
export DACE_optimizer_automatic_simplification=${{ matrix.simplify }}
fi
pytest -n auto --cov-report=xml --cov=dace --tb=short --timeout_method thread --timeout=300 -m "not gpu and not verilator and not tensorflow and not mkl and not sve and not papi and not mlir and not lapack and not fpga and not mpi and not rtl_hardware and not scalapack and not datainstrument and not long and not sequential"
pytest -n auto --cov-report=xml --cov=dace --tb=short --timeout_method thread --timeout=300 -m "not gpu and not autodiff and not torch and not onnx and not verilator and not tensorflow and not mkl and not sve and not papi and not mlir and not lapack and not fpga and not mpi and not rtl_hardware and not scalapack and not datainstrument and not long and not sequential"
./codecov

- name: Test OpenBLAS LAPACK
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gpu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
pip install mpi4py
pip install cupy
pip uninstall -y dace
pip install -e ".[testing]"
pip install -e ".[testing,ml]"
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov

Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/ml-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Machine Learning and Autodiff Tests

on:
push:
branches: [ main, ci-fix ]
pull_request:
branches: [ main, ci-fix ]
merge_group:
branches: [ main, ci-fix ]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
test:
if: "!contains(github.event.pull_request.labels.*.name, 'no-ci')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.13']
simplify: [0,1,autoopt]

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libyaml-dev cmake
sudo apt-get install -y libblas-dev libopenblas-dev liblapacke-dev
python -m pip install --upgrade pip
pip install flake8 pytest-xdist coverage
pip install -e ".[ml-testing,ml]"
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov

- name: Test with pytest
run: |
export NOSTATUSBAR=1
export DACE_testing_serialization=1
export DACE_testing_deserialize_exception=1
export DACE_cache=unique
if [ "${{ matrix.simplify }}" = "autoopt" ]; then
export DACE_optimizer_automatic_simplification=1
export DACE_optimizer_autooptimize=1
echo "Auto-optimization heuristics"
else
export DACE_optimizer_automatic_simplification=${{ matrix.simplify }}
fi
pytest --cov-report=xml --cov=dace --tb=short --timeout_method thread --timeout=300 -v -m "(torch or onnx or autodiff) and not gpu"
./codecov

- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,8 @@ _build/

# Ignoring the test junk
_all_tests/


# Ignore downloaded ONNX models
/*.onnx
/*.bin
11 changes: 11 additions & 0 deletions dace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
sys.path.insert(0, __external_transformations_path__)


# Lazy loading for ml module to avoid eager TensorFlow/PyTorch imports
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very nonstandard piece of code. Do we need it? If nobody imports dace.ml then the time will not be spent AFAIU.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added so that we can do:

import dace
@dace.ml.module()
class TorchModule(nn.Module):

Without always importing the ml modules to save on import time. We can remove this code and note that a user needs to import dace.ml to be able to use the decorator.
@

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that requiring to import dace.ml is very reasonable and what most python packages do.

def __getattr__(name):
if name == 'ml':
import importlib
ml_module = importlib.import_module('.ml', package='dace')
# Cache the module to avoid re-importing
globals()['ml'] = ml_module
return ml_module
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")


# Hack that enables using @dace as a decorator
# See https://stackoverflow.com/a/48100440/6489142
class DaceModule(sys.modules[__name__].__class__):
Expand Down
58 changes: 58 additions & 0 deletions dace/autodiff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2019-2025 ETH Zurich and the DaCe authors. All rights reserved.
"""
DaCe Automatic Differentiation (AD) System.

This module provides reverse-mode automatic differentiation for DaCe programs,
enabling automatic computation of gradients for optimized numerical kernels.

Main Components
---------------
- **add_backward_pass**: Main entry point for adding backward pass to an SDFG
- **BackwardPassGenerator**: Core algorithm for generating backward passes
- **BackwardImplementation**: ABC for implementing operation-specific backward rules
- **BackwardContext**: Context information for backward pass generation
- **BackwardResult**: Result of backward pass generation with forward/backward SDFGs
- **AutoDiffException**: Base exception for autodiff errors

Key Features
------------
- Support for control flow (loops, conditionals)
- Data forwarding strategies (store vs recompute tradeoffs)
- Extensible backward implementations for library nodes
- Integration with PyTorch autograd
- Automatic memory management for intermediate values


"""

from .base_abc import BackwardImplementation, BackwardContext, BackwardResult, AutoDiffException
from .backward_pass_generator import BackwardPassGenerator
from .autodiff import add_backward_pass

try:
from .torch import make_backward_function
TORCH_INTEGRATION_AVAILABLE = True
except ImportError:
make_backward_function = None
TORCH_INTEGRATION_AVAILABLE = False

import sys
from . import library

__all__ = [
# Main API
"add_backward_pass",
# Core classes
"BackwardPassGenerator",
"BackwardContext",
"BackwardResult",
# Extension points
"BackwardImplementation",
# Exceptions
"AutoDiffException",
# Submodules
"library",
]

if TORCH_INTEGRATION_AVAILABLE:
__all__.append("make_backward_function")
103 changes: 103 additions & 0 deletions dace/autodiff/analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Copyright 2019-2025 ETH Zurich and the DaCe authors. All rights reserved.
"""
Analysis helpers for autodiff
"""
from typing import Dict, Set, Tuple, Optional
import collections

import networkx as nx

from dace.sdfg import SDFG, SDFGState, nodes, utils as sdfg_utils
from dace.transformation.passes import analysis
from dace.sdfg.state import FunctionCallRegion

AccessSets = Dict[SDFGState, Tuple[Set[str], Set[str]]]


def dependency_analysis(sdfg: SDFG) -> Dict[str, Set[str]]:
"""
Analyze read dependencies of arrays in the SDFG.

:param sdfg: SDFG to analyze
:return: A dictionary mapping array names to a list of read dependencies.
"""

# FIXME can be made more efficient
dependencies = nx.DiGraph()
for sdfg_node in sdfg.nodes():
if isinstance(sdfg_node, SDFGState):
for node in sdfg_node.data_nodes():
for edge in sdfg_node.edge_bfs(node, reverse=True):
dependencies.add_edge(node.data, edge.data.data)
elif isinstance(sdfg_node, FunctionCallRegion):
for state in sdfg_node.nodes():
assert isinstance(state, SDFGState)
for node in state.data_nodes():
for edge in state.edge_bfs(node, reverse=True):
dependencies.add_edge(node.data, edge.data.data)

dependencies = nx.transitive_closure(dependencies)
result = {}
for array in dependencies:
result[array] = {nbr for nbr in dependencies.neighbors(array)}
return result


def inverse_reachability(sdfg: SDFG) -> Dict[SDFGState, Set[SDFGState]]:

reachability = analysis.StateReachability().apply_pass(sdfg, {})
inverse_reachability = collections.defaultdict(set)
# iterate over cfg_ids
for cfg_id in reachability.keys():
for pred, successors in reachability[cfg_id].items():
for successor in successors:
inverse_reachability[successor].add(pred)

return inverse_reachability


def is_previously_written(sdfg: SDFG,
state: SDFGState,
node: nodes.Node,
array_name: str,
access_sets: Optional[AccessSets] = None) -> bool:
"""
Determine whether the given array name was written before the current node.

:param sdfg: the sdfg containing the node
:param state: the state containing the node
:param node: the node to check
:param array_name: the array name to check
:return: True if the array was written before the node, False otherwise.
"""

if access_sets is None:
access_sets = analysis.AccessSets().apply_pass(sdfg, {})

reachable = inverse_reachability(sdfg)

# Check the current state
for subgraph in sdfg_utils.concurrent_subgraphs(state):
if node in subgraph.nodes():
# Get all the access nodes in the subgraph to the same data
for other_node in subgraph.data_nodes():
if other_node != node and other_node.data == array_name:
# Check if this is a write node
for in_edge in subgraph.in_edges(other_node):
if in_edge.data.data == array_name:
# Check if there's a path to our node,
# since we only care about writes that happen before the current node
if nx.has_path(state.nx, other_node, node):
return True
else:
# This is not our current subgraph, check the write states
_, write_set = subgraph.read_and_write_sets()
if array_name in write_set:
return True

# Check other states
for predecessor in reachable[state]:
_, write_set = access_sets[predecessor]
if array_name in write_set:
return True
return False
Loading