summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
AgeCommit message (Collapse)Author
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-04Fix crash on encountering undefined identifier when checking derivative ↵Sai Praveen Bangaru
attributes (#2773) * Fix compiler crash if referencing undefined method in the deriavative decorator * Delete sample.comp --------- Co-authored-by: Yong He <yonghe@outlook.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-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-21Fix IntVal type check. (#2718)Yong He
* Fix IntVal type check. * add test case result. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-21Add texture tri-linear autodiff example. (#2715)Yong He
* Add quad texture example. * delete output image * remove irrelavent files * update project files * fix * Update example. * Fix. * remove out-texture --------- 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-13Support high order diff pattern: `bwd_diff(fwd_diff(f))`. (#2695)Yong He
* Support high order diff pattern: `bwd_diff(fwd_diff(f))`. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-08Add support for `[PrimalSubstitute]` and `[PrimalSubstituteOf]`. (#2691)Yong He
* Add support for `[PrimalSubstitute]` and `[PrimalSubstituteOf]`. * Fix * Fix. * Cleanup. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-03-07Reuse higher-order `ResolveInvoke` logic to resolve func refs in ↵Yong He
`[*DerivativeOf]` attribs. (#2688) * Reuse higher-order `ResolveInvoke` logic to resolve func refs in [*DerivativeOf] attribs. * Add diff implementation matrix versions of binary and ternary intrinsics. * Add diff impl for legacy intrinsics. * Fix diagnostics of using non-differentiable function in a diff operator. * Add diff implementation for `determinant`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-02-24Support dynamic dispatch a backward differentiable function. (#2678)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-02-24Fix differential type registration through non-differentiable type. (#2677)Yong He
* Fix differential type registration through non-differentiable type. * More fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-02-17Fixed crash when lowering IR for no_diff struct member. (#2658)Yong He
* Fixed crash when lowering IR for no_diff struct member. * Improve `setInsertBeforeOrdinaryInst` and `setInsertAfterOrdinaryInst`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-02-14Preliminary debugBreak support (#2647)jsmall-nvidia
* #include an absolute path didn't work - because paths were taken to always be relative. * Preliminary support for debug break. * Add C++ debug break support. Add details about usage. * Improve debug break test details. * Make HLSL output a comment about no support. * Handle specialize for target assert, without a body if it has spv_instruction/target intrinsic
2023-02-10Fix checking of `[BackwardDerivativeOf]` attribute. (#2640)Yong He
* Fix checking of `[BackwardDerivativeOf]` attribute. * Fix crash in `canInstHaveSideEffectAtAddress`. * Fix. * Revert fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-30Make ArrayExpressionType a DeclRefType and define its autodiff extension in ↵Yong He
stdlib. (#2615) * Allow array parameters in forward diff. * Use type canonicalization instead of coersion. * Reimplement array type. * Fix. * Update test case. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-01-24Reimplement address elimination. (#2605)Yong He
* Reimplement address elimination pass. * Fix error. * Update test references. 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-14Support custom backward derivative attribute. (#2594)Yong He
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-10Nested bwd-diff func call context save/restore. (#2584)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
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>
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-30Support `no_diff` on existential typed params. (#2540)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-29Complete removal of DifferentialBottom type. (#2537)Yong He
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-21WIP: Fixed inout struct and added testing for calls to non-differentiable ↵Sai Praveen Bangaru
functions (#2505) * Added non-differentiable call test * Extended testing for nondifferentiable calls * Fixed subtle issue with extensions on generic types not applying the correct substitutions, leading to unspecialized generics at the emit stage * More fixes. inout struct params now work fine * Update inout-struct-parameters-jvp.slang * Update slang-ir.cpp * Fixed hoisting lookup_interface_method * Fixed non-diff call return value * Fixed issue with phi nodes * Fixed problem with IRSpecialize preventing hoisitng of DifferentialPairType * Fixed non-diff call test to conform to the new 'no_diff' system
2022-11-18Data flow validation pass for diagnosing derivative loss. (#2523)Yong He
2022-11-16Clean up type checking of higher order expressions. (#2519)Yong He
* Clean up type checking of higher order expressions. * Replace `goto` with `break` to pacify clang. * Fix. * Fixes. * Fix more tests. * Fix lowerWitnessTable parameter error. * Exclude attributes from ast printing. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-16Mesh shader support (#2464)Ellie Hermaszewska
* Add gdb generated files to .gitignore * Switch to c++17 TODO: Ellie update coding style doc * WIP mesh shaders * Add MeshOutputType and mesh output decorations * Lift array type layout creation out of _createTypeLayout in preparation for sharing it elsewhere * Initial pass at GLSL legalization for mesh shaders * Create output types for builtin mesh outputs This should be rendered as an out paramter block * Handle writes to member fields in mesh shader output * Per primitive output from mesh shaders * Add mesh shader tests * Redeclare mesh output builtins * Remove unused instruction * Emit explicit mesh output max max size * Add unimplemented warning for array members in mesh output * Implement mesh output splitting for GLSL in terms of getSubscriptVal * Allow HLSL syntax for mesh output modifiers * Improve error messages for mesh output * Add test for HLSL style mesh output syntax * Emit explicit mesh output indices max size * HLSL generation support for mesh shaders * Better errors for mesh shader misuse * Neaten comments * Regenerate vs2019 project files * Fix build on vs2019 * Retreat on c++17 Will make the change in a separate PR * slang-glslang binary dep 11.10.0 -> 11.12.0-32 * Fixes for msvc compiler * Update msvc project
2022-11-09Add `[ForwardDerivativeOf]` attribute. (#2501)Yong He
* Add [ForwardDerivativeOf] attribute. * Fix handling around phi nodes. * Fixes. * Remove IR opcode for ForwardDerivativeOfDecoration. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-04Higher order differentiation. (#2487)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-02Rework differential conformance dictionary checking. (#2483)Yong He
* Rework differential conformance dictionary checking. * Revert space changes. Co-authored-by: Yong He <yhe@nvidia.com>
2022-11-01Make `DifferentialPair` able to nest. (#2477)Yong He
2022-10-27Rename `JVPDerivativeModifier` -> `ForwardDifferentiableAttribute`. (#2472)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-10-27Auto synthesis of IDifferntial interface methods. (#2469)Yong He
* Auto synthesis of IDifferntial interface methods. * Add comments. Co-authored-by: Yong He <yhe@nvidia.com>
2022-10-26Auto synthesis of Differential type (#2466)Yong He
2022-10-24Rework differentiation of member access through ↵Yong He
`[DerivativeMember(DiffType.field)]` (#2460) * wip: remove auto-diff for member access, add diff through property accessors. * Fix getter-setter test. * Fix getter-setter-multi test. * Fix nested-jvp test. * Use [DerivativeMember] attribute to differentiate through member access. * Clean up. * More cleanup. Co-authored-by: Yong He <yhe@nvidia.com>
2022-10-20Modified the new type system to support generic differentiable types … (#2413)Sai Praveen Bangaru
* Modified the new type system to support generic differentiable types and added support for differentiating overloaded functions. * Changed a few asserts to release asserts to avoid unreferenced variable errors * Fixed a naming issue with TypeWitnessBreadcumb::Flavor::Decl * Added logic to avoid tracking differentiable types if the module does not use auto-diff or define differentiable types. * Moved the auto-diff passes to after the specialization step, added a more complex generics test * Added a generics stress test and fixed AST-side logic. IR side needs some more work * Added differential getter and setter logic, fixed multiple issues with DifferentiableTypeDictionary, added support for loops and conditions * Changed differential getters to use pointer types, added getter type checking * Fixed some bugs related to diff type registration and differential getters * Removed some superfluous code * Removed some more unused code. * Fixed an issue with witness substitution * Minor fix Co-authored-by: Yong He <yonghe@outlook.com>
2022-10-04Fix `ApplyExtensionToType` on own type being extended. (#2430)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2022-09-20Support partial inference of generic arguments (#2404)Theresa Foley
A commonly requested feature is to be able to supply only some of the arguments to a generic explicitly, while allowing the rest to be inferred. A common example is a function that performs some kind of conversion: To convert<To, From>( From fromValue ) { .... } A user would like to be able to call this operation like: int i = convert<int>( 1.0f ); but the current Slang type checker requires all or none of the generic arguments be supplied. Supplying all of the arguments is tedious: int i = convert<int, float>( 1.0f ); In this case, the `float` type argument is redundant and could be inferred from context. However, if the user tries to omit the generic argument list: int i = convert( 1.0f ); The current type-checker cannot infer the `int` type argument (even if one might claim it *should* infer based on the desired result type). This change adds support for the `convert<int>(...)` case, by allowing a generic to be applied to a prefix of its explicit arguments, and then inferring the remaining arguments from contextual information when that "partially applied" generic is applied to value-level arguments. Most of the changes are just plumbing: adding the notion of a partially applied generic and then supporting them during overload resolution. A single test case is included that covers the `convert`-style use case. It is likely that more testing is needed to cover failure modes of this feature.
2022-09-15Language feature: pointer sized int types. (#2401)Yong He
* Language feature: pointer sized int types. * Fix. * small change to test. * Fix stdlib. * Fix. * Fix. * Add typedef for `size_t` in stdlib. * Fix test. * Add `intptr_t::size` constant. Co-authored-by: Yong He <yhe@nvidia.com>
2022-09-13Deduplicate AST type nodes and cache lookup operations. (#2397)Yong He
* wip: dedup AST type nodes and cache lookup. * Fix. * Remove profiling. * Fixes. Co-authored-by: Yong He <yhe@nvidia.com>
2022-09-01Deduplicate consts and IRSpecialize in IR, propagate type info for `IntVal`. ↵Yong He
(#2388)
2022-08-24Allow `static const` interface requirements. (#2378)Yong He
2022-08-17Warning on lossy implicit casts. (#2367)Yong He
* Warning on bool to float conversion. * Fix test cases. * Improve. * LanguageServer: don't show constant value for non constant variables. * Fix tests. * Fix warnings in tests. Co-authored-by: Yong He <yhe@nvidia.com>