-
Notifications
You must be signed in to change notification settings - Fork 5
Feature addition ( Dockerization, Test suite, Enzyme + Kernel abstractions Cuda Differentiability for regression and other tests) #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
divital-coder
commented
Jan 18, 2026
- Enzyme support for latest nvidia cards on GPU docker containers
- Full test-suite support (1000 + tests, testing native julia functions around image transformations and interpolations)
- Support for Julia 1.10 (1.10 + coming soon)
- Refined and Added README Templates
…tils.jl - Add Enzyme, ChainRulesCore, and Random to dependencies. - Fix interpolate_kernel to correctly handle spacing (convert physical coordinates to indices). - Implement interpolate_pure and its rrule using Enzyme.autodiff. - Update interpolate_my to use interpolate_pure for the fast path.
- Added `test/differentiability_tests/test_gradients.jl` to test gradients of all basic transformations. - Refactored `pad_mi`, `translate_mi`, and `change_orientation` to be non-mutating to support Zygote. - Refactored `rotate_mi` to use `interpolate_my` instead of `warp` for better differentiability. - Added `rrule` for `resample_kernel_launch` in `src/Utils.jl`. - Added `Zygote` and `FiniteDifferences` to test dependencies in `Project.toml`.
- Rewrote `pad_mi` in `src/Basic_transformations.jl` to use non-mutating `cat` and `ntuple`. - Rewrote `change_orientation` in `src/Spatial_metadata_change.jl` to use non-mutating tuple construction. - Rewrote `rotate_mi` in `src/Basic_transformations.jl` to use `interpolate_my` instead of `warp` for differentiability. - Added `rrule` for `resample_kernel_launch` in `src/Utils.jl`. - Added comprehensive differentiability tests in `test/differentiability_tests/test_gradients.jl` and integrated them into `test/runtests.jl`.
…esampling-13510357564736143532 Implement Enzyme-based autodifferentiation for resampling kernel
Integrates autodifferentiation support using Enzyme and Zygote from jakubMitura14's PR JuliaHealth#51, combined with CUDA fixes from PR JuliaHealth#50. Changes from PR JuliaHealth#51: - Non-mutating pad_mi and rotate_mi in Basic_transformations.jl - Non-mutating change_orientation in Spatial_metadata_change.jl - rrule definitions for resample_kernel_launch and interpolate_pure - New differentiability tests Merge conflict resolutions: - Kept CUDA.jl operation comments in Spatial_metadata_change.jl - Combined KernelAbstractions imports with Enzyme/ChainRulesCore - Maintained CUDA array backend handling in interpolate_my - Uses interpolate_pure for differentiability while ensuring CUDA compatibility Co-Authored-By: jakubMitura14 <[email protected]> Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Statistics: 1.9.0 -> 1 (supports Julia 1.10-1.12) - julia: 1.10.3 -> 1.10 (minimum version requirement) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add explicit datetime values in tests to avoid Dates.now() during AD - Create CPU-specific interpolation loops for Enzyme compatibility - Add @non_differentiable for geometric helper functions: - get_base_indicies_arr, extract_corners - get_voxel_center_Julia, Rodrigues_rotation_matrix - build_rotation_transform, build_scale_points - compute_extrapolate_value - Add rrule for change_orientation to handle dictionary lookups - Refactor rotate_mi to use non-differentiable transformation builder - Refactor scale_mi to use differentiable interpolation instead of imresize - Add ChainRulesCore to Resample_to_target, Spatial_metadata_change, and Basic_transformations modules All 15 gradient tests now pass: - resample_to_image, rotate_mi, scale_mi, translate_mi - crop_mi, pad_mi, resample_to_spacing, change_orientation Co-Authored-By: Claude Opus 4.5 <[email protected]>
Implement manual backward kernels for GPU gradient computation since KernelAbstractions + Enzyme doesn't support active kernel arguments on GPU backends. Changes: - Add trilinear_resample_backward_kernel! for trilinear interpolation gradients - Add nearest_resample_backward_kernel! for nearest-neighbor gradients - Use Atomix for race-safe atomic gradient accumulation on GPU - Update rrule to use manual backward kernels for GPU path - Add Atomix as a dependency - Add GPU autodiff test file The CPU path continues to use Enzyme.autodiff with pure Julia loops. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove manual backward kernels (trilinear_resample_backward_kernel!, nearest_resample_backward_kernel!) that used Atomix for atomic operations - Add Enzyme-compatible forward kernels without @const annotations (trilinear_resample_enzyme_kernel!, nearest_resample_enzyme_kernel!) - Add launcher functions that convert tuples to GPU arrays for Enzyme pattern - Update rrule to use Enzyme.autodiff for GPU backward pass - Remove unused Atomix dependency This enables automatic differentiation through KernelAbstractions GPU kernels using Enzyme, matching the working pattern that avoids "Active kernel arguments not supported on GPU" errors. Co-Authored-By: Claude Opus 4.5 <[email protected]>
feat: enable GPU autodiff for resample operations
- Create README.typ with orange-themed frames using frame-it - Include ASCII architecture diagram and API reference tables - Add code examples for all major operations - Link PDF from existing README.md Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Export 18 frame images from README.typ - Rewrite README.md with frame image references - Add table of contents - Remove all emojis for professional appearance - Match QADatasetsNormalize.jl documentation style Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Create separate frames-export.typ with only frame content (no titles or section headings) for cleaner PNG export. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Each section now shows only the frame image without repeating the same tables, code blocks, and text in markdown. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
===========================================
- Coverage 76.07% 54.85% -21.22%
===========================================
Files 8 8
Lines 514 762 +248
===========================================
+ Hits 391 418 +27
- Misses 123 344 +221 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.