summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2023-01-24Small fix for "static" in doc output (#2606)jsmall-nvidia
* #include an absolute path didn't work - because paths were taken to always be relative. * Upgrade to slang-llvm-13.x-33 * Kick - as build failed on download egress. * Output "static" on methods in doc output.
2023-01-23Full address insts elimination for backward autodiff. (#2604)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-19Add diagnostic for calling non-bwd-diff func from bwd-diff func. (#2602)Yong He
2023-01-17First custom backward-derivative test case working. (#2598)Yong He
2023-01-17Add `set` to spirv_instruction (#2597)jsmall-nvidia
2023-01-17Added switch-case support; fixed non-diff parameter transposition (#2596)Sai Praveen Bangaru
2023-01-15Switched to a much simpler method to transpose control flow, nested control ↵Sai Praveen Bangaru
flow works now (#2595)
2023-01-14Support custom backward derivative attribute. (#2594)Yong He
2023-01-14Fixes for crash when inlining at global scope (#2593)Theresa Foley
* Fixes for crash when inlining at global scope Recent changes to the way inlining is implemented in the Slang compiler have broken certain scenarios involving `static const` declarations. The basic problem is that the initial-value expression for a `static const` gets lowered into IR code at the global scope of a module, and if that code includes `call`s to stdlib operations marked `forceInlineEarly`, then we end up trying to apply inlining to code at module scope. The current inlining operation assumes that all `call`s are in basic blocks, and that the correct way to do inlining involves splitting those blocks. This change adds logic to detect when the callee at a call site to be inlined consists of a single basic block ending in a `return`, and in that case it invokes specialized inlining logic that doesn't split basic blocks and doesn't need to care if the original `call` is in a basic block. Thus we are able to inline calls to single-basic-block `forceInlineEarly` functions called as part of the initialization for global-scope `static const` variables. This logic does *not* solve the problem of calls to multi-block `forceInlineEarly` functions from the global scope. Such calls cannot really be inlined. A secondary problem that arises when inlining such calls is that the callee might include local temporaries (`var` instructions) that are read and written (`load`s and `store`s), and none of those instructions should be allowed at the global scope. In the case of the functions being inlined here, the `load`/`store` operations are superfluous, and should be cleaned up by our SSA pass. The only reason that they seem to *not* be getting cleaned up in the case that was been triggering crashes is that the callee is a generic. The current logic for the SSA pass was skipping the bodies of generic functions, so they would not be cleaned up. This change enables the SSA pass to apply to the bodies of generic functions, and also ensures that SSA cleanups are applied *before* any `forceInlineEarly` functions get inlined. * fixup: liveness test outputs
2023-01-13Frontend work for `[BackwardDerivative]` and `[BackwardDerivativeOf]`. (#2589)Yong He
* Frontend work for `[BackwardDerivative]` and `[BackwardDerivativeOf]`. * Fix clang issue. * Fix. * fix gcc issue * fix formatting. Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-12Fix issue around linking/obfuscation (#2588)jsmall-nvidia
* #include an absolute path didn't work - because paths were taken to always be relative. * Work around for some issue seen with a repro. * Small improvement in doing IDifferentable check. * Fix around obfuscation linkage.
2023-01-11Make backward differentiation work with generics. (#2586)Yong He
* Make backward differentiation work with generics. * Fix. * Another fix. * More fix. Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-10Small fixes around repro loading/autodiff (#2585)jsmall-nvidia
* #include an absolute path didn't work - because paths were taken to always be relative. * Work around for some issue seen with a repro. * Small improvement in doing IDifferentable check.
2023-01-10Nested bwd-diff func call context save/restore. (#2584)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-06Fix small issue around emitInterpolationModifiersImpl when layout is ↵jsmall-nvidia
nullptr. (#2583) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix output when layout is nullptr in emitInterpolatioModifiersImpl
2023-01-06Split bwd_diff op into separate ops for primal and propagate func. (#2582)Yong He
* Split bwd_diff op into separate ops for primal and propagate func. * Fix. * Download swiftshader with github actions instead of curl on linux. * Fix github action. Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-04Multi-block reverse-mode autodiff (#2576)Sai Praveen Bangaru
* Initial multi-block implementation * Implemented multi-block reverse-mode (without loops) * Added logic to remove block-level decorations to avoid confusing IR simplification passes * Fixed issues with block-level decorations during IR simplification by removing them prior to simplification. Co-authored-by: Yong He <yonghe@outlook.com>
2023-01-04Avoid dots in auto-detected filename extensions (#2566)Ellie Hermaszewska
Supersedes #2532
2023-01-04Add format checking attributes on printf-like functions (#2570)Ellie Hermaszewska
* Add format checking attributes on printf-like functions * Don't use printf format attributes on msvc Where they are not supported
2022-12-21Further unify the autodiff passes. (#2574)Yong He
* Further unify the autodiff passes. * Fix clang compilation error. * Rename ForwardDerivativeTranscriber->ForwardDiffTranscriber. * Remove unused fields from Transcriber classes. * More small cleanups. * Cleanup. Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-19Separate primal computations from unzipped function into an explicit ↵Yong He
function. (#2569) Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-20s/TRACTING/TRACING/ (#2567)Ellie Hermaszewska
Closes #2561
2022-12-14Fix code generation for matrix reshape. (#2568)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-12Added support for nested calls (#2562)Sai Praveen Bangaru
* Added initial support for nested calls * removed comments Co-authored-by: Yong He <yonghe@outlook.com>
2022-12-12Refactor shader cache (#2558)skallweitNV
* Fix a bug in Path::find * Fix code formatting * Fix LockFile and add LockFileGuard * Add PersistentCache and unit test * Replace file path dependency list with source file dependency list * Add note on ordering in Module/FileDependencyList * Remove old shader cache code * Refactor shader cache implementation * Temporarily skip unit tests reading/writing files * Fix warning * Reenable lock file test * Rename shader cache tests and disable crashing test * Testing * Stop using Path::getCanonical * Fix persistent cache lock and test * Fix threading issues * Move adding file dependency hashes to getEntryPointHash() * Fix handling of #include files * Allow specifying additional search paths for gfx testing device * Work on shader cache tests * Update project files * Revive shader cache graphics tests * Split graphics pipeline test * Fix compilation
2022-12-09Add `diffPair` stdlib function. (#2560)Yong He
2022-12-08Auto-diff for matrix operations. (#2559)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-08More type support for reverse-mode (#2551)Sai Praveen Bangaru
* Add vector arithmetic test. Make gradient accumulation work for any IRLoad * Added support for general vector types, and split transposition into transpose & materialize to allow emitting the fully accumulated gradient for complex types. * Several bug fixes + finished up support for vector & struct types + removed prop pass * minor fixes (int/uint casts) * Removed IRConstruct * Added some type casts to prevent warnings * minor fix for unused variable
2022-12-07Rename IR opcodes to unify style. (#2556)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-07Remove `construct` IR op. (#2555)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-07Lower-to-ir no longer produce `Construct` inst. (#2553)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-02Move `performanceStringInlining` to after `finalizeAutoDiffPass`. (#2550)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-02Cleanup crypto utilities (#2549)skallweitNV
* Consolidate crypto functions into single module * Migrate rest of code to new crypto module * Fix name conflict
2022-12-02Inline functions with string param/return for GPU targets (#2544)jsmall-nvidia
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP inlining of functions that take or return string related types on GPU targets. * Small fixes. * Added a test. * Add checking for any getStringHash insts are valid. * Support getStringHash on CUDA. * Tweak diagnostic.
2022-12-02Add helper functions to update DifferentialPair (#2547)winmad
2022-12-01Cleanup creation of `IDifferentiableType` in semantics checking. (#2548)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-12-01Allow `no_diff` on `this` parameter. (#2543)Yong He
2022-11-30Fix missing semantic highlighting in attributes and ↵Yong He
ExtractExitentialValueExpr. (#2541) * Fix missing semantic highlighting in attributes and ExtractExitentialValueExpr. * Fix regression on partially specialized generic expr highlighting. * Add regression test. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-30Cleanup DigestBuilder and MD5HashGen (#2539)skallweitNV
* Cleanup DigestBuilder and MD5HashGen * Fix templates Co-authored-by: Yong He <yonghe@outlook.com>
2022-11-30Support `no_diff` on existential typed params. (#2540)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-29Allow `no_diff` modifier on parameters (#2538)Yong He
2022-11-29Refactored reverse-mode implementation to use 4 separate passes. (#2531)Sai Praveen Bangaru
* Added partial implementation for reverse-mode * Fixing several compile and runtime errors. * Fixed several issues with reverse-mode passes. * Fixed more issues. Basic reverse-mode tests passing Co-authored-by: Edward Liu <shiqiu1105@gmail.com>
2022-11-29Complete removal of DifferentialBottom type. (#2537)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-29FileStream-based implementation for updating cache index file (#2485)lucy96chen
* Draft FileStream-based implementation for updating cache file * File streams fully integrated into shader cache code paths; Tests will not run unless file system is on disk as file streams do not play nicely with in-memory * Brought old code back as fallback path, but tests need to ensure previous is freed first * Testing structure updated, beginning cleanup work * All tests working * Cleanup changes * Removed an extra tab at the end of a line * Cleanup change * Undo externals change * Removed redundant logic for OS vs memory file system handling of the shader cache; Removed extra helper function left over from old cache implementation * Reverted performance change to generate contents hashes when modules are being loaded as this code path is not always followed; Contents hashing now uses a combination of hashing and checking the last modified time for all file dependencies, only reading in and hashing the contents of all files if the last modified hash does not match * Added handling to Module::updateContentsBasedHash for file dependencies which are not from a physical source file on disk; Added test for above Co-authored-by: Lucy Chen <lucchen@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2022-11-29Bug fix: partially specialized non-static generic invoke missing `this` ↵Yong He
argument. (#2536) * Fix non-static generic func call issue. * Add test case. * Revert unnecessary change. * Update test comment. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-28Add LockFile helper class (#2535)skallweitNV
* Add LockFile helper class
2022-11-23Make differentiable data-flow pass recognize interface methods. (#2530)Yong He
* Make differentiable data-flow pass recognize interface methods. * Make existing test to work with `[TreatAsDifferentiable]`. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-23Fix issues around dynamic generic function and autodiff. (#2528)Yong He
* Fix issues around dynamic generic function and autodiff. * Fix return type issue. * Fix type unification for generic `inout` parameter. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-23Autodiff through simple dynamic dispatch. (#2527)Yong He
* Autodiff through simple dynamic dispatch. * Revert changes. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-22Refactor Auto-diff passes (#2526)Sai Praveen Bangaru
* Initial refactor * Refactor passes tests * Removed Differential Bottom references from the IR side