summaryrefslogtreecommitdiff
path: root/source/slang
AgeCommit message (Collapse)Author
2025-01-09[Auto-diff] Overhaul auto-diff type tracking + Overhaul dynamic dispatch for ↵Sai Praveen Bangaru
differentiable functions (#5866) * Overhauled the auto-diff system for dynamic dispatch * More fixes * remove intermediate dumps * Update slang-ast-type.h * More fixes + add a workaround for existential no-diff * Update reverse-control-flow-3.slang * remove dumps * remove more dumps * Delete working-reverse-control-flow-3.hlsl * Cleanup comments + unused variables * More comment cleanup * Add support for lowering `DiffPairType(TypePack)` & `MakePair(MakeValuePack, MakeValuePack)` * Fix array of issues in Falcor tests. * Update slang-ir-autodiff-pairs.cpp * More fixes for Falcor image tests * Small fixups. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-08Add parentheses to make precedence explicit (#6030)Anders Leino
* Add parentheses to make precedence explicit Add parentheses for a few cases that Dawn/Tint (WGSL compiler) complains about. Closes #6005. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-08Add SampleCmpLevel intrinsics (#6004)Darren Wihandi
* add SampleCmpLevel intrinsics * update tests * fix typo * fix broken glsl test * refactor SampleCmpLevelZero * fix metallib test * fix broken test on dx12 --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-07Lower varying parameters as pointers instead of SSA values. (#5919)Yong He
* Add executable test on matrix-typed vertex input. * Fix emit logic of matrix layout qualifier. * Pass fragment shader varying input by constref to allow EvaluateAttributeAtCentroid etc. to be implemented correctly.
2025-01-07 Check whether array element is fully specialized (#6000)kaizhangNV
* Check whether array element is fully specialized close #5776 When we start specialize a "specialize" IR, we should make sure all the elements are fully specialized, but we miss checking the elements of an array. This change will check the it. * add test * add all wrapper types into the check * add utility function to check if the type is wrapper type --------- Co-authored-by: zhangkai <zhangkai@zhangkais-MacBook-Pro.local> Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-07Use disassemble API from SPIRV-Tools (#6001)Jay Kwak
* Use disassemble API from SPIRV-Tools This commit uses C API version of SPIRV disassemble function rather than calling spirv-dis.exe. This allows us to use a correct version of SPIRV disassble function that Slangc.exe is using. The implementation is mostly copied from external/spirv-tools/tools/dis/dis.cpp, which is a source file for building spirv-dis.exe. This commit also includes a fix for a bug in RPC communication to `test-server`. When an RPC connection to `test-server.exe` is reused and the second test abruptly fails due to a compile error or SPIRV validation error, the output from the first test run was incorrectly reused as the output for the second test. This commit resets the RPC result before waiting for the response so that even when the RPC connection is erratically disconnected, the result from the previous run will not be reused incorrectly. Some of the tests appear to be relying on this type of behavior. By using an option, `-skip-spirv-validation`, the RPC connection will continue without an interruption.
2025-01-06Add support for textureLod with sampler2DArrayShadow (#6009)Julius Ikkala
2025-01-05Fix GLSL mix(T,T,bool) SPIR-V output (#6006)Julius Ikkala
2025-01-04Make 'shared' keyword map to 'groupshared' in GLSL mode (#6003)Julius Ikkala
2025-01-03Create DirectDeclRef when creating Decl to prevent invalid dedup. (#5945)Yong He
* Create DirectDeclRef when creating Decl to prevent invalid dedup. * Fix test. * fix * update slang-rhi
2025-01-03Fix parameter location reflection for pure data paramblocks. (#5956)Yong He
2025-01-02Correct IR generation for no-diff pointer type (#5976)kaizhangNV
* Correct IR generation for no-diff pointer type Close #5805 There is an issue on checking whether a pointer type parameter is no_diff, we should first check whether this parameter is an Attribute type first, then check the data type. In the back-propagate pass, for the pointer type parameter, we should load this parameter to a temp variable, then pass it to the primal function call. Otherwise, the temp variable will no be initialized, which will cause the following calculation wrong.
2025-01-01Fixed incorrect condition in Session::queryInterface. (#5978)Pétur Darri Pétursson
An AND operator was used where an OR should have been used.
2024-12-31add missing IR_LEAF_ISA for MetalMeshType (#5975)Darren Wihandi
Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-01Fix reflection for metal vector [[id]] location. (#5943)Yong He
2024-12-31Add terminateRayEXT & ignoreIntersectionEXT (#5974)Julius Ikkala
2024-12-31Fix `getInheritanceInfo` for `ExtractExistentialType`. (#5971)Yong He
2024-12-30Check for undefined %id in spirv_asm block. (#5966)Yong He
2024-12-30LanguageServer: fix highlighting of wrapper type. (#5968)Yong He
2024-12-30Add `RaytracingAccelerationStructure::__init(uint64_t)`. (#5967)Yong He
2024-12-30Check mismatching method parameter direction against interface declaration. ↵Yong He
(#5964)
2024-12-30Fix requirement candidate lookup to prefer decls in the same paraent as the ↵Yong He
inheritance decl. (#5965)
2024-12-30Skip uninitialized-use warning on hitAttributeEXT-decorated globals (#5952)Julius Ikkala
2024-12-29Prevent constant folding for specialization constants (#5953)Julius Ikkala
2024-12-28Implement HLSL pack/unpack math intrinsics (#5934)Darren Wihandi
2024-12-27Fix parsing GLSL SSBO arrays / bindless descriptors (#5932)Julius Ikkala
* Fix parsing GLSL SSBO arrays / bindless descriptors * Clean up SSBO array parsing * Fix mutable SSBO arrays not being detected as such * Allow sized SSBO arrays * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-26Add packed 8bit builtin types (#5939)Darren Wihandi
* Add packed bytes builtin type * fix test
2024-12-21Fixed stage and result field names in json reflection (#5927)Stan
2024-12-20Check subscript/property accessor for differentiability. (#5922)Yong He
2024-12-20Fix crash during loop unrolling. (#5920)Yong He
2024-12-19Add base vertex and base instance system values (#5918)Darren Wihandi
* Add base vertex and base instance system values * Fixed incorrect stage in tests
2024-12-19Add HLSL texture sample with status intrinsics (#5901)Darren Wihandi
* Implement HLSL texture sample with status intrinsics * fix test and cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-19Report error when generated spirv is empty. (#5899)Yong He
* Report error when generated spirv is empty. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-12-18Fix the parser issue for not recognize Generic<T>[N] (#5912)kaizhangNV
Close #5911. In this issue, if we define the generic in source file 1, and import it into source file 2, then when parsing the reference of that generic in source file 2, we will not parse the generic directly, instead we have a logic to speculate it as generics first with a fake diagnostic sink, and if there is no error report, we will consider it as a actual generic and will parse it again. In this logic, we will also disambiguate the expression based on the following token, but we didn't consider the token '[', so we will finally not treat the expression as generic. The fix is just simply add '[' here. Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-18Check decl nesting for namespaces. (#5910)Yong He
2024-12-18Support explicit `[vk::location(n)]` binding on metal/wgsl. (#5907)Yong He
2024-12-18Fix metadata of register space and varying params. (#5906)Yong He
2024-12-18Allow `Optional`, `Tuple` and `bool` to be used in varying input/output. (#5889)Yong He
* Allow `Optional` and `Tuple` to be used in varying input/output. * Fix. * format code * Fix. * Fix test. * Fix. * enhance test. * Fix. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-17Add verification logic on push and specialization constants. (#5887)Yong He
* Add verification logic on push and specialization constants. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-17Support specializing generic entrypoints in `findAndCheckEntryPoint`. (#5890)Yong He
2024-12-17Implement bitcast for 64-bit date type (#5895)kaizhangNV
Close #5470 * implement bitcast for 64-bit date type * Move 'ensurePrelude' to base class to remove duplication * Assert on 'double' type for Metal target, as Metal doesn't have 'double' support
2024-12-17Fix entrypoint auto discovery logic. (#5885)Yong He
* Fix entrypoint auto discovery logic. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-18Fix `getArgumentValueFloat` when arg is int. (#5888)Yong He
* Fix `getArgumentValueFloat` when arg is int. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-16Support matrix negation in metal backend. (#5891)Yong He
2024-12-15Enable exprs for all supported GLSL layout qualifiers (#5857)Darren
2024-12-12Bit extract (#5847)kaizhangNV
* promoting bitfield extraction and insertion to become intrinsics for internal compiler use * removing duplicate intrinsics from glsl.meta.slang * refactor: update function signatures of bitfield extraction and insertion to use uint as the parameter type for offset and bits. --------- Co-authored-by: Nate Morrical <natemorrical@gmail.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-12WGSL: Fix issue where global calls are generated (#5768)Anders Leino
* Split out SPIR-V -specific legalization of global functions This is a refactoring and should not affect generated code. * Move global inst inlining code into separate function This is a refactoring and should not affect generated code. * Take SPIR-V -specific parts out of GlobalInstInliningContext This is a refactoring and should not affect generated code. * Move 'inlineGlobalValues' to generic inlining context This is a refactoring and should not affect generated code. * Move 'setInsertBeforeOutsideASM' to generic inlining context This is a refactoring and should not affect generated code. * Move generic inlining context into own file This is a refactoring and should not affect generated code. * Run global inlining for WGSL as well * Make the 'getOutsideASM' function generic as well * Enable language-feature/constants/static-const-in-generic-interface.slang for WebGPU * Clarify when it's safe to remove and deallocate an IRInst * Remove globals if they're left unused after inlining This closes #5607. * Handle IRGlobalValueRef in C-like emitter * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-11Fix language server check skipping when explicit module decl exists. (#5845)Yong He
2024-12-12Bump spirv-header/tools/glslang (#5834)Ellie Hermaszewska
* Back out "Update SPIRV submodules (#5815)" This backs out commit e50aac13e2c161d672b137a62f6d66820d0f9ff1. * Use upstream spirv-tools * Fix bump-glslang.sh for newer versions of spirv-tools * Use upstream glslang * Add --do-fetch option to bump glslang * Bump glslang and friends Supersedes https://github.com/shader-slang/slang/pull/5815 * Regenerate glslang and spirv-tools outputs * Fixes to slang-glslang * Correct spirv intrinsic for OpImageSampleFootprintNV Note that this currently fails validation with the following error: ``` error: line 145: Result <id> from OpSampledImage instruction must not appear as operand for OpImageSampleFootprintNV, since it is not specified as taking an OpTypeSampledImage. Found result <id> '55[%sampledImage]' as an operand of <id> '56[%resultVal]'. %sampledImage = OpSampledImage %54 %51 %40 ``` This seems to be in error as the spec for *SPV_NV_shader_image_footprint* states that "Sampled Image must be an object whose type is OpTypeSampledImage" https://refined-github-html-preview.kidonng.workers.dev/KhronosGroup/SPIRV-Registry/raw/refs/heads/main/extensions/NV/SPV_NV_shader_image_footprint.html glslang also seems to fail with the same validation error * Fix spv storage class test
2024-12-11LSP: fix "documentSymbol failed" error. (#5842)Yong He