summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-07-23Add Metal to user-guide/09-targets.md (#4703)Jay Kwak
* Add Metal to user-guide/09-targets.md Partially resolves #4262 The description of "Parameter passing" part for Metal is related to PR #4022
2024-07-19Fix for invalid swizzle causing crash (#4690)ArielG-NV
* Fix for invalid swizzle causing crash Fixes #4689 If swizzle code is provided 5+ element swizzle the checkSwizzleExpr code will do an out of bounds array access and crash. * switch test to check for to ensure no crash * cleanup swizzle errors to only emit once --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-19Support parameter block in metal shader objects. (#4671)Yong He
* Support parameter block in metal shader objects. * Ingore parameter block tests on devices without tier2 argument buffer. * Fix warning. * Fix texture subscript test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-07-19Fix the issue of name mangling (#4691)kaizhangNV
* Fix the issue of name mangle During our name mangling, we should add the direction of the parameter in the name, otherwise it could have the name collision which will result in invalid code generation: e.g. // in slang-module.slang export func(float a) { ...} // in test.slang extern func(inout float a); when we compile test.slang, slang will pass a pointer type to the 'func', however, in the slang-module.slang, `func` expects a value instead of pointer. This will lead the wrong spirv code. So we should add the parameter direction into the mangle name such that above two symbols will have the different mangled names, and we will catch this during IR-link stage. * Change to use to get param direction * Address few comments
2024-07-19Update COM support doc to reflect implemented status (#4682)Shannon Woods
Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-19Fix LLVM compile error on Windows (#4658)Jay Kwak
The following compile error is observed when build with LLVM on Windows: ``` D:/sbf/git/slang/test_wsl/source/slang-glslang/slang-glslang.cpp:39:31: error: static assertion expression is not an integral constant expression 39 | SLANG_COMPILE_TIME_ASSERT(SLANG_OFFSET_OF(TBuiltInResource, limits) > 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` To address the problem, SLANG_OFFSET_OF is defined as `offsetof` when `__clang__` is defined. Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-19move autodiff-decoration-stripping-pass so it always runs (#4632)ArielG-NV
Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-18Metal: `Interlocked` (atomic) member function support for buffers (#4655)ArielG-NV
* Metal: `Interlocked` (atomic) member function support for buffers fixes: #4654 fixes: #4481 1. Add `Interlocked` (atomic) member function support for buffers to Metal 2. Fix `__getEquivalentStructuredBuffer` so it works with CPP/Metal targets * add `CompareStore` support * legalize RWByteAddressBuffer to fully replace StructuredBuffer * destroy replaced byte-addr buffer * cleanup as per review and add comment to explain why certain code exists * fix flow of byte-address-buffer replacement * toggle on option to translate byteAddrBuffer to StructuredBuffer * cleanup unused buffers * add treatGetEquivalentStructuredBufferAsGetThis flag to treat getEquivStructuredBuffer as a byteAddressBuffer * comment to explain `treatGetEquivalentStructuredBufferAsGetThis` --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-18Allow CPP/CUDA/Metal to lower/legalize buffer-elements to support ↵ArielG-NV
column_major/row_major. (#4653) * Allow CPP/CUDA/Metal to legalize their buffer-elements. Fixes: #4537 Changes: 1. Matrix inputs require legalization (pack/unpack) to ensure consistent row_major/column_major throughout entire shader, the following enabled legalization pass fixes this. 2. Added missing CUDA intrinsic so CUDA can run more tests. 3. Added a memory packing test since this still fails for cpp/cuda/metal (due to having no memory packing enforcement). * change memory packing tests to run for targets without packing --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-18Warnings for uninitialized fields in constructors (#4680)venkataram-nv
* Detect uninitialized fields in constructors * Reachability check for early returns * Specialized warnings for synthesized default initializers * Handling quirks with constructors * Addressing review comments * Ignore synthesized constructors if they are not used
2024-07-18Separating slang-test in CI for emit-spirv-via-glsl (#4665)Jay Kwak
* Separating slang-test in CI for emit-spirv-via-glsl When CI test fails, we expect to see the error messages at the end of each section of CI testing result. But currently when "emit-spirv-via-glsl" fails, the error messages appear in the middle, which lead us to believe that there is no errors when you look only at the end of the result. This commit separates out the "emit-spirv-via-glsl" case to make the error message more visiable.
2024-07-18Support OpDebugTypePointer for struct member pointer (#4527)Jay Kwak
This change supports OpDebugTypePointer for a member variable whose type is a pointer type for the outer struct that hasn't been declared yet. It is done with new extension, "SPV_KHR_relaxed_extended_instruction", that comes with a new instruction, "OpExtInstWithForwardRefs". Closes #4304
2024-07-18Enable warnings-as-error for CI (#4659)Jay Kwak
Enable warnings-as-error for CI Closes #4664. Uses glslang commit that fixed a compiler warning Fixes a recent warning from external/CMakelist.txt A new macro, `SLANG_MAYBE_UNUSED` is added for a future need.
2024-07-18Update spirv-header and spirv-tools to Jun/2024 (#4679)Jay Kwak
The following external directories are updated. It is to use a new SPIRV keyword, "OpExtInstWithForwardRefs". Related to #4304 external/spirv-header: > commit 2acb319af38d43be3ea76bfabf3998e5281d8d12 > Author: Kévin Petit kevin.petit@arm.com > Date: Wed Jun 12 16:41:14 2024 +0100 > SPV_ARM_cooperative_matrix_layouts (#433) external/spirv-tools: > commit ce46482db7ab3ea9c52fce832d27ca40b14f8e87 > Author: Nathan Gauër brioche@google.com > Date: Thu Jun 6 12:17:51 2024 +0200 > Add KHR suffix to OpExtInstWithForwardRef opcode. (#5704) > The KHR suffix was missing from the published SPIR-V extension. > This is now fixed, but requires some patches in SPIRV-Tools. external/spirv-tools-generated: This is generated from spirv-tools
2024-07-18Fix bug with uninititialized warnings in nested scopes (#4677)venkataram-nv
Previously the warning system ignores undefined variables in nested scopes (blocks in IR).
2024-07-18Initial implementation for decl-tree reflection API (#4666)Sai Praveen Bangaru
* Initial implementation for decl-tree reflection API This patch adds Slang API methods for walking all the declarations in the AST. We expose this functionality through an abstract `DeclReflection` class that can be a type, function or a variable declaration. We also provide ways to cast the decl to a `FunctionReflection`, `TypeReflection` or `VariableReflection` and traverse through the child nodes (for instance, a struct type will have component variable declarations) This patch also adds `ISlangInternal` as an internal COM interface to allow us to cast IGlobalSession to the internal Session pointer while bypassing any wrappers (such as the capture interface) * Update slang.h * Remove `ISlangInternal` (its causing a diamond pattern w.r.t `ISlangUnknown`) and use `ComPtr` for proper ref management. * Update unit-test-decl-tree-reflection.cpp * Change `FunctionDeclBase` to use `DeclRef` instead of directly using the decl. * Update slang-reflection-api.cpp
2024-07-19Correctly parse multiple escaped newlines (#4672)Ellie Hermaszewska
closes https://github.com/shader-slang/slang/issues/4667
2024-07-18Add unexpected end of input error to lexer (#4673)Ellie Hermaszewska
* Add unexpected end of input error to lexer * Add end of input test * Simplify testcase
2024-07-18Adjust how `slang` and `slangc` uses a `profile` to manage the stage of an ↵ArielG-NV
entry-point (#4670) * Fixes #4656 Changes: 1. Setting a profile via slangc no-longer sets an entry-point target-stage, this is to allow slangc to follow how the SLANG-API works (else `main` is assumed to be the default entry-point) 2. If the stage specified by a profile is not equal to the stage specified by a entry-point, we throw a capability error. 3. Resolving the stage of an entry point was changed to function (mostly) equally for when 0 entry-points are specified versus to when there are 1 or more. 4. changed capabilitySet Iterator so it is invalid if backing data is nullptr (although this should never happen, it would stop crashes in the worst case). * remove the breaking change since it likely is going to be a lot more than just a simple change due to the implicit `main` and stage through `profile` code. * print out profile name with errors * use target's profile for printing * change logic to print warning in a different method (account for more cases) * set unknown stages
2024-07-18Reduce duplication in slang lib builds (#4651)Ellie Hermaszewska
* spelling * Reduce duplication in slang lib builds Closes (as much as possible) https://github.com/shader-slang/slang/issues/4615 The only case where we could actually make a difference would be an embedded stdlib and static slang, which isn't a configuration anyone actually uses. Nonetheless, clean up this bit
2024-07-17Squash warnings on gcc and clang (#4669)Ellie Hermaszewska
2024-07-18Remove generated file from source and build at build time (#4649)Ellie Hermaszewska
* Remove generated file from source and build at build time * comments
2024-07-18Add slang-llvm and slang-glslang readmes (#4646)Ellie Hermaszewska
* Add slang-llvm and slang-glslang readmes Just extraced and updated from the original repos * Remove redundant file
2024-07-17Use slang-glslang.dll for spirv-validation (#4642)Jay Kwak
* Use slang-glslang.dll for spirv-validation This change replaces the use of "spirv-val.exe" with an API call to "spvtools::SpirvTools::Validate()". Closes #4610
2024-07-17Move the file public header files to `include` dir (#4636)kaizhangNV
* Move the file public header files to `include` dir Close the issue (#4635). Move the following headers files to a `include` dir located at root dir of slang repo: slang-com-helper.h -> include/slang-com-helper.h slang-com-ptr.h -> include/slang-com-ptr.h slang-gfx.h -> include/slang-gfx.h slang.h -> include/slang.h Change cmake/SlangTarget.cmake to add include path to every target, and change the source file to use "#include <slang.h>" to include the public headers. The source code update is by the script like follow: ``` fileNames_slang=$(grep -r "\".*slang\.h\"" source/ -l) for fileName in "${fileNames_slang[@]}" do echo "$fileName" sed -i "s/\".*slang\.h\"/\"slang\.h\"/" $fileName done ``` * Fix the test issues * Fix cpu test issues by adding include seach path * Update cmake to not add include path for every target Also change "#include <slang.h>" to "include "slang.h" " to make the coding style consistent with other slang code. * Change public include to private include for unit-test and slang-glslang
2024-07-17Fix latex rendering errors in auto-diff docs (#4668)Sai Praveen Bangaru
* Fix latex renderer errors in auto-diff docs Adjusted latex expressions to suit Github's quirky markdown system Fixes #4381 * Update basics.md
2024-07-16Fix minimal-optimization flag with texture atomics (#4660)ArielG-NV
Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-16Warnings function parameters (#4626)venkataram-nv
* Handle out/inout functions with separate consideration * Fixing bug with passing aliasable instructions * Handle autodiff functions (fwd and rev) in warning system * Handling interface methods * Handling ref parameters like out/inout * Temporary fix to remaining bugs * Refactoring methods and tests * Recursive check for empty structs * Using default initializable interface in tests * Resolving CI fail
2024-07-16Fix issue with synthesized `__init` methods not getting added to witness ↵Sai Praveen Bangaru
table (#4638)
2024-07-16SCCP instead of CFG since SCCP removes code of unused branches, not CFG (#4640)ArielG-NV
2024-07-15gfx/metal uniform data binding and memory leak fix. (#4644)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2024-07-15Move if_let syntax to convenience-features section (#4628)kaizhangNV
* Move if_let syntax to convenience-features section * Fix the syntax for setting up an anchor * update the comment on sample code * Add example for if_let syntax * Address the comments
2024-07-13Fix release configuration for macOS. (#4629)Yong He
2024-07-12use `nullptr' for IRStructKey with `IRDerivativeMemberDecoration` (#4623)ArielG-NV
2024-07-12Change IDefaultInitializableType to IDefaultInitializable (#4620)ArielG-NV
2024-07-12Update CONTRIBUTION.md for path to slang-test.exe (#4619)Jay Kwak
The path to slang-test.exe has been changed recently and it needs to be updated on the document.
2024-07-11Fix incorrect codegen when returning initializer list as existential value. ↵Yong He
(#4618) * Add `dev` cmake preset. * Fix incorrect codegen when returning initializer list as existential value. * Fix cmake. * Fixup.
2024-07-11Fix issue with synthesizing `Differential` type for self-differential ↵Sai Praveen Bangaru
generic types (#4602) * Fix issue with synthesizing `Differential` type for self-differential generic types The problem was that we were using the type that was performing the lookup for `.Differential` which can have substitutions based on the local context where the decl is being referenced. We need to synthesize the type local to the decl itself * Update auto-differential-type-generic.slang
2024-07-11Fix missing include for static slang (#4614)Ellie Hermaszewska
2024-07-11populate slang-tag-version with cmake (#4611)Ellie Hermaszewska
At the moment it is always "unknown"
2024-07-11Statically link MSVC runtime (#4613)Ellie Hermaszewska
* Statically link MSVC runtime * Statically link MSVC runtime for llvm
2024-07-11More precise handing of option dependencies (#4612)Ellie Hermaszewska
2024-07-10Implement 64-bit version of clockARB (#4571)venkataram-nv
* Implement 64-bit version of clockARB * Fix capability versions * Corrections to capabilities --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-07-10Revert tag-version header removal.Yong He
2024-07-10Revert slang-tag-version include path.Yong He
2024-07-10Update badge link in.Yong He
2024-07-11Cope with failed version parsing (#4609)Ellie Hermaszewska
* Cope with failed version parsing * Better version parsing * populate slang-tag-version with cmake * Neaten cmake
2024-07-10Make ci scripts more robust (#4608)Ellie Hermaszewska
* Remove syntax error in release script * Make ci scripts more robust * Remove lib copying * Add bin directory to RPATH
2024-07-10revert release script change. (#4607)Yong He
2024-07-10release script: copy lib to bin. (#4605)Yong He