clifft 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clifft-0.1.0/.clang-format +63 -0
- clifft-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +47 -0
- clifft-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
- clifft-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +20 -0
- clifft-0.1.0/.github/actions/build-wasm/action.yml +27 -0
- clifft-0.1.0/.github/workflows/ci.yml +226 -0
- clifft-0.1.0/.github/workflows/coverage.yml +121 -0
- clifft-0.1.0/.github/workflows/docs.yml +64 -0
- clifft-0.1.0/.github/workflows/pr-title.yml +35 -0
- clifft-0.1.0/.github/workflows/pr_preview.yml +115 -0
- clifft-0.1.0/.github/workflows/release.yml +174 -0
- clifft-0.1.0/.github/workflows/tsan.yml +49 -0
- clifft-0.1.0/.gitignore +68 -0
- clifft-0.1.0/.pre-commit-config.yaml +39 -0
- clifft-0.1.0/AGENTS.md +91 -0
- clifft-0.1.0/CHANGELOG.md +22 -0
- clifft-0.1.0/CMakeLists.txt +184 -0
- clifft-0.1.0/CODE_OF_CONDUCT.md +131 -0
- clifft-0.1.0/CONTRIBUTING.md +11 -0
- clifft-0.1.0/LICENSE +191 -0
- clifft-0.1.0/PKG-INFO +79 -0
- clifft-0.1.0/README.md +62 -0
- clifft-0.1.0/cliff.toml +64 -0
- clifft-0.1.0/cmake/ClifftVersion.cmake +55 -0
- clifft-0.1.0/cmake/FetchCatch2.cmake +15 -0
- clifft-0.1.0/cmake/FetchFastFloat.cmake +11 -0
- clifft-0.1.0/cmake/FetchNlohmannJson.cmake +13 -0
- clifft-0.1.0/cmake/FetchStim.cmake +24 -0
- clifft-0.1.0/codecov.yml +18 -0
- clifft-0.1.0/docs/development/building.md +193 -0
- clifft-0.1.0/docs/development/contributing.md +108 -0
- clifft-0.1.0/docs/development/releasing.md +119 -0
- clifft-0.1.0/docs/development/testing.md +74 -0
- clifft-0.1.0/docs/getting-started/installation.md +69 -0
- clifft-0.1.0/docs/getting-started/quickstart.md +94 -0
- clifft-0.1.0/docs/guide/benchmark.md +311 -0
- clifft-0.1.0/docs/guide/circuits/circuit_d3_s_gate_p0.001.stim +197 -0
- clifft-0.1.0/docs/guide/circuits/circuit_d3_t_gate_p0.001.stim +202 -0
- clifft-0.1.0/docs/guide/compiling.md +275 -0
- clifft-0.1.0/docs/guide/images/benchmark_comparison.png +0 -0
- clifft-0.1.0/docs/guide/images/is_error_rate_sweep.png +0 -0
- clifft-0.1.0/docs/guide/images/is_pmf_and_error_rate.png +0 -0
- clifft-0.1.0/docs/guide/images/is_weighted_contributions.png +0 -0
- clifft-0.1.0/docs/guide/images/surface_code_plot.png +0 -0
- clifft-0.1.0/docs/guide/importance-sampling.md +384 -0
- clifft-0.1.0/docs/guide/scripts/benchmark_results.csv +27 -0
- clifft-0.1.0/docs/guide/scripts/importance_sampling_tutorial.py +410 -0
- clifft-0.1.0/docs/guide/scripts/run_benchmark.py +505 -0
- clifft-0.1.0/docs/guide/simulation.md +218 -0
- clifft-0.1.0/docs/guide/surface-code.md +245 -0
- clifft-0.1.0/docs/index.md +68 -0
- clifft-0.1.0/docs/javascripts/katex.js +35 -0
- clifft-0.1.0/docs/macros.py +217 -0
- clifft-0.1.0/docs/opcodes.json +296 -0
- clifft-0.1.0/docs/overrides/main.html +66 -0
- clifft-0.1.0/docs/reference/gates.md +206 -0
- clifft-0.1.0/docs/reference/instructions.md +64 -0
- clifft-0.1.0/docs/reference/passes.md +71 -0
- clifft-0.1.0/docs/theory/architecture.md +94 -0
- clifft-0.1.0/docs/theory/overview.md +96 -0
- clifft-0.1.0/justfile +224 -0
- clifft-0.1.0/mkdocs.yml +86 -0
- clifft-0.1.0/playground/.gitignore +24 -0
- clifft-0.1.0/playground/eslint.config.js +23 -0
- clifft-0.1.0/playground/index.html +15 -0
- clifft-0.1.0/playground/package-lock.json +3841 -0
- clifft-0.1.0/playground/package.json +37 -0
- clifft-0.1.0/playground/src/App.css +873 -0
- clifft-0.1.0/playground/src/App.tsx +663 -0
- clifft-0.1.0/playground/src/components/ExpValTable.tsx +63 -0
- clifft-0.1.0/playground/src/components/GuidedTour.tsx +222 -0
- clifft-0.1.0/playground/src/components/HistogramChart.tsx +125 -0
- clifft-0.1.0/playground/src/components/KHistoryChart.tsx +102 -0
- clifft-0.1.0/playground/src/components/Toolbar.tsx +371 -0
- clifft-0.1.0/playground/src/hooks/useCircuitStorage.ts +70 -0
- clifft-0.1.0/playground/src/hooks/useClifftWasm.ts +124 -0
- clifft-0.1.0/playground/src/hooks/useTheme.ts +85 -0
- clifft-0.1.0/playground/src/languages.ts +220 -0
- clifft-0.1.0/playground/src/main.tsx +10 -0
- clifft-0.1.0/playground/src/types.ts +59 -0
- clifft-0.1.0/playground/tsconfig.app.json +32 -0
- clifft-0.1.0/playground/tsconfig.json +7 -0
- clifft-0.1.0/playground/tsconfig.node.json +26 -0
- clifft-0.1.0/playground/vite.config.ts +17 -0
- clifft-0.1.0/pyproject.toml +127 -0
- clifft-0.1.0/src/clifft/CMakeLists.txt +89 -0
- clifft-0.1.0/src/clifft/backend/backend.cc +850 -0
- clifft-0.1.0/src/clifft/backend/backend.h +333 -0
- clifft-0.1.0/src/clifft/backend/compiler_context.h +340 -0
- clifft-0.1.0/src/clifft/backend/reference_syndrome.cc +32 -0
- clifft-0.1.0/src/clifft/backend/reference_syndrome.h +21 -0
- clifft-0.1.0/src/clifft/backend/source_map.h +100 -0
- clifft-0.1.0/src/clifft/circuit/circuit.h +65 -0
- clifft-0.1.0/src/clifft/circuit/gate_data.h +310 -0
- clifft-0.1.0/src/clifft/circuit/parser.cc +1104 -0
- clifft-0.1.0/src/clifft/circuit/parser.h +62 -0
- clifft-0.1.0/src/clifft/circuit/target.h +103 -0
- clifft-0.1.0/src/clifft/frontend/frontend.cc +847 -0
- clifft-0.1.0/src/clifft/frontend/frontend.h +34 -0
- clifft-0.1.0/src/clifft/frontend/hir.h +454 -0
- clifft-0.1.0/src/clifft/optimizer/bytecode_pass.cc +15 -0
- clifft-0.1.0/src/clifft/optimizer/bytecode_pass.h +40 -0
- clifft-0.1.0/src/clifft/optimizer/commutation.cc +133 -0
- clifft-0.1.0/src/clifft/optimizer/commutation.h +18 -0
- clifft-0.1.0/src/clifft/optimizer/expand_t_pass.cc +87 -0
- clifft-0.1.0/src/clifft/optimizer/expand_t_pass.h +27 -0
- clifft-0.1.0/src/clifft/optimizer/hir_pass.h +18 -0
- clifft-0.1.0/src/clifft/optimizer/hir_pass_manager.cc +15 -0
- clifft-0.1.0/src/clifft/optimizer/hir_pass_manager.h +29 -0
- clifft-0.1.0/src/clifft/optimizer/multi_gate_pass.cc +86 -0
- clifft-0.1.0/src/clifft/optimizer/multi_gate_pass.h +21 -0
- clifft-0.1.0/src/clifft/optimizer/noise_block_pass.cc +51 -0
- clifft-0.1.0/src/clifft/optimizer/noise_block_pass.h +20 -0
- clifft-0.1.0/src/clifft/optimizer/pass_factory.cc +66 -0
- clifft-0.1.0/src/clifft/optimizer/pass_factory.h +29 -0
- clifft-0.1.0/src/clifft/optimizer/pass_registry.h +95 -0
- clifft-0.1.0/src/clifft/optimizer/peephole.cc +463 -0
- clifft-0.1.0/src/clifft/optimizer/peephole.h +25 -0
- clifft-0.1.0/src/clifft/optimizer/remove_noise_pass.cc +15 -0
- clifft-0.1.0/src/clifft/optimizer/remove_noise_pass.h +19 -0
- clifft-0.1.0/src/clifft/optimizer/single_axis_fusion_pass.cc +235 -0
- clifft-0.1.0/src/clifft/optimizer/single_axis_fusion_pass.h +31 -0
- clifft-0.1.0/src/clifft/optimizer/statevector_squeeze_pass.cc +56 -0
- clifft-0.1.0/src/clifft/optimizer/statevector_squeeze_pass.h +19 -0
- clifft-0.1.0/src/clifft/optimizer/swap_meas_pass.cc +43 -0
- clifft-0.1.0/src/clifft/optimizer/swap_meas_pass.h +20 -0
- clifft-0.1.0/src/clifft/optimizer/tile_axis_fusion_pass.cc +464 -0
- clifft-0.1.0/src/clifft/optimizer/tile_axis_fusion_pass.h +34 -0
- clifft-0.1.0/src/clifft/svm/svm.cc +689 -0
- clifft-0.1.0/src/clifft/svm/svm.h +347 -0
- clifft-0.1.0/src/clifft/svm/svm_avx2.cc +17 -0
- clifft-0.1.0/src/clifft/svm/svm_avx512.cc +21 -0
- clifft-0.1.0/src/clifft/svm/svm_internal.h +269 -0
- clifft-0.1.0/src/clifft/svm/svm_kernels.inl +2480 -0
- clifft-0.1.0/src/clifft/svm/svm_math.h +97 -0
- clifft-0.1.0/src/clifft/svm/svm_scalar.cc +11 -0
- clifft-0.1.0/src/clifft/svm/svm_state.cc +239 -0
- clifft-0.1.0/src/clifft/util/bitmask.h +166 -0
- clifft-0.1.0/src/clifft/util/config.h +33 -0
- clifft-0.1.0/src/clifft/util/constants.h +14 -0
- clifft-0.1.0/src/clifft/util/introspection.cc +233 -0
- clifft-0.1.0/src/clifft/util/introspection.h +51 -0
- clifft-0.1.0/src/clifft/util/version.h.in +10 -0
- clifft-0.1.0/src/python/CMakeLists.txt +90 -0
- clifft-0.1.0/src/python/_build_config.py.in +4 -0
- clifft-0.1.0/src/python/bindings.cc +1059 -0
- clifft-0.1.0/src/python/clifft/__init__.py +143 -0
- clifft-0.1.0/src/python/clifft/_build_config.py +8 -0
- clifft-0.1.0/src/python/clifft/_cpu_check.py +38 -0
- clifft-0.1.0/src/python/clifft/_sample_result.py +86 -0
- clifft-0.1.0/src/wasm/CMakeLists.txt +96 -0
- clifft-0.1.0/src/wasm/bindings.cc +255 -0
- clifft-0.1.0/src/wasm/test_wasm.mjs +161 -0
- clifft-0.1.0/tests/CMakeLists.txt +45 -0
- clifft-0.1.0/tests/fixtures/cultivation_d5.stim +494 -0
- clifft-0.1.0/tests/fixtures/qv10.stim +560 -0
- clifft-0.1.0/tests/fixtures/target_qec.stim +193 -0
- clifft-0.1.0/tests/python/conftest.py +127 -0
- clifft-0.1.0/tests/python/test_api.py +177 -0
- clifft-0.1.0/tests/python/test_bytecode_passes.py +217 -0
- clifft-0.1.0/tests/python/test_compile_passes.py +251 -0
- clifft-0.1.0/tests/python/test_exp_value.py +316 -0
- clifft-0.1.0/tests/python/test_importance_sampling.py +302 -0
- clifft-0.1.0/tests/python/test_introspection.py +246 -0
- clifft-0.1.0/tests/python/test_opcode_docs.py +98 -0
- clifft-0.1.0/tests/python/test_openmp.py +37 -0
- clifft-0.1.0/tests/python/test_optimization_invariants.py +354 -0
- clifft-0.1.0/tests/python/test_peephole_oracle.py +503 -0
- clifft-0.1.0/tests/python/test_qiskit_aer.py +336 -0
- clifft-0.1.0/tests/python/test_sample.py +1072 -0
- clifft-0.1.0/tests/python/test_single_axis_fusion.py +180 -0
- clifft-0.1.0/tests/python/test_source_map.py +59 -0
- clifft-0.1.0/tests/python/test_statevector_squeeze.py +483 -0
- clifft-0.1.0/tests/python/test_statistical_equivalence.py +635 -0
- clifft-0.1.0/tests/python/test_structural_oracles.py +334 -0
- clifft-0.1.0/tests/python/test_trajectory_oracle.py +362 -0
- clifft-0.1.0/tests/python/utils_fuzzing.py +307 -0
- clifft-0.1.0/tests/python/utils_qiskit.py +359 -0
- clifft-0.1.0/tests/test_backend.cc +1494 -0
- clifft-0.1.0/tests/test_benchmarks.cc +83 -0
- clifft-0.1.0/tests/test_bitmask.cc +269 -0
- clifft-0.1.0/tests/test_bytecode_passes.cc +750 -0
- clifft-0.1.0/tests/test_exp_value.cc +209 -0
- clifft-0.1.0/tests/test_frontend.cc +1420 -0
- clifft-0.1.0/tests/test_helpers.h +67 -0
- clifft-0.1.0/tests/test_hir.cc +241 -0
- clifft-0.1.0/tests/test_importance_sampling.cc +392 -0
- clifft-0.1.0/tests/test_openmp.cc +144 -0
- clifft-0.1.0/tests/test_optimizer.cc +709 -0
- clifft-0.1.0/tests/test_parser.cc +1600 -0
- clifft-0.1.0/tests/test_single_axis_fusion.cc +403 -0
- clifft-0.1.0/tests/test_source_map.cc +194 -0
- clifft-0.1.0/tests/test_statevector.cc +961 -0
- clifft-0.1.0/tests/test_stim_contract.cc +196 -0
- clifft-0.1.0/tests/test_svm_avx512_axis01.cc +641 -0
- clifft-0.1.0/tests/test_svm_risc.cc +2156 -0
- clifft-0.1.0/tests/test_tile_axis_fusion.cc +646 -0
- clifft-0.1.0/tools/bench/README.md +31 -0
- clifft-0.1.0/tools/bench/fixtures/qv20_seed42.stim +2220 -0
- clifft-0.1.0/tools/bench/test_bench_deep_clifford.py +172 -0
- clifft-0.1.0/tools/bench/test_bench_qec.py +142 -0
- clifft-0.1.0/tools/bench/test_bench_qv.py +55 -0
- clifft-0.1.0/tools/profile/README.md +105 -0
- clifft-0.1.0/tools/profile/profile_svm.cpp +253 -0
- clifft-0.1.0/tools/tsan/suppressions.txt +20 -0
- clifft-0.1.0/uv.lock +1641 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Clifft C++ formatting rules
|
|
2
|
+
# Based on Google style with minor adjustments
|
|
3
|
+
|
|
4
|
+
BasedOnStyle: Google
|
|
5
|
+
ColumnLimit: 100
|
|
6
|
+
|
|
7
|
+
# Indentation
|
|
8
|
+
IndentWidth: 4
|
|
9
|
+
ContinuationIndentWidth: 4
|
|
10
|
+
AccessModifierOffset: -2
|
|
11
|
+
|
|
12
|
+
# Braces
|
|
13
|
+
BreakBeforeBraces: Attach
|
|
14
|
+
AllowShortBlocksOnASingleLine: Empty
|
|
15
|
+
AllowShortFunctionsOnASingleLine: Inline
|
|
16
|
+
AllowShortIfStatementsOnASingleLine: Never
|
|
17
|
+
AllowShortLoopsOnASingleLine: false
|
|
18
|
+
|
|
19
|
+
# Alignment
|
|
20
|
+
AlignAfterOpenBracket: Align
|
|
21
|
+
AlignConsecutiveAssignments: false
|
|
22
|
+
AlignConsecutiveDeclarations: false
|
|
23
|
+
AlignOperands: true
|
|
24
|
+
AlignTrailingComments: true
|
|
25
|
+
|
|
26
|
+
# Includes
|
|
27
|
+
IncludeBlocks: Regroup
|
|
28
|
+
IncludeCategories:
|
|
29
|
+
# Clifft headers first
|
|
30
|
+
- Regex: '^"clifft/'
|
|
31
|
+
Priority: 1
|
|
32
|
+
# Other local headers
|
|
33
|
+
- Regex: '^"'
|
|
34
|
+
Priority: 2
|
|
35
|
+
# Stim headers
|
|
36
|
+
- Regex: '^<stim'
|
|
37
|
+
Priority: 3
|
|
38
|
+
# System/standard headers
|
|
39
|
+
- Regex: '^<'
|
|
40
|
+
Priority: 4
|
|
41
|
+
|
|
42
|
+
# Pointers and references
|
|
43
|
+
PointerAlignment: Left
|
|
44
|
+
ReferenceAlignment: Left
|
|
45
|
+
DerivePointerAlignment: false
|
|
46
|
+
|
|
47
|
+
# Spaces
|
|
48
|
+
SpaceAfterCStyleCast: false
|
|
49
|
+
SpaceAfterTemplateKeyword: true
|
|
50
|
+
SpaceBeforeAssignmentOperators: true
|
|
51
|
+
SpaceBeforeParens: ControlStatements
|
|
52
|
+
SpaceInEmptyParentheses: false
|
|
53
|
+
SpacesInAngles: false
|
|
54
|
+
SpacesInCStyleCastParentheses: false
|
|
55
|
+
SpacesInParentheses: false
|
|
56
|
+
SpacesInSquareBrackets: false
|
|
57
|
+
|
|
58
|
+
# Other
|
|
59
|
+
SortIncludes: true
|
|
60
|
+
ReflowComments: true
|
|
61
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
|
62
|
+
BinPackArguments: true
|
|
63
|
+
BinPackParameters: true
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug in Clifft
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: description
|
|
7
|
+
attributes:
|
|
8
|
+
label: Description
|
|
9
|
+
description: What happened? What did you expect to happen?
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: reproduce
|
|
15
|
+
attributes:
|
|
16
|
+
label: Steps to reproduce
|
|
17
|
+
description: Minimal code or steps to reproduce the issue.
|
|
18
|
+
placeholder: |
|
|
19
|
+
```python
|
|
20
|
+
import clifft
|
|
21
|
+
# ...
|
|
22
|
+
```
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: environment
|
|
28
|
+
attributes:
|
|
29
|
+
label: Environment
|
|
30
|
+
description: |
|
|
31
|
+
- Clifft version (`python -c "import clifft; print(clifft.__version__)"`)
|
|
32
|
+
- OS and architecture
|
|
33
|
+
- Python version
|
|
34
|
+
placeholder: |
|
|
35
|
+
- Clifft: 0.1.0
|
|
36
|
+
- OS: Ubuntu 24.04 x86_64
|
|
37
|
+
- Python: 3.12.3
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
|
40
|
+
|
|
41
|
+
- type: textarea
|
|
42
|
+
id: additional
|
|
43
|
+
attributes:
|
|
44
|
+
label: Additional context
|
|
45
|
+
description: Error messages, logs, or other relevant details.
|
|
46
|
+
validations:
|
|
47
|
+
required: false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or improvement
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: Problem or motivation
|
|
9
|
+
description: What problem does this solve, or what would it enable?
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: proposal
|
|
15
|
+
attributes:
|
|
16
|
+
label: Proposed solution
|
|
17
|
+
description: How should this work? Include API sketches if relevant.
|
|
18
|
+
validations:
|
|
19
|
+
required: false
|
|
20
|
+
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: alternatives
|
|
23
|
+
attributes:
|
|
24
|
+
label: Alternatives considered
|
|
25
|
+
description: Other approaches you've considered and why they don't work.
|
|
26
|
+
validations:
|
|
27
|
+
required: false
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- Brief description of what this PR does and why. -->
|
|
4
|
+
|
|
5
|
+
## Test plan
|
|
6
|
+
|
|
7
|
+
<!-- How was this tested? Check all that apply. -->
|
|
8
|
+
|
|
9
|
+
- [ ] C++ tests pass (`ctest --test-dir build --output-on-failure`)
|
|
10
|
+
- [ ] Python tests pass (`uv run pytest tests/python/ -v`)
|
|
11
|
+
- [ ] Doc examples pass (`uv run pytest --codeblocks docs/ README.md -v`)
|
|
12
|
+
- [ ] Pre-commit checks pass (`uv run pre-commit run --all-files`)
|
|
13
|
+
|
|
14
|
+
## Contributor agreement
|
|
15
|
+
|
|
16
|
+
- [ ] I confirm this contribution is my original work (or I have the right to
|
|
17
|
+
submit it) and I license it under this project's
|
|
18
|
+
[Apache-2.0 license](../LICENSE).
|
|
19
|
+
- [ ] If this contribution was AI-assisted, I have reviewed the generated code
|
|
20
|
+
and included an `Assisted-by:` git trailer in the commit message.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Build Wasm Module
|
|
2
|
+
description: Build Clifft Wasm module via Emscripten with caching
|
|
3
|
+
|
|
4
|
+
runs:
|
|
5
|
+
using: composite
|
|
6
|
+
steps:
|
|
7
|
+
- name: Cache Wasm build
|
|
8
|
+
id: wasm-cache
|
|
9
|
+
uses: actions/cache@v4
|
|
10
|
+
with:
|
|
11
|
+
path: build-wasm
|
|
12
|
+
key: wasm-${{ runner.os }}-${{ hashFiles('src/wasm/**', 'src/clifft/**', 'cmake/**') }}
|
|
13
|
+
|
|
14
|
+
- name: Build Wasm module
|
|
15
|
+
if: steps.wasm-cache.outputs.cache-hit != 'true'
|
|
16
|
+
shell: bash
|
|
17
|
+
run: |
|
|
18
|
+
docker run --rm \
|
|
19
|
+
-u "$(id -u):$(id -g)" \
|
|
20
|
+
-v "${{ github.workspace }}:/src" \
|
|
21
|
+
-w /src \
|
|
22
|
+
emscripten/emsdk:3.1.74 \
|
|
23
|
+
bash -c '
|
|
24
|
+
emcmake cmake -B build-wasm -S src/wasm \
|
|
25
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
26
|
+
-DFETCHCONTENT_QUIET=ON && \
|
|
27
|
+
cmake --build build-wasm -j$(nproc)'
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- 'playground/**'
|
|
10
|
+
- '*.md'
|
|
11
|
+
- '.github/workflows/docs.yml'
|
|
12
|
+
- '.github/workflows/pr_preview.yml'
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
wasm:
|
|
23
|
+
runs-on: ubuntu-24.04
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout code
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: Build Wasm module
|
|
29
|
+
uses: ./.github/actions/build-wasm
|
|
30
|
+
|
|
31
|
+
- name: Run Wasm smoke tests
|
|
32
|
+
run: |
|
|
33
|
+
docker run --rm \
|
|
34
|
+
-u "$(id -u):$(id -g)" \
|
|
35
|
+
-v "${{ github.workspace }}:/src" \
|
|
36
|
+
-w /src \
|
|
37
|
+
emscripten/emsdk:3.1.74 \
|
|
38
|
+
node --experimental-vm-modules src/wasm/test_wasm.mjs
|
|
39
|
+
|
|
40
|
+
lint:
|
|
41
|
+
runs-on: ubuntu-24.04
|
|
42
|
+
steps:
|
|
43
|
+
- name: Checkout code
|
|
44
|
+
uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- name: Setup uv and Python
|
|
47
|
+
uses: astral-sh/setup-uv@v5
|
|
48
|
+
with:
|
|
49
|
+
enable-cache: true
|
|
50
|
+
python-version: "3.12"
|
|
51
|
+
|
|
52
|
+
- name: Cache pre-commit
|
|
53
|
+
uses: actions/cache@v4
|
|
54
|
+
with:
|
|
55
|
+
path: ~/.cache/pre-commit
|
|
56
|
+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
57
|
+
restore-keys: |
|
|
58
|
+
${{ runner.os }}-pre-commit-
|
|
59
|
+
|
|
60
|
+
- name: Run pre-commit
|
|
61
|
+
run: uv tool run pre-commit run --all-files
|
|
62
|
+
|
|
63
|
+
playground-lint:
|
|
64
|
+
runs-on: ubuntu-24.04
|
|
65
|
+
steps:
|
|
66
|
+
- name: Checkout code
|
|
67
|
+
uses: actions/checkout@v4
|
|
68
|
+
|
|
69
|
+
- name: Setup Node.js
|
|
70
|
+
uses: actions/setup-node@v4
|
|
71
|
+
with:
|
|
72
|
+
node-version: 22
|
|
73
|
+
cache: npm
|
|
74
|
+
cache-dependency-path: playground/package-lock.json
|
|
75
|
+
|
|
76
|
+
- name: Install dependencies
|
|
77
|
+
run: cd playground && npm ci
|
|
78
|
+
|
|
79
|
+
- name: TypeScript type check
|
|
80
|
+
run: cd playground && npx tsc -b
|
|
81
|
+
|
|
82
|
+
- name: ESLint
|
|
83
|
+
run: cd playground && npm run lint
|
|
84
|
+
|
|
85
|
+
build-and-test:
|
|
86
|
+
needs: lint
|
|
87
|
+
runs-on: ubuntu-24.04
|
|
88
|
+
env:
|
|
89
|
+
CMAKE_BUILD_TYPE: Debug
|
|
90
|
+
SKBUILD_CMAKE_BUILD_TYPE: Debug
|
|
91
|
+
CMAKE_GENERATOR: Ninja
|
|
92
|
+
CMAKE_C_COMPILER_LAUNCHER: ccache
|
|
93
|
+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
|
94
|
+
steps:
|
|
95
|
+
- name: Checkout code
|
|
96
|
+
uses: actions/checkout@v4
|
|
97
|
+
|
|
98
|
+
- name: Install system dependencies
|
|
99
|
+
run: sudo apt-get update && sudo apt-get install -y ninja-build
|
|
100
|
+
|
|
101
|
+
- name: Setup ccache
|
|
102
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
|
103
|
+
with:
|
|
104
|
+
key: ${{ runner.os }}-ccache-${{ env.CMAKE_BUILD_TYPE }}
|
|
105
|
+
|
|
106
|
+
- name: Setup uv and Python
|
|
107
|
+
uses: astral-sh/setup-uv@v5
|
|
108
|
+
with:
|
|
109
|
+
enable-cache: true
|
|
110
|
+
python-version: "3.12"
|
|
111
|
+
|
|
112
|
+
- name: Configure C++ build
|
|
113
|
+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
|
|
114
|
+
|
|
115
|
+
- name: Build C++
|
|
116
|
+
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --parallel
|
|
117
|
+
|
|
118
|
+
- name: Run C++ tests (default ISA)
|
|
119
|
+
run: |
|
|
120
|
+
ctest --test-dir build \
|
|
121
|
+
--build-config ${{ env.CMAKE_BUILD_TYPE }} \
|
|
122
|
+
--output-on-failure \
|
|
123
|
+
--parallel \
|
|
124
|
+
--timeout 300
|
|
125
|
+
shell: bash
|
|
126
|
+
|
|
127
|
+
- name: Run C++ tests (scalar ISA)
|
|
128
|
+
env:
|
|
129
|
+
CLIFFT_FORCE_ISA: scalar
|
|
130
|
+
run: |
|
|
131
|
+
ctest --test-dir build \
|
|
132
|
+
--build-config ${{ env.CMAKE_BUILD_TYPE }} \
|
|
133
|
+
--output-on-failure \
|
|
134
|
+
--parallel \
|
|
135
|
+
--timeout 300 \
|
|
136
|
+
-E "Bench"
|
|
137
|
+
shell: bash
|
|
138
|
+
|
|
139
|
+
- name: Run C++ tests (avx2 ISA)
|
|
140
|
+
env:
|
|
141
|
+
CLIFFT_FORCE_ISA: avx2
|
|
142
|
+
run: |
|
|
143
|
+
ctest --test-dir build \
|
|
144
|
+
--build-config ${{ env.CMAKE_BUILD_TYPE }} \
|
|
145
|
+
--output-on-failure \
|
|
146
|
+
--parallel \
|
|
147
|
+
--timeout 300 \
|
|
148
|
+
-E "Bench"
|
|
149
|
+
shell: bash
|
|
150
|
+
|
|
151
|
+
- name: Install Python package
|
|
152
|
+
run: uv pip install -e ".[dev]"
|
|
153
|
+
|
|
154
|
+
- name: Run Python tests (default ISA)
|
|
155
|
+
run: uv run pytest tests/python/ -v
|
|
156
|
+
|
|
157
|
+
- name: Run Python tests (scalar ISA)
|
|
158
|
+
env:
|
|
159
|
+
CLIFFT_FORCE_ISA: scalar
|
|
160
|
+
run: uv run pytest tests/python/ -v
|
|
161
|
+
|
|
162
|
+
- name: Test documentation code examples
|
|
163
|
+
run: uv run pytest --codeblocks docs/ README.md -v
|
|
164
|
+
|
|
165
|
+
cross-platform:
|
|
166
|
+
if: github.event_name == 'push'
|
|
167
|
+
needs: lint
|
|
168
|
+
strategy:
|
|
169
|
+
fail-fast: false
|
|
170
|
+
matrix:
|
|
171
|
+
include:
|
|
172
|
+
- os: macos-latest
|
|
173
|
+
install-deps: brew install ninja libomp
|
|
174
|
+
- os: windows-latest
|
|
175
|
+
install-deps: ""
|
|
176
|
+
runs-on: ${{ matrix.os }}
|
|
177
|
+
env:
|
|
178
|
+
CMAKE_BUILD_TYPE: Debug
|
|
179
|
+
SKBUILD_CMAKE_BUILD_TYPE: Debug
|
|
180
|
+
CMAKE_GENERATOR: Ninja
|
|
181
|
+
CMAKE_C_COMPILER_LAUNCHER: ccache
|
|
182
|
+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
|
183
|
+
steps:
|
|
184
|
+
- name: Checkout code
|
|
185
|
+
uses: actions/checkout@v4
|
|
186
|
+
|
|
187
|
+
- name: Install system dependencies
|
|
188
|
+
if: matrix.install-deps != ''
|
|
189
|
+
run: ${{ matrix.install-deps }}
|
|
190
|
+
|
|
191
|
+
- name: Setup ccache
|
|
192
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
|
193
|
+
with:
|
|
194
|
+
key: ${{ runner.os }}-ccache-${{ env.CMAKE_BUILD_TYPE }}
|
|
195
|
+
|
|
196
|
+
- name: Setup uv and Python
|
|
197
|
+
uses: astral-sh/setup-uv@v5
|
|
198
|
+
with:
|
|
199
|
+
enable-cache: true
|
|
200
|
+
python-version: "3.12"
|
|
201
|
+
|
|
202
|
+
- name: Setup MSVC dev environment
|
|
203
|
+
if: runner.os == 'Windows'
|
|
204
|
+
uses: ilammy/msvc-dev-cmd@v1
|
|
205
|
+
|
|
206
|
+
- name: Configure C++ build
|
|
207
|
+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
|
|
208
|
+
|
|
209
|
+
- name: Build C++
|
|
210
|
+
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --parallel
|
|
211
|
+
|
|
212
|
+
- name: Run C++ tests (skip benchmarks on cross-platform)
|
|
213
|
+
run: |
|
|
214
|
+
ctest --test-dir build \
|
|
215
|
+
--build-config ${{ env.CMAKE_BUILD_TYPE }} \
|
|
216
|
+
--output-on-failure \
|
|
217
|
+
--parallel \
|
|
218
|
+
--timeout 300 \
|
|
219
|
+
-E "Bench"
|
|
220
|
+
shell: bash
|
|
221
|
+
|
|
222
|
+
- name: Install Python package
|
|
223
|
+
run: uv pip install -e ".[dev]"
|
|
224
|
+
|
|
225
|
+
- name: Run Python tests
|
|
226
|
+
run: uv run pytest tests/python/ -v
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
name: Coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch: # Manual trigger
|
|
5
|
+
schedule:
|
|
6
|
+
- cron: '0 6 * * 1' # Weekly: Monday 6am UTC
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: coverage-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
coverage:
|
|
17
|
+
runs-on: ubuntu-24.04
|
|
18
|
+
env:
|
|
19
|
+
CMAKE_BUILD_TYPE: Debug
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout code
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install system dependencies
|
|
25
|
+
run: |
|
|
26
|
+
sudo apt-get update
|
|
27
|
+
sudo apt-get install -y ninja-build lcov
|
|
28
|
+
|
|
29
|
+
- name: Setup uv and Python
|
|
30
|
+
uses: astral-sh/setup-uv@v5
|
|
31
|
+
with:
|
|
32
|
+
enable-cache: true
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
|
|
35
|
+
# ---------- C++ Unit Test Coverage ----------
|
|
36
|
+
- name: Configure C++ build with coverage
|
|
37
|
+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCLIFFT_COVERAGE=ON
|
|
38
|
+
|
|
39
|
+
- name: Build C++
|
|
40
|
+
run: cmake --build build --parallel
|
|
41
|
+
|
|
42
|
+
- name: Run C++ tests
|
|
43
|
+
run: ctest --test-dir build --output-on-failure
|
|
44
|
+
|
|
45
|
+
- name: Capture C++ test coverage
|
|
46
|
+
run: |
|
|
47
|
+
lcov --capture \
|
|
48
|
+
--directory build \
|
|
49
|
+
--output-file build/cpp-tests.info \
|
|
50
|
+
--ignore-errors mismatch \
|
|
51
|
+
--rc branch_coverage=1
|
|
52
|
+
|
|
53
|
+
lcov --remove build/cpp-tests.info \
|
|
54
|
+
'*/build/_deps/*' \
|
|
55
|
+
'*/build/*/tests/*' \
|
|
56
|
+
'*/clifft/tests/*' \
|
|
57
|
+
'/usr/*' \
|
|
58
|
+
--output-file build/cpp-tests.info \
|
|
59
|
+
--ignore-errors unused \
|
|
60
|
+
--rc branch_coverage=1
|
|
61
|
+
|
|
62
|
+
# ---------- Python Test Coverage (C++ and Python) ----------
|
|
63
|
+
# Build extension with coverage instrumentation
|
|
64
|
+
- name: Install Python package with coverage
|
|
65
|
+
run: uv pip install -e ".[dev]"
|
|
66
|
+
env:
|
|
67
|
+
CMAKE_ARGS: "-DCLIFFT_COVERAGE=ON"
|
|
68
|
+
SKBUILD_BUILD_TYPE: Debug
|
|
69
|
+
|
|
70
|
+
# Reset counters before Python tests
|
|
71
|
+
- name: Reset coverage counters
|
|
72
|
+
run: lcov --zerocounters --directory .
|
|
73
|
+
|
|
74
|
+
- name: Run Python tests
|
|
75
|
+
run: |
|
|
76
|
+
uv run pytest tests/python/ -v \
|
|
77
|
+
--cov=clifft \
|
|
78
|
+
--cov-report=xml:build/python-coverage.xml
|
|
79
|
+
|
|
80
|
+
- name: Capture C++ coverage from Python tests
|
|
81
|
+
run: |
|
|
82
|
+
# Find where scikit-build put the build
|
|
83
|
+
BUILD_DIR=$(find build -name '*.gcda' -printf '%h\n' 2>/dev/null | head -1 || echo "build")
|
|
84
|
+
echo "Found .gcda files in: $BUILD_DIR"
|
|
85
|
+
|
|
86
|
+
lcov --capture \
|
|
87
|
+
--directory . \
|
|
88
|
+
--output-file build/cpp-from-python.info \
|
|
89
|
+
--ignore-errors mismatch \
|
|
90
|
+
--rc branch_coverage=1
|
|
91
|
+
|
|
92
|
+
lcov --remove build/cpp-from-python.info \
|
|
93
|
+
'*/_deps/*' \
|
|
94
|
+
'*/build/*/tests/*' \
|
|
95
|
+
'*/clifft/tests/*' \
|
|
96
|
+
'/usr/*' \
|
|
97
|
+
'*/pybind11/*' \
|
|
98
|
+
--output-file build/cpp-from-python.info \
|
|
99
|
+
--ignore-errors unused \
|
|
100
|
+
--rc branch_coverage=1
|
|
101
|
+
|
|
102
|
+
# ---------- Merge and Upload ----------
|
|
103
|
+
- name: Merge C++ coverage reports
|
|
104
|
+
run: |
|
|
105
|
+
lcov --add-tracefile build/cpp-tests.info \
|
|
106
|
+
--add-tracefile build/cpp-from-python.info \
|
|
107
|
+
--output-file build/cpp-combined.info \
|
|
108
|
+
--ignore-errors mismatch \
|
|
109
|
+
--rc branch_coverage=1
|
|
110
|
+
|
|
111
|
+
echo "=== Combined C++ Coverage ==="
|
|
112
|
+
lcov --list build/cpp-combined.info
|
|
113
|
+
|
|
114
|
+
- name: Upload coverage to Codecov
|
|
115
|
+
uses: codecov/codecov-action@v5
|
|
116
|
+
with:
|
|
117
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
118
|
+
files: build/cpp-combined.info,build/python-coverage.xml
|
|
119
|
+
flags: cpp,python
|
|
120
|
+
fail_ci_if_error: false
|
|
121
|
+
verbose: true
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: docs-deploy
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy:
|
|
17
|
+
runs-on: ubuntu-24.04
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Build Wasm module
|
|
23
|
+
uses: ./.github/actions/build-wasm
|
|
24
|
+
|
|
25
|
+
- name: Copy Wasm artifacts
|
|
26
|
+
run: |
|
|
27
|
+
mkdir -p playground/public
|
|
28
|
+
cp build-wasm/clifft_wasm.js playground/public/
|
|
29
|
+
cp build-wasm/clifft_wasm.wasm playground/public/
|
|
30
|
+
|
|
31
|
+
- name: Setup Node.js
|
|
32
|
+
uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: 22
|
|
35
|
+
cache: npm
|
|
36
|
+
cache-dependency-path: playground/package-lock.json
|
|
37
|
+
|
|
38
|
+
- name: Build playground
|
|
39
|
+
run: |
|
|
40
|
+
cd playground && npm ci
|
|
41
|
+
VITE_BASE_PATH=/clifft/playground/ npm run build
|
|
42
|
+
|
|
43
|
+
# --- Build MkDocs (docs group only, no C++ extension needed) ---
|
|
44
|
+
- name: Install uv
|
|
45
|
+
uses: astral-sh/setup-uv@v6
|
|
46
|
+
with:
|
|
47
|
+
enable-cache: true
|
|
48
|
+
|
|
49
|
+
- name: Build docs
|
|
50
|
+
run: uv run --only-group docs mkdocs build --strict
|
|
51
|
+
|
|
52
|
+
# --- Merge: copy playground SPA into mkdocs output ---
|
|
53
|
+
- name: Copy playground into site
|
|
54
|
+
run: |
|
|
55
|
+
rm -rf site/playground
|
|
56
|
+
cp -r playground/dist site/playground
|
|
57
|
+
|
|
58
|
+
# --- Deploy to gh-pages (preserving pr-preview/) ---
|
|
59
|
+
- name: Deploy to GitHub Pages
|
|
60
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
61
|
+
with:
|
|
62
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
63
|
+
publish_dir: ./site
|
|
64
|
+
keep_files: true
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: PR Title
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, edited, synchronize, reopened]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
check-title:
|
|
12
|
+
runs-on: ubuntu-24.04
|
|
13
|
+
steps:
|
|
14
|
+
- name: Validate conventional commit format
|
|
15
|
+
env:
|
|
16
|
+
TITLE: ${{ github.event.pull_request.title }}
|
|
17
|
+
run: |
|
|
18
|
+
# Conventional commit prefixes accepted by git-cliff
|
|
19
|
+
PATTERN='^(feat|fix|docs|perf|refactor|test|bench|build|ci|chore|style|revert)(\(.+\))?!?: .+'
|
|
20
|
+
|
|
21
|
+
if [[ ! "$TITLE" =~ $PATTERN ]]; then
|
|
22
|
+
echo "::error::PR title does not follow conventional commit format."
|
|
23
|
+
echo ""
|
|
24
|
+
echo "Expected: <type>[optional scope]: <description>"
|
|
25
|
+
echo "Got: $TITLE"
|
|
26
|
+
echo ""
|
|
27
|
+
echo "Valid types: feat, fix, docs, perf, refactor, test, bench, build, ci, chore, style, revert"
|
|
28
|
+
echo "Examples:"
|
|
29
|
+
echo " feat: add importance sampling API"
|
|
30
|
+
echo " fix(parser): handle empty REPEAT blocks"
|
|
31
|
+
echo " docs: update installation guide"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
echo "PR title is valid: $TITLE"
|