summaryrefslogtreecommitdiff
path: root/tests/autodiff
AgeCommit message (Collapse)Author
2023-08-14Fix issue with nested loop unrolling (#3100)Sai Praveen Bangaru
* Do not eliminate single-iter-loops that have inner loops using their break label. * Add test * Delete out-old.hlsl * Update slang-ir-autodiff-cfg-norm.cpp * Fix whitespace
2023-08-04Redesign `DeclRef` and systematic `Val` deduplication (#3049)Yong He
* Redesign DeclRef + Deduplicate Val. * Update project files * Fix warning. * Fix. * Fix. * Remove `Val::_equalsImplOverride`. * Rmove `Val::_getHashCodeOverride`. * Remove `semanticVisitor` param from `resolve`. * Cleanups. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-08-01Generalize collectInductionValues (#3031)Ellie Hermaszewska
* Generalize collectInductionValues * Support affine transformations of loop index as induction variables * Test for generalized induction value collection * Neaten inductive variable finding * Store the type of implication success when finding inductive variables * Test that loop induction finding does not alway succeed * Support chains of additions and branches of additions in induction variable finding * Use c++17 for downstream compilers
2023-07-26Refactor `dmul(This, Differential)` to `dmul<T:Real>(T, Differential)` (#3029)Sai Praveen Bangaru
* Refactor `dmul(This, Differential)` to `dmul<T:Real>(T, Differential)` - Add AST synthesis support for generic containers - Refactor relevant tests * Merge dmul synthesis with dadd and dzero, and disambiguate using an enum * Fix trailing spaces
2023-07-14Robustness fixes around reverse-mode differentiation of variables & inout ↵Sai Praveen Bangaru
parameters (#2985) * Add a new test case for checking loop in the reverse mode * Create duplicate var for primal value to avoid inconsistent inputs to backward call Fixes an issue with inout parameters where the backprop call may use the post-call value of the var instead of the pre-call value. * `IRStore`s transpose to `IRLoad` and an `IRStore(0)` to clear differential. Fixes some subtle issues around transposing * Simplify test * Delete out-edited.hlsl --------- Co-authored-by: Lifan Wu <lifanw@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2023-07-12Extend `no_diff` to support subscript operations on resources and array ↵Sai Praveen Bangaru
variables… (#2981) * Extend `no_diff` to support subscript operations on resources and array variables * Update autodiff.slang.expected
2023-06-29Issue diagnostic for incorrect parameter types & directionality when ↵Sai Praveen Bangaru
defining custom derivatives (#2947) * Issue diagnostic for incorrect directionality when defining custom derivative * Better diagnostics on invalid custom derivatives * Avoid duplicating `getParameterDirection()` --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-06-07AD: Fix out-of-scope indexing rules for insts in loop header blocks during ↵Sai Praveen Bangaru
the primal-inst availability pass (#2918) * add test case * Fix out-of-scope indexing rules for loop header blocks --------- Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2023-05-30Fix type checking & loop value hoisting (#2907)Yong He
* Fix type checking crash in language server. * Fix loop var hoisting logic. Fixes #2903. * fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-05-30Fix derivative signature bug in checkDerivativeAttribute. (#2905)Yong He
2023-05-14Add [Differentiable(n)] syntax to specify max order. (#2883)Yong He
2023-05-07Optimize logic around indexed temporary variables (#2873)Sai Praveen Bangaru
2023-05-06Don't store loop induction values + fix minor issue (#2872)Sai Praveen Bangaru
2023-05-05Fix checkpoint hints for higher-order autodiff (#2869)Sai Praveen Bangaru
2023-04-28Fix handling of `[PreferRecompute]`. (#2855)Sai Praveen Bangaru
Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2023-04-26Intellisense: show info on decl kind and differentiability. (#2847)Yong He
2023-04-26Autodiff support for dynamically dispatched generic method. (#2846)Yong He
* Autodiff support for dynamically dispatched generic method. * Fix. * Support dynamically dispatched generic type. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-04-26For C-like targets, emit resource declarations before other globals (#2843)Sai Praveen Bangaru
* For C-like targets, emit resource declarations before other globals * Remove unused tests
2023-04-25Support recomputing phi params in bwd prop func. (#2841)Yong He
2023-04-24Change AD checkpointing policy to recompute more. (#2836)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-04-23Add support for `kIROp_MakeExistential` (#2832)Sai Praveen Bangaru
2023-04-21Add support for `kIROp_FloatCast` (#2824)Sai Praveen Bangaru
* Add support for `kIROp_FloatCast` * Update float-cast.slang * Added flag to d3d options
2023-04-21AD: Various fixes around dynamic dispatch (#2820)Sai Praveen Bangaru
* Add a test for the new diff material system * Various fixes for AD - inout primal context params converted to out params, - added attributed types to list of stored types - used differentiated primal func type instead of type of differentiated func to avoid tangling with user-code differential types. --------- Co-authored-by: Lifan Wu <lifanw@nvidia.com>
2023-04-21Add warning for returning without initializing out parameter (#2807)Ellie Hermaszewska
* Add warning for returning without initializing out parameter * Add unused prelude function to squash uninitialized out variable warnings
2023-04-14Bugfix: compiler will run forever to eliminate dead code (#2809)winmad
* Add a test case that the compile will run forever * Fix. * fix. --------- Co-authored-by: Lifan Wu <lifanw@nvidia.com> Co-authored-by: Yong He <yhe@nvidia.com>
2023-04-11Implement FileCheck tests for several test commands (#2747)Ellie Hermaszewska
* Add missing expected.txt for test * Diagnostics -> StdWriters in render test * Allow specifying several test prefixes to run `slang-test -- tests/foo tests/bar` * Squash warnings in some tests * Enable gfx debug layer in gfx test util Makes this issue present consistently: https://github.com/shader-slang/slang/issues/2766 * Allow DebugDevice to return interfaces instantiated by the debugged object * Check that we actaully have a shader cache for shader cache tests * Implement FileCheck tests for several test commands - SIMPLE, SIMPLE_EX - SIMPLE_LINE - REFLECTION, CPU_REFLECTION - CROSS_COMPILE It does not currently support the render tests or the COMPARE_COMPUTE commands It is invoked by adding `(filecheck=MY_FILECHECK_PREFIX)` to the test command, for example TEST:CROSS_COMPILE(filecheck=SPIRV): -target spirv-assembly * Move LLVM FileCheck interface to slang-llvm * Neaten slang-test tests * Refine handling of expected output in slang-test * Add example FileCheck buffer test * Add cuda-kernel-export tests Which were waiting on FileCheck * Bump vs project files * Make createLLVMFileCheck_V1 return a void* rather than specifically an IFileCheck * Remove use of CharSlice from filecheck interface * Bump slang-llvm version --------- Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
2023-04-07Fix crash on overloaded custom derivative function (#2782)Sai Praveen Bangaru
* Fix issue with resolving overloaded custom forward derivative methods. * Add test
2023-04-05Register `IDifferentiable` witnesses for the differential associated types ↵Sai Praveen Bangaru
of registered types. (#2777) * Create high-order-forward-diff-struct.slang * Add a small pass to register differentials for differentials of registered types * Remove type reg pass and apply logic in differentiable type loading instead * Update slang-ir-autodiff.cpp * Fix comments. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-04-02Fix several silently failing tests (#2767)Ellie Hermaszewska
* Add missing expected.txt for test * Diagnostics -> StdWriters in render test * Allow specifying several test prefixes to run `slang-test -- tests/foo tests/bar` * Squash warnings in some tests * Enable gfx debug layer in gfx test util Makes this issue present consistently: https://github.com/shader-slang/slang/issues/2766 * Allow DebugDevice to return interfaces instantiated by the debugged object * Check that we actaully have a shader cache for shader cache tests --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-03-29Update checkpoint policy to make obvious recompute decisions. (#2753)Yong He
* Update checkpoint policy to make obvious recompute decisions. Also adds an optimization to fold updateElement chains on the same array or struct into a single makeArray or makeStruct. * Bug fixes around array types with different int typed count. * change test. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-28AD: Warped-Area-Sampling test works now. (#2742)Sai Praveen Bangaru
* Create render.slang * Added higher-order differentiability decorators for built-ins + preliminary tests * Update diff.meta.slang * Copy over conformance synthesis code to `DifferentiableTypeConformanceContext` * Update render.slang * Fixed 1D warped-area sampling test * Update warped-sampling-1d.slang * Remove commented line. * Change WAS test to use fixed point * Replaced InterlockedCmpExchange with InterlockedAdd * Increase fixed point precision * Reduce floating-point precision by 2 digits to avoid platform-specific problems * Dropped another digit (just to be safe) --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-03-27Translate all composed types into tuple types in pyBind. (#2744)Yong He
* Translate all composed types into tuple types in pyBind. * Delete temp file. * Fix get tuple element code emit logic. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-27Fix lowering crash in [BackwardDerivativeOf]. (#2737)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-26Add PyTorch C++ binding generation. (#2734)Yong He
* Add PyTorch C++ binding generation. * fix --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-24Switch to short circuiting semantics for scalar `?:` operator. (#2733)Yong He
2023-03-24Added `[BackwardDifferentiable]` tags for intrinsic + builtin methods (#2732)Sai Praveen Bangaru
* Added higher-order differentiability decorators for built-ins + preliminary tests * Update diff.meta.slang
2023-03-24Fix nested bwdContextType lowering. (#2731)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-23Fix various autodiff crashes related to interface usage. (#2730)Yong He
* Fix crash. * Fix `[ForwradDerivative]` on member functions. * Update comments. * Fix crash when [BackwardDerivative] is provided but not [ForwardDerivative]. * Allow calling dynamic dispatched generic method from differentiable func. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-23AD: Fix type checking for higher-order custom derivatives definitions (#2729)Sai Praveen Bangaru
* Fixed type coercion issue with higher-order user defined methods * Placed associated type lookup method in a loop * Update high-order-user-defined-derivative.slang * Revert changes to associated type lookup method
2023-03-23Hack handling of primal insts that has a function type. (#2728)Yong He
* Update diff-bwd material test * Minor update * Hack handling of primal insts that has a function type. --------- Co-authored-by: winmad <winmad.wlf@gmail.com> Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-22Create a simplified Falcor material system in slang test (#2721)winmad
* Duplicate an example of differentiating Falcor's material system * Add a second BSDF * WIP: update test; grad didn't pass through * Finalize test --------- Co-authored-by: Lifan Wu <lifanw@nvidia.com>
2023-03-21[TreatAsDifferentiable] functions. (#2720)Yong He
2023-03-21Fix associated type resolution bug. (#2719)Yong He
* Fix associated type resolution bug. * Fix. * Fix language server hinting messed up by breadcrumb nodes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-17Add support for emitting cuda kernel and host functions. (#2712)Yong He
* Add support for emitting cuda kernel and host functions. * Update test. * Fix cuda preamble emit. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-16Fix Phi simplification bug. (#2710)Yong He
* Fix Phi simplification bug. * Fix up. * Fix. * Fix. * Fix. * Fix. * Fix. * Fix test. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-16Add `[CudaDeviceExport]` to allow exporting CUDA device functions. (#2708)Yong He
* Add `[CudaDeviceExport]` to allow exporting CUDA device functions. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-16Add test case for `makeStruct` transcription. (#2705)Yong He
* Add test case for `makeStruct` transcription. * Update documentation on `no_diff`. * Update toc --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-15AD: Primal-Hoisting Rework + Checkpoint Policy Framework (#2702)Sai Praveen Bangaru
2023-03-15Properly implement differential witness of intermediate context type. (#2699)Yong He
* Properly implement differential witness of intermediate context type. * Modify test to include a loop. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-14Support `fwd_diff(bwd_diff(f))`. (#2697)Yong He
* Support `fwd_diff(bwd_diff(f))`. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>