summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2024-10-11WGSL: Enable load & store from byte-addressible buffers (#5252)Anders Leino
2024-10-10Fix links in stdlib reference category landing page. (#5250)Yong He
2024-10-09Support constant folding for static array access. (#5248)Yong He
* Support constant folding for static array access. * Fix test.
2024-10-09Use user defined type name in glsl buffer declarations. (#5242)Yong He
2024-10-09Fix precompiled glsl modules (#5230)cheneym2
When precompiling modules defined with glsl, it's necessary to link in the glsl definition module. Reuse the public fillRequirements declaration
2024-10-09Metal: Texture write fix (#4952)Dynamitos
2024-10-09Fix spirv lowering logic around pointer to unsized array. (#5243)Yong He
* Fix spirv lowering logic around pointer to unsized array. * Fix. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-10-09Fix bug related to findAndCheckEntrypoint. (#5241)Yong He
2024-10-08Fix build for clang-14 (#5235)James0124
Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-08Overhaul docgen tool and setup CI to generate stdlib reference. (#5232)Yong He
* Overhaul docgen tool and setup CI to generate stdlib reference. * Fix build error. * Write parsed doc for all decls. * fix. * fix callout. * Fix. * Fix comment. * Fix. * Delete obsolete doc tests. * Fix. * Categorize functions and types. * Fix CI. * Update comments.
2024-10-08Look through attributes and rates when determining by reference ↵Ellie Hermaszewska
initialization (#5023) * Look through attributes and rates when determining by reference initialization Closes #5022 * Make type of unwrapAttributedType more specific * loosen type of unwrapAttributedType * Discard changes to source/slang/slang-emit-spirv.cpp * Discard changes to source/slang/slang-ir-check-differentiability.cpp * Discard changes to source/slang/slang-ir.cpp * Discard changes to source/slang/slang-ir.h * Update slang-ir-use-uninitialized-values.cpp * Remove redundant cast --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-08WGSL emitter: Specify private address space for global non-handle variable ↵Anders Leino
declarations (#5236) Closes issue #5229.
2024-10-07Add WGSL support for slang-test (#5174)Anders Leino
* Use the assembly description as target when disassembling I believe this is a bugfix. It seems to have worked before because up until the WGSL case, the disassembler has been the same executable as the one producing the binary to be disassembled. * Add Tint as a downstream compiler This closes issue #5104. * Add downstream compiler for Tint. * Tint is wrapped in a shared library, 'slang-tint' available from [1]. * The header file for slang-tint.dll is added in external/slang-tint-headers. * Add some boilerplate for WGSL targets. * Add an entry point test for WGSL. [1] https://github.com/shader-slang/dawn/releases/tag/slang-tint-0 * Add WGSL_SPIRV as supported target for Glslang * Add WebGPU support to slang-test This helps to address issue #5051. * Disable lots of crashing compute tests for 'wgpu' This closes issue #5051. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-06Refactor the code for synthesizing the body of constructor (#5231)kaizhangNV
2024-10-04Add interfaces for retrieving separate linkable downstream binaries (#5128)cheneym2
* Implement separate downstream library interface Create a new com interface to house the methods for precompiling slang modules to target code. Add methods to count dependent modules and scrape them for downstream target binaries such that the downstream target binaries are linkabe outside of slang, e.g. via spirv-link or dxc. Fixes #5147 * Rename to _Experimental Clearly identify this as an interface subject to change.
2024-10-04Allow building using external dependencies (#5076)Tobias Frisch
* Add options to prevent usage of own submodules Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow using external unordered dense headers Signed-off-by: Jacki <jacki@thejackimonster.de> * Link system wide installed unordered dense Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow external header usage for lz4 and spirv Signed-off-by: Jacki <jacki@thejackimonster.de> * Add more options to disable targets Signed-off-by: Jacki <jacki@thejackimonster.de> * Add option to provide explizit path for spirv headers and remove earlier options that break the build process Signed-off-by: Jacki <jacki@thejackimonster.de> * Rename options to use common prefix Signed-off-by: Jacki <jacki@thejackimonster.de> * Fix indentation for the cmake changes Signed-off-by: Jacki <jacki@thejackimonster.de> * Add advanced_option function for cmake * Normalize includes between system and submodule dependencies Fix any before-accidentally-working problems * Add option for enabling/disabling slang-rhi Signed-off-by: Jacki <jacki@thejackimonster.de> * Pass correct include path for cpu tests * Correct include path --------- Signed-off-by: Jacki <jacki@thejackimonster.de> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-10-03Support custom derivatives of member functions of differentiable types (#5124)Sai Praveen Bangaru
* Initial work to support custom derivatives for member methods of differentiable types * Support custom derivatives of member functions of differentiable types - Also adds support for declaring custom derivatives via extensions. * Fix * move defs * Update slang-check-decl.cpp * Create diff-member-func-custom-derivative.slang.expected.txt * Update slang-check-decl.cpp * Fix for static custom derivatives * Fix diagnostics for [PreferRecompute] * Add backward custom derivative tests
2024-10-02Fix the broken CI (#5216)Jay Kwak
The type of `sizeof` has to be int not uint.
2024-10-01Fix crash when compiling associatedtypes with generic interface constraints. ↵Yong He
(#5200) * Fix crash when compiling associatedtypes with generic interface constraints. * delete hlsl.meta.slang.temp.h. * Fix.
2024-10-01SizeOfLikeExpr has type int (#5205)Ellie Hermaszewska
* Correct typo in parser * SizeOfLineExprs have type int Fixes https://github.com/shader-slang/slang/issues/5191
2024-09-30Fix diagnostics for [PreferRecompute] (#5159)Sai Praveen Bangaru
* Fix diagnostics for [PreferRecompute] * Update dont-warn-on-simple-prefer-recompute.slang * Update slang-ir-autodiff.cpp * Update dont-warn-on-simple-prefer-recompute.slang * Update warn-on-prefer-recompute-side-effects.slang
2024-09-30Add COM API for querying metadata. (#5168)Yong He
* Add COM API for querying metadata. * Fix tests. * fix test.
2024-09-27Fix target switch lowering bug. (#5182)Yong He
2024-09-27Fix bug in `translateGlslGlobalVar()`. (#5181)Yong He
2024-09-27Fix hull shader spirv legalization bug. (#5180)Yong He
2024-09-27Fix l-value computation for subscript call. (#5177)Yong He
2024-09-26Implement texture_storage_Xd in WGSL (#5158)Jay Kwak
* Implement texture_storage_Xd in WGSL This commit implements `texture_storage_Xd` in WGSL, which is similar to RWTextureXD in HLSL. It is intresting that `texture_storage_Xd` doesn't take the shader type as its input argument at all. Instead, it takes "texel format" enum value as its first template parameter, which can be found here: https://www.w3.org/TR/WGSL/#storage-texel-formats As an example, `texture_storage_2d<rg32uint, read_write>` expects vec4<u32> as a value type for `Load` and `Store`, where Z-component will be ignored and treated as zero and W-component will be treated always as 1. The type `u32` is inferred from the enum value `rg32uint`. Note that the number of component is always fixed to 4 regardless how many components are actually stored.
2024-09-26Move texture format inference to frontend and add reflection api for it. (#5155)Yong He
2024-09-26Always run AD cleanup pass. (#5157)Sai Praveen Bangaru
2024-09-25WGSL texture support for depth and multisampled (#5152)Jay Kwak
* WGSL texture support for depth and multisampled This commit fixes a few issues with WGSL texture intrinsics. - static_assert-s are corrected. - Gather functions work properly with depth textures - Load functions work properly with depth textures and multisampled textures
2024-09-25Fixing bug when writing primitives in metal mesh shaders (#5069)Dynamitos
2024-09-25Enable emscripten builds to compile slang.dll to WebAssembly. (#5131)Anders Leino
* Compile fixes for Wasm The issues are all are due to 'long' types being 32 bits on WASM. - class members redeclared errors - << with StringBuilder and unsigned long is ambiguous This helps to address issue #5115. * Use the host executable suffix for generators Since the generators are run at build-time, we should not use CMAKE_EXECUTABLE_SUFFIX, which is the suffix for the target platform. Instead, define CMAKE_HOST_EXECUTABLE_SUFFIX as appropriate, and use that suffix instead. This helps to address issue #5115. * Add support for Wasm as a platform This helps to address issue #5115. * Add emscripten build This closes #5115.
2024-09-24Fix the incorrect use of GLSL textureGather (#5150)Jay Kwak
`$p` was incorrectly removed on the previous commit. This commit brings it back and fixes the problem.
2024-09-23Feature/wgsl intrinsic texture gather (#5141)Jay Kwak
This PR implements the texture gather functions for WGSL. The pattern was very similar to how Metal was implemented. Before copy and paste from the Metal implementation, I had to clean up the Metal implementation to make it more readable and maintainable. Gather functions are available only for 2D and 3D textures. Their `array` and `depth` variants may or may not be supported depending on the target. `static_assert` ensures that Gather functions are available only for 2D and 3D textures. Removed incorrect use of "$p" argument for targeting GLSL.
2024-09-23Implemented Combined-texture for WGSL (#5130)Jay Kwak
* Implemented Combined-texture for WGSL * Remove unnecessary comment * Limit to std430 layout * Fix compiler warning for unused variable --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-09-23Fix incorrect use of pointer in WGSL (#5144)Jay Kwak
Closes #5143 Recently there was a commit that changed the behavior of the memory pointer for WGSL. This commit fixes some issues came up after the change.
2024-09-20Fix handling of pointer logic in wgsl backend. (#5129)Yong He
2024-09-20WGSL implement texture intrinsics except gather and sampler-less (#5123)Jay Kwak
This commit implements all of the texture intrinsics for WGSL except "Gather" and sampler-less. They will be implemented in a separate PR. A few things to note: - texture sampling functions are available only for the fragment shader stage; not for compute - WGSL doesn't have any functions similar to CalculateLevelOfDetail or CalculateLevelOfDetailUnclamped. - WGSL doesn't have a function overlaoding for textureSample with "clamp" or "status" arguments. - WGSL doesn't support Load operation with offset for texture_multisampled_XX and texture_storage_XX. - WGSL supports only four types of depth textures: 2D, 2D_array, cube and cube_array. - WGSL doesn't support "offset" variants for cube and cube_array.
2024-09-20Initial `Atomic<T>` type implementation. (#5125)Yong He
* Initial Atomic<T> type implementation. * Update design doc. * Fix. * Add test. * Fixes and add tests. * Fix WGSL. * Fix glsl. * Fix metal. * experiemnt with github metal. * experiment github metal 2 * github metal experiment 3 * experiment with github metal 4. * experiment with metal 5. * experiment 7. * metal experiment 8. * Fix metal tests. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-09-19Add diagnostic to verify the left hand side of a generic constraint. (#5112)Yong He
* Add diagnostic to verify the left hand side of a generic constraint. * Fix comment.
2024-09-19Re-enable slang-test for WGSL (#5120)Jay Kwak
My previous commit disabled the WGSL test by a mistake. This commit fixes the mistake and run the slang-test for WGSL tests. frexp and modf were still not working for the vector types.
2024-09-19Synthesize conformance for generic requirements. (#5111)Yong He
* Synthesize conformance for generic requirements. * Fix. * Fix build error. * address code review.
2024-09-19Allow lookups of overloaded methods. (#5110)Sai Praveen Bangaru
* Allow lookups of overloaded methods. * Update slang-reflection-api.cpp * Update slang.cpp --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-09-19Add WGSL intrinsics for synchronization (#5114)Anders Leino
This closes issue #5085.
2024-09-19Support `IDifferentiablePtrType` (#5031)Sai Praveen Bangaru
* initial diff-ref-type interface * Initial support for `IDifferentiablePtrType` * Fix unused vars * More tests + fix switch case fallthrough. * Update slang-ir-autodiff.cpp * Update diff-ptr-type-loop.slang * Add optimization to allow more complex pair types * Update slang-ir-autodiff-primal-hoist.cpp * Update diff-ptr-type-loop.slang * Update slang-ir-autodiff-primal-hoist.cpp * More fixes to address reviews * Update slang-check-expr.cpp * Optimizations + rename `differentiableRefInterfaceType` -> `differentiablePtrInterfaceType` * Move pair logic to ir-builder, unify the type dictionaries. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-09-18Report AD checkpoint contexts (#5058)venkataram-nv
* Transferring source locations when creating phi instructions * Tracking for simple variables * Deriving source locations for loop counters * Printing checkpoint structure breakdown * More readable output format * Special behavior for loop counters * Writing report to file * Add slangc option to enable checkpoint reports * Display types of checkpointed fields * Message in case there are no checkpointing contexts * Catch source locations for function calls * Source cleanup * Fix compilation warnings * Remove stray dump() * Provide the report through diagnostic notes * Add missing path for sourceLoc during unzip pass * Add tests for reporting intermediates * Include more transfer cases for source locations * Fix ordering in address elimination * Fill in more holes with source location transfer * Remove debugging line * Reverting changes to diagnostic sink * Simplify address elimination using source location RAII contexts * Eliminating manual source loc transfers in forward transcription * Fix local var adaptation to use RAII location setter * Simplify primal hoisting logic for source location transfer * Simplify unzipping with RAII location scopes * Simplify transpose logic * Cleaning up for rev.cpp * Reverting spacing changes * Fix mistake with source loc RAII instantiation * Fix formatting issues
2024-09-18Lower the priority of looking up the rank of scope (#5065)kaizhangNV
* Lower the priority of looking up the rank of scope In the previous change of #5060, we propose a way to resolve the ambiguous call when considering the scope of a function. But this rule should be considered as a low priority than "specialized candidate", aka. we should consider more "specialized candiate" first. * Count distance between reference site to declaration site Compare the candidate by calculating distance from reference site to declaration site via nearest common prefix in the scope tree. This will involve finding the common parent node of two child nodes and how sum the distance from the common parent to the two child nodes. * Change the priority higher than 'getOverloadRank' * Don't evaluate the scope rank algorithm on generic If the candidate is generic function, the function parameters won't be checked before 'CompareOverloadCandidates', so it will results in that the candidates this function could be invalid. We should not evaluate the distance algorithm in this case, instead we will evaluate later when the candidate is in flavor of Func or Expr since then all the type checks for the function will be done.
2024-09-18Add `IRWArray` interface, and make StructuredBuffer conform to them. (#5097)Yong He
* Add `IRWArray` interface, and make StructuredBuffer conform to them. * Update user guide. * Fix. * Fixes.
2024-09-18Add WGSL pack/unpack, constructor, derivatives & misc intrinsics (#5102)Anders Leino
* Add WGSL pack/unpack intrinsics This addresses issue #5080. * Add WGSL constructor intrinsics This addresses issue #5081. * Add WGSL derivative and miscellaneous intrinsics This addresses issue #5083. * Add some missing WGSL intrinsics - degrees - faceforward
2024-09-17Fix WGSL frexp and modf that returns a struct (#5096)Jay Kwak
Two WGSL functions have little different behavior compared to other shader languages: frexp and modf. They return a struct to return two values.