https://github.com/shader-slang/slang

sort by:
Revision Author Date Message Commit Date
72f7ea6 Fix for `ConstantBuffer<T[...]>` causing a segfault (#4705) Fixes: #4704 Change the type we assign when getting the member variable of a legalized `ConstantBuffer<T[...]>`. 23 July 2024, 20:54:06 UTC
6216177 Print SPIRV validation error message (#4697) Closes #4692 This is a quick fix for the issue that SPIR-V validation error message is not printed. A more proper way is to return the error messages to the application and let the application handle it. 23 July 2024, 19:30:12 UTC
1670d7e Install the missing public headers in release package (#4712) In the change: 2db15080 Move the file public header files to `include` dir (#4636) we miss the installation of the public headers as they move to a new `include` folder, and cpack doesn't catch those automatically. Therefore, add the install command to install those headers. 23 July 2024, 17:15:27 UTC
986256f Feature/capture (#4625) * Add decoder * Add a replay executable to consume the decoded content Add file-processor.cpp/h where we implement the logic to process the captured file block by block. Each block is: function header + parameter buffer + function tailer + function output[optional]. After reading one block, the block of data is sent to decoder module to dispatch the corresponding API. Add slang-decoder.cpp/h where we implement the logic to dispatch the slang API according to the input block data. - Rename api_callId.h to capture-format.h - Renmae capture_utility.cpp to capture-utility.cpp - Renmae capture_utility.h to capture-utility.h - Change the #include file name accordingly. * Reorganize source files structure Move all the capture logic code into `capture` directory. - the capture code will be build with slang dll. Move all the replay logic code into `relay` directoy. - the replay code is not part of slang dll, it will be built as a stand alone binary and link against slang dll. Change the #include file names accordingly. Add tools/slang-replay/main.cpp for the slang-replay stand alone binary place holder. Will implement it later. Update premake5.lua accordingly. * Update cmake files Update cmake files to change the build process for capture and relay system. - capture component should be build with slang dll, so we should not include replay component. - replay component should be a separate executable tool, which should not include capture component. - In order to easy use our current cmake infrastructure, move the shared files to a `util` folder - change the header include path * Redesgin the interfaces of consumers Fix some issues in capture Finish implementing all slang-decoder functions * Fix the AppleClang build issue * Address few comments - Fix the weird indent issues. - Correct the function name for CreateGlobalSession() - Rename file-processor to captureFile-processor to be more specific. - Use Slang::List instead of std::vector * record/replay: name refactor change Refactor the naming. Change the name "encoder/capture" to "record". 23 July 2024, 15:45:26 UTC
c28d8b6 Warn if providing explicit bindings to a object using uniform locations (#4708) fixes: #4700 Changes: * If a uniform object (which uses uniform locations) has explicit bindings we will warn to use `ConstantBuffer<T>` instead. We check for a warning specifically when we know an object uses uniform layouts because objects may not use a uniform-layout register even if tagged with `uniform`. A good example of this is `uniform ConstantBuffer<T>`. 23 July 2024, 15:08:05 UTC
509bfd8 Simplify `CapabilitySet` Diagnostic Printing (#4678) Fixes: #4675 Fixes: #4683 Fixes: #4443 Fixes: #4585 Fixes: #4172 Made the following changes: 1. All capability diagnostic printing logic tries to simplify before printing. This means that we do not print atoms which imply another atom. 2. Do not print the `_` prefix part of atom names since it is misleading users on what they should use to solve a capability issue encountered. (`_Internal` `External` atom changes are not in this PR) 3. Bundle together printing of all sets which contain exactly the same atoms (excluding abstract atoms). This allows printing the following `vertex/fragment/hull/domain/... + glsl` instead of `vertex + glsl | fragment + glsl | hull + glsl | domain + glsl | ....` 4. Rework how entry-point errors are reported to users (example at bottom of PR comment) 5. Rework how atom-provenance data is collected to be leaner and more useful so we can rework the errors. There are 2 notable changes here: * We no longer store a list which describes where the first of an `CapabilityAtom` comes from. This heavily simplifies AST logic for the capability system. AST parsing of capabilities is much faster. The trade-off is faster AST parsing and correct AST node data for slower diagnostics if an error is found * atom-provenance data now stores a reference to an atom's use-site to provide information on **where** and **what** is wrong with user code versus only sharing **what** and not where. 23 July 2024, 13:36:38 UTC
15f091a Add Metal to user-guide/09-targets.md (#4703) * Add Metal to user-guide/09-targets.md Partially resolves #4262 The description of "Parameter passing" part for Metal is related to PR #4022 23 July 2024, 09:22:32 UTC
4ae58a7 Fix for invalid swizzle causing crash (#4690) * 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> 19 July 2024, 18:52:25 UTC
f114433 Support parameter block in metal shader objects. (#4671) * 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> 19 July 2024, 18:49:42 UTC
adf758c Fix the issue of name mangling (#4691) * 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 19 July 2024, 18:42:31 UTC
7488b15 Update COM support doc to reflect implemented status (#4682) Co-authored-by: Yong He <yonghe@outlook.com> 19 July 2024, 07:06:38 UTC
bf29336 Fix LLVM compile error on Windows (#4658) 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> 19 July 2024, 07:05:12 UTC
335c1a2 move autodiff-decoration-stripping-pass so it always runs (#4632) Co-authored-by: Yong He <yonghe@outlook.com> 19 July 2024, 07:04:12 UTC
a00d603 Metal: `Interlocked` (atomic) member function support for buffers (#4655) * 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> 19 July 2024, 06:05:33 UTC
59dd133 Allow CPP/CUDA/Metal to lower/legalize buffer-elements to support 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> 19 July 2024, 06:04:26 UTC
6e7c726 Warnings for uninitialized fields in constructors (#4680) * 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 19 July 2024, 00:43:19 UTC
831d796 Separating slang-test in CI for emit-spirv-via-glsl (#4665) * 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. 18 July 2024, 23:28:08 UTC
ce4ffc3 Support OpDebugTypePointer for struct member pointer (#4527) 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 18 July 2024, 22:20:42 UTC
be66cc8 Enable warnings-as-error for CI (#4659) 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. 18 July 2024, 21:31:27 UTC
ad379b7 Update spirv-header and spirv-tools to Jun/2024 (#4679) 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 18 July 2024, 20:21:12 UTC
1677a25 Fix bug with uninititialized warnings in nested scopes (#4677) Previously the warning system ignores undefined variables in nested scopes (blocks in IR). 18 July 2024, 18:13:26 UTC
0d06ebc Initial implementation for decl-tree reflection API (#4666) * 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 18 July 2024, 17:11:19 UTC
89e836d Correctly parse multiple escaped newlines (#4672) closes https://github.com/shader-slang/slang/issues/4667 18 July 2024, 16:29:43 UTC
3750a4d Add unexpected end of input error to lexer (#4673) * Add unexpected end of input error to lexer * Add end of input test * Simplify testcase 18 July 2024, 15:54:05 UTC
6f1371a Adjust how `slang` and `slangc` uses a `profile` to manage the stage of an 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 18 July 2024, 15:03:30 UTC
494efd7 Reduce duplication in slang lib builds (#4651) * 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 18 July 2024, 05:12:35 UTC
3c09271 Squash warnings on gcc and clang (#4669) 18 July 2024, 03:57:17 UTC
0368f00 Remove generated file from source and build at build time (#4649) * Remove generated file from source and build at build time * comments 18 July 2024, 03:27:42 UTC
62325bb Add slang-llvm and slang-glslang readmes (#4646) * Add slang-llvm and slang-glslang readmes Just extraced and updated from the original repos * Remove redundant file 18 July 2024, 03:20:20 UTC
32b1e25 Use slang-glslang.dll for spirv-validation (#4642) * 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 18 July 2024, 00:00:05 UTC
2db1508 Move the file public header files to `include` dir (#4636) * 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 17 July 2024, 17:53:19 UTC
7d07bd2 Fix latex rendering errors in auto-diff docs (#4668) * Fix latex renderer errors in auto-diff docs Adjusted latex expressions to suit Github's quirky markdown system Fixes #4381 * Update basics.md 17 July 2024, 15:39:59 UTC
f545ef3 Fix minimal-optimization flag with texture atomics (#4660) Co-authored-by: Yong He <yonghe@outlook.com> 16 July 2024, 22:21:51 UTC
05547e2 Warnings function parameters (#4626) * 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 16 July 2024, 21:54:53 UTC
b5174b4 Fix issue with synthesized `__init` methods not getting added to witness table (#4638) 16 July 2024, 20:16:02 UTC
12ecc43 SCCP instead of CFG since SCCP removes code of unused branches, not CFG (#4640) 16 July 2024, 15:35:46 UTC
6bcf92d gfx/metal uniform data binding and memory leak fix. (#4644) Co-authored-by: Yong He <yhe@nvidia.com> 16 July 2024, 05:23:10 UTC
bd6314d Move if_let syntax to convenience-features section (#4628) * 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 16 July 2024, 03:31:23 UTC
36e445b Fix release configuration for macOS. (#4629) 13 July 2024, 14:56:54 UTC
1a0bbb5 use `nullptr' for IRStructKey with `IRDerivativeMemberDecoration` (#4623) 12 July 2024, 15:46:38 UTC
0b6d78f Change IDefaultInitializableType to IDefaultInitializable (#4620) 12 July 2024, 13:54:22 UTC
1c86ccb Update CONTRIBUTION.md for path to slang-test.exe (#4619) The path to slang-test.exe has been changed recently and it needs to be updated on the document. 12 July 2024, 10:59:08 UTC
24f8999 Fix incorrect codegen when returning initializer list as existential value. (#4618) * Add `dev` cmake preset. * Fix incorrect codegen when returning initializer list as existential value. * Fix cmake. * Fixup. 11 July 2024, 23:12:41 UTC
977e4b2 Fix issue with synthesizing `Differential` type for self-differential 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 11 July 2024, 17:46:21 UTC
c3061af Fix missing include for static slang (#4614) 11 July 2024, 12:51:38 UTC
45baeb3 populate slang-tag-version with cmake (#4611) At the moment it is always "unknown" 11 July 2024, 11:52:54 UTC
57742cb Statically link MSVC runtime (#4613) * Statically link MSVC runtime * Statically link MSVC runtime for llvm 11 July 2024, 11:52:44 UTC
304f9f9 More precise handing of option dependencies (#4612) 11 July 2024, 11:52:16 UTC
055d4ac Implement 64-bit version of clockARB (#4571) * Implement 64-bit version of clockARB * Fix capability versions * Corrections to capabilities --------- Co-authored-by: Yong He <yonghe@outlook.com> 11 July 2024, 06:34:44 UTC
4ae755f Revert tag-version header removal. 11 July 2024, 05:41:45 UTC
ca95b93 Revert slang-tag-version include path. 11 July 2024, 05:36:51 UTC
0380fca Update badge link in. 11 July 2024, 05:32:00 UTC
6ed7e7f Cope with failed version parsing (#4609) * Cope with failed version parsing * Better version parsing * populate slang-tag-version with cmake * Neaten cmake 11 July 2024, 04:47:03 UTC
49c56d7 Make ci scripts more robust (#4608) * Remove syntax error in release script * Make ci scripts more robust * Remove lib copying * Add bin directory to RPATH 11 July 2024, 03:28:11 UTC
cc86174 revert release script change. (#4607) 11 July 2024, 02:48:26 UTC
a190846 release script: copy lib to bin. (#4605) 11 July 2024, 01:52:16 UTC
d94a748 Fix release script. (#4604) * Fix release script. * Macos release - sign binaries. 11 July 2024, 01:16:38 UTC
2f70448 Another fix in macos release script. (#4603) * Another fix in macos release script. * Fix. 11 July 2024, 00:18:41 UTC
c585278 Delete unused build scripts. (#4601) * Fix macos release script. * Delete shell scripts 10 July 2024, 23:45:27 UTC
5006f49 Update CONTRIBUTION.md after CI side changes (#4598) * Update CONTRIBUTION.md after CI side changes * Fix a typo --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 23:18:01 UTC
746d47b Specialize address space during spirv legalization. (#4600) * Specialize address space during spirv legalization. * Fix. * Fix building doc. * Fix cmake. * Update assert. 10 July 2024, 23:17:10 UTC
82f308c Fix the invalid spirv generation for matrix cast (#4588) Spirv doesn't have instruction to do the float cast for the matrix type. So we have to convert the matrix row by row, and then construct them to a new matrix. Update the unit test to make sure the cast won't miss any elements. Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 21:10:33 UTC
b89421c Add reflection API for functions. (#4587) * Add reflection API for functions. This change adds `SlangFunctionReflection` type in the reflection API that provides methods for querying function result type, parameters and user-defined attributes. `ProgramLayout::findFunctionByName` can now find a function with the given name and returns a `FunctionReflection`. `IEntryPoint` now has a `getFunctionReflection` method that returns an `FunctionReflection` for the entrypoint. * More modifiers; make reflection API consistent. 10 July 2024, 21:09:18 UTC
45ef0ce Fix lowering of associated types and synthesis of dispatch functions. (#4568) * Treat global variables and parameters as non-differentiable when checking derivative data-flow Global parameters are by-default not differentiable (even if they are of a differentiable type), because our auto-diff passes do not touch anything outside of function bodies. The solution is to use wrapper objects with differentiable getter/setter methods (and we should provide a few such objects in the stdlib). Fixes: #3289 This is a potentially breaking change: User code that was previously working with global variables of a differentiable type will now throw an error (previously the gradient would be dropped without warning). The solution is to use `detach()` to keep same behavior as before or rewrite the access using differentiable getter/setter methods. * Fix issues with lookup witness lowering * Update slang-ir-lower-witness-lookup.cpp * Add tests * Update slang-ir-lower-witness-lookup.cpp * Cleanup * Update nested-assoc-types.slang --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 20:49:41 UTC
16a4781 Add user guide section on user-defined attributes. (#4557) * Add user guide section on user-defined attributes. * Update toc 10 July 2024, 20:27:10 UTC
ff9437e Implement non member function atomic texture support (#4544) * Implement non member function atomic texture support texture_buffer and texture1d Fixes: #4538 Related to: #4291, fixes `tests/compute/atomics-buffer.slang` Texture objects cannot use `__getMetalAtomicRef` to cast objects into atomic value type. [Texture objects mandate use of member functions](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf#Texture%20Functions). The implementation is as follows: * We can detect texture object usage through checking for an `IRImageSubscript` Operation. `__isTextureAccess()` was added to evaluate if we have an `IRImageSubscript` operation at compile time (before `static_assert`). `__isTextureAccess()` only checks if we are targeting Metal. * We have all parameter data needed to call a texture atomic function embedded inside `IRImageSubscript`. `__extractTextureFromTextureAccess()` and `__extractCoordFromTextureAccess()` was added to extract this data for use with Metal atomics. Note: * Metal documentation has various incorrect details (function names) * Since we currently hardcode metal versions for compiling, the Metal compiler version was changed to target `Metal 3.1` (`slang-gcc-compiler-util.cpp`) * textures do not permit atomic float operations * add fallthrough attribute + fix bug with 'exchange instead of xor' + fix warning bug * incorrect function name fix * missing filecheck * disable atomics-buffer.slang compute test since GFX issue causing it to fail * Array support for metal interlockedAtomic and proper verification of texture with interlockedAtomic functions * Array support for metal interlockedAtomic * proper verification of texture with interlockedAtomic functions note: had to seperate many functions to allow forceInlining to run * missing getOperand(0) * push atomic fix for metal * fix atomic syntax for metal and hlsl emitting extra brackets (breaks tests) * test changes and meta changes 1. max is 8 rw textures with metal because Metal has this limit. Split up tests to not hit this limit 2. added back `[0]`...,`T` to test since this legalizes metal atomic intrinsic * macro'ify some of the atomic code 1. addresses review 2. makes code easier to modify in the future (rather than sifting through 1000 lines we can just look at ~10-30 * fix test 'check' * missing float support due to macro * add functions macro generates, `InternalAtomicOperationInfo` --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 20:25:51 UTC
a08ccfa Fixes to Metal Input parameters and Output value input/output semantics (#4536) * initial change to test with CI for CPU/CUDA errors * Fixes to Metal Input parameters and Output values Note: 1. Flattening a struct is the process of making a struct have 0 struct/class members. Changes: 1. Separated `legalizeSystemValueParameters`. This was done to make it easier to run `legalizeSystemValue` 1 system-value at a time to simplify logic. This change is optional and can be undone if not preferred. 2. Wrap everything inside a Metal legalization context. This was done since it simplifies a lot of logic and will be required for #4375 3. Created `convertSystemValueSemanticNameToEnum` and expanded the existing System-Value Enum system. This allows (sometimes) faster comparisons and helps prepare code for porting into `slang-ir-legalize-varying-params.cpp` (#4375) 4. Added a more dynamic `legalizeSystemValue` system so more than 2 types can be targeted for legalization. This is required to legalize `output`. There is still no preference for any converted type, the first valid type will be converted to. 5. Flatten all input(`flattenInputParameters`)/output(part of `wrapReturnValueInStruct`) structs and assign semantics accordingly. 6. Semantics when legalized have no specific logic other than to: 1. avoid overlapping semantics 2. Prefer assigning explicit semantics specified by a user. 7. Fixed some issue with incorrect output semantics if not a fragment stage (when there are not any assigned semantics) * change metallib test to the correct metal test * comment code & cleanup -- Did not address all review Added comments for clarity + cleaned up some odd areas which were messy * Add comment to `fixFieldSemanticsOfFlatStruct` I found `fixFieldSemanticsOfFlatStruct` to still be confusing at a cursory glance. Added comments to make the function be more understandable. * white space * Address review comments 1. Fix semantic propegation. 2. Fix how we map struct fields of the flat struct to struct. This is specifically important for if reusing the same struct twice since struct member info is not unique per struct instance used. * Fix semantic legalization by adding TreeMap Add TreeMap to allow proper sorted-object data iteration. * Fix some compile issues * try to fix gcc compile error * compile error * fix logic bug in treeMap iterator next-semantic setter * fix vsproject filters * filter file syntax error * remove need of a context to make copies stable * Rename treemap to the more appropriate name of "treeset", adjust code comments accordingly. * remove custom type `TreeSet` and use `std::set` * remove TreeMap fully --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 20:24:12 UTC
667e504 Add `float16` support to slang-torch (#4584) 10 July 2024, 20:19:06 UTC
28ca743 add GL_EXT_ray_tracing_position_fetch (#4566) 10 July 2024, 19:17:06 UTC
59343c1 Support status argument for GatherXXX (#4490) * Support status argument for GatherXXX This commit adds an argument to all texture GatherXXX functions. The new argument is for "status" as described in SM5.0 definision. Close #4466 Limit Gather with status to HLSL Exclude Gather-status test from VK * Fix capability errors --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 17:55:07 UTC
4a24724 Various fixes around differentiable member associations `[DerivativeMember(<diff-member>)]` (#4525) * Add diagnostic for missing diff-member associations + Automatically create diff member associations if differential type is the same as the primal type. + Move diff-member attribute checking to conformance-checking phase to avoid circularity issues. Fixes #4103 * Update slang-check-decl.cpp --------- Co-authored-by: Yong He <yonghe@outlook.com> 10 July 2024, 17:53:35 UTC
8ed0f49 Emit spirv insts in the right sections. (#4590) 10 July 2024, 17:41:53 UTC
f4fac59 Cope with bsd coreutils on osx in release script (#4597) 10 July 2024, 16:07:39 UTC
5c9ce37 A couple of small fixes to cmake releases (#4596) * Correct windows file uploading * Include slang-llvm.so in releases * Neaten job names 10 July 2024, 16:00:59 UTC
0e56999 WIP Drop Premake (#3703) * Remove premake lua * Remove premake generated vs project * remove deps file * Remove premake driving bat files * Full test matrix under CMake * Remove premake based ci workflows * Wiggle CI * remove cmake from ci name * find frameworks correctly on osx * remove cmake from ci name * Cope with sccache not being available * cmake based falcor tests * ci wobble * only install ninja if necessary * more appropriate cache name * Remove premake from build instructions * Add some docs on ci setup * remove premake from regression tests * remove premake from perf test * Set SLANGC_PATH * ci wobble * bump slang-binaries * ci wobble * Bump spirv tools * dont use timestamp in cache * remote debug code * cache key wobble * Install sccache after building llvm * Do not build llvm tools * ci wobble * ci wobble * ci wobble * ci wobble * ci wobble * Tests spirv via glsl in ci * Define SLANG_ENABLE_XLIB=1 * osx builds on aarch64 * ci wobble * ci wobble * ci wobble * ci wobble * ci wobble * ci wobble * package documentation and metadata with cmake * ci wobble * Split hlsl double intrinsic tests * ci wobble * Correct type for double log10 Fixes https://github.com/shader-slang/slang/issues/4549 * remove working test from expected failures * add broken test to expected failures * smaller build for falcor tests * ci wobble * A few exclusions in ci * wip, release script * Enable examples in ci * neaten release script * Correct building docs * Only use xlib vulkan when slang_enable_xlib is true * bump slang-llvm version * Remove toolchain file use * Bump slang-llvm preset version * slash direction * Improve build directions * Add msvc cross build documentation * Disable old release files * Smaller set of releases for test * Allow not building llvm * simplify release matrix * Cross releases * formatting * formatting * ci wiggle * ci wiggle * cleaner * neaten * ci wobble * formatting * Install cross tools on linux * do not clean build dir * neaten ci * neaten ci * neaten ci * remove unused release workflow files * Build llvm on some platforms * neaten ci * notarize on osx * s/x64/x86_64 * ci wobble * Embed stdlib for release build * wobble ci * wobble ci * s/x64/x86_64 * ci wobble * ci wobble * ci wobble * vk-gl-cts on cmake * neaten ci * neaten ci * bump cache action version * Cope with windows being weird about case * old glibc version * old glibc version * Correct action file * Keep cache hot on main branch * separate small script for old glibc releases * ci wobble * ci wobble * Run cmake outside of docker * only sign on releases * Revert "Run cmake outside of docker" This reverts commit a58aaba939a4aa35fe70962fd60d9512b143592f. * python3 on build image * less parallel * ci wobble * ci wobble * ci wobble * newer git * ci wobble * ci wobble * Use newer docker image * Use newer docker image * sccache wobble * permissions issue * neaten * build llvm in ci * build llvm in ci * Remove linux clang build in ci * Only install crossbuild tools on non-aarch64 systems * neaten ci.yml * Correct github matrix * Simplify github matrix * ci wobble * Disable broken test See https://github.com/shader-slang/slang/issues/4589 * ci wobble * Neater slang-llvm archive filename * Neater path for uploading artifacts * Neater ci names * Use Windows SDK 10.0.19041.0 in cmake builds 10 July 2024, 14:37:21 UTC
9f1ff45 Do not unnecessarily build llvm tools (#4594) 10 July 2024, 07:19:27 UTC
ca0181f Do not include vk xlib headers from vulkan.h when SLANG_ENABLE_XLIB is not set (#4593) 10 July 2024, 07:19:15 UTC
c06cc09 Include readme and license in release files (#4595) 10 July 2024, 07:18:48 UTC
97bd7e6 Add individual tests for scalar double intrinsics (#4591) 10 July 2024, 07:10:25 UTC
cde025e Neaten filecheck output for non-passing nested-parameter-block test (#4592) With this context filecheck can generate a better error when it fails 10 July 2024, 07:09:43 UTC
8dd4c30 Change to use cmake in centos7 build (#4572) 10 July 2024, 03:09:56 UTC
0e6c5c5 Warnings for uninitialized values (#4530) This extends the code for handling uninitialized output parameters. Still needs to handle generic templates and assignment of uninitialized values more carefully. The file containing the relevant code are now in source/slang/slang-ir-use-uninitialized-values.cpp rather than the previous source/slang/slang-ir-use-uninitialized-out-param.h and the top-level function is now checkForUsingUinitializedValues. Additionally a rudimentary test shader has been added for this case, which replaces the old file for out params only; tests/diagnositcs/uninitialized-out.slang becomes tests/diagnositcs/uninitialized.slang. What this does not implement (could be future PRs): * Checking uninitialized fields within constructors * Partially uninitialized values with respect to data structure (e.g. arrays/structs/vector types) * Partially uninitialized values with respect to control flow (e.g. if/else/loop) 09 July 2024, 23:18:36 UTC
1caef59 Fix Lexer to recognize swizzling on an integer scalar value (#4515) * Fix Lexer to recognize swizzling on an integer scalar value Close #4413 09 July 2024, 19:45:57 UTC
ddd14be Add documentation of the type system and decorations (#4470) 09 July 2024, 16:57:07 UTC
2941873 Add intrinsic for clock2x32ARB (#4563) 09 July 2024, 15:58:35 UTC
5a174df Fix the issue in emitFloatCast (#4559) * Fix the issue in emitFloatCast In emitFloatCast function, we only considered the input type is float scalar or float vector, so if the input type is a float matrix type, it will crash. We should also handle the float matrix type. Also, we add some diagnose info to point out the source location where there is error happened, so in the future it's easier to tell us what happens. * Add a unit test * Disable the test for metal Metal doesn't support 'double'. " metal 32023.35: /tmp/unknown-YgHAsJ.metal(15): error : 'double' is not supported in Metal matrix<double,int(3),int(4)> b_0 = matrix<double,int(3),int(4)> (a_0); " 09 July 2024, 04:34:51 UTC
a453fad Language server performance and document symbol fix. (#4561) 09 July 2024, 02:33:51 UTC
4a49769 Treat global variables and parameters as non-differentiable when checking derivative data-flow (#4526) Global parameters are by-default not differentiable (even if they are of a differentiable type), because our auto-diff passes do not touch anything outside of function bodies. The solution is to use wrapper objects with differentiable getter/setter methods (and we should provide a few such objects in the stdlib). Fixes: #3289 This is a potentially breaking change: User code that was previously working with global variables of a differentiable type will now throw an error (previously the gradient would be dropped without warning). The solution is to use `detach()` to keep same behavior as before or rewrite the access using differentiable getter/setter methods. 08 July 2024, 22:48:08 UTC
2cb65a8 correctly setting launch parameters should fix the test (#4551) 07 July 2024, 11:21:38 UTC
65194cf Add vector overloads for or and and (#4529) * Add vector overloads for or and and Closes #4441 and #4434 * Disable cuda checks which use unsupported bool vectors * Add tests for 4531 05 July 2024, 13:09:13 UTC
388de5f Correct type for double log10 (#4550) Fixes https://github.com/shader-slang/slang/issues/4549 05 July 2024, 13:01:46 UTC
40a4022 Add specializations for 1 vectors in functions using the $N glsl intrinsic placement (#4534) Closes #4533 Fixes part of #4531 05 July 2024, 07:05:52 UTC
42a9fce Add README.md and LICENSE to binary windows and macos packages (#4535) * Add missing README and LICENSE files to packages Add README.md and LICENSE to binary windows and macos packages. Fixes issue #4117 * Update macos.yml * Update release-macos.yml * Update windows.yml 03 July 2024, 23:25:37 UTC
d5d03d1 Emit errors when invalid capabilities are used (#4510) * Fix invalid capabilities being allowed fixes: #4506 fixes: #4508 1. As per #4506, no longer allow invalid `[require(...)]` 2. As per #4508, no longer allow mismatch between `case` and `require` of a calling function 3. Fixes incorrect hlsl.meta capabilities 4. Added a ref to the parent function/decl for when erroring with capabilities to help debug meta.slang files for when weird source locations are generated. * rename vars and copy lambdas by value * fix some more capabilities * incorrect capabilities on a texture test * push capabilities fix note: seperated capabilities for glsl,spirv,cuda,hlsl since not all functions support all targets (source of capability error) * fix cmd line arg by using `xslang` to passthrough to slangc * let auto-infer run for certain capabilities to reduce simple mistakes --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> 02 July 2024, 17:35:49 UTC
bd01bd3 Fix the type error in kIROp_RWStructuredBufferLoad (#4523) * Fix the type error in kIROp_RWStructuredBufferLoad In StructuredBuffer::Load(), we allow any type of integer as the input. However, when emitting glsl code, StructuredBuffer::Load(index) will be translated to the subscript index of the buffer, e.g. buffer[index], however, glsl doesn't allow 64bit integer as the subscript. So the easiest fix is to convert the index to uint when emitting glsl. * Add commit 02 July 2024, 03:06:58 UTC
fff79c3 Support HLSL `.sample` operators for MS textures (#4524) * Add `.sample` operator for MS texture types * Adding filecheck tests for `.sample` 01 July 2024, 23:01:21 UTC
6262569 Supply SPIRV capability for textureQueryLod (#4522) 01 July 2024, 22:00:50 UTC
6e55043 Error out when constructing tensor views from tensors with 0 stride. (#4516) This avoids a problem with broadcasted tensors. Our tensor-view platform is designed to allow unrestricted access to tensor memory, while broadcasted tensors were designed for 'read-only' use-cases. Trying to write into a broadcasted tensor needs re-allocation, which Slang is not designed to do. For now, we enforce contiguity on tensors with any 0 strides. In the future, we will introduce a ConstTensorView object to allow such tensors to be used as an input. This patch also propagates name-hint information through structs & arrays of tensors, to allow sensible names for the error messages (before this the error messages were temporary inst numbers, which is nearly impossible to debug) 01 July 2024, 18:50:04 UTC
0e71a6d Resource searching for examples (#4518) 01 July 2024, 17:08:04 UTC
d276ea3 Set debug working directory for slangc.exe (#4513) This commit changes the working directory setting in Visual Studio Debugging from "build" directory to the root of the repository. It is often the case that the users debug slang shaders under "tests" directory, and the working directory needs to be manually changed to the root directory of the repository. 01 July 2024, 16:26:53 UTC
back to top