summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-08-28Remove the embedded source to avoid self-matching in slang-test (#8305)Jay Kwak
When `SIMPLE` type test is used with `-g[1-3]` option, the filecheck pattern will most likely to match to the string itself on the embedded source code rather than match to the emitted spirv-asm code. This commit avoids the problem by removing the embedded source code. This commit also provides an option to keep the embedded source code, `-preserve-embedded-source`. The source code removal is happening in two steps: 1. iterate all output lines and find SPIRV-ASM in the following pattern: `%N = OpExtInst %void %M DebugSource %fileId %sourceId`. And then, store the "%sourceId" value to identify which SPIRV instructions are for the embedded source code. 2. iterate all output lines again to find the `%sourceId = OpString "...."` and replace the whole string with the following string, ``` %1 = OpString "// slang-test removed the embedded source // Use `-preserve-embedded-source` to keep it explicitly " ``` This change revealed problems in the existing tests: - tests/bugs/spirv-debug-info.slang : The expected text was missing and it had to be added. The file also had Carrage-Return character on all lines and the pre-commit git hook removed them. - tests/spirv/debug-info.slang : the expected keyword DebugValue had to change to DebugDeclare, because that's what we get with ToT. - tests/spirv/debug-value-dynamic-index.slang : This test is currently failing, and it will pass once DebugLocalVariable instruction missing for parameter of the entry point function #7693 is resolved. --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
2025-08-28[Documentation] optix test coverage #463 (#8311)Harsh Aggarwal (NVIDIA)
Update docs/shader-execution-reordering.md with additional intrinsics Add correct capability `LoadLocalRootTableConstant`
2025-08-28Add SPIRV OpCapability for 8/16bit use in storage (#8194)James Helferty (NVIDIA)
Emits the appropriate OpCapability for 8- and 16-bit type usage: - UniformAndStorageBuffer8BitAccess: for 16-bit types in SpvStorageClassUniform and SpvStorageClassStorageBuffer - UniformAndStorageBuffer16BitAccess: for 16-bit types in SpvStorageClassUniform and SpvStorageClassStorageBuffer - StoragePushConstant8: for 8-bit types in SpvStorageClassPushConstant - StoragePushConstant16: for 16-bit types in SpvStorageClassPushConstant - StorageInputOutput16: for 16-bit types in SpvStorageClassInput and SpvStorageClassOutput Generated with Claude Code, with revisions. Fixes #7879. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: James Helferty (NVIDIA) <jhelferty-nv@users.noreply.github.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-26Fail slang-test when VVL printed errors (#8280)Jay Kwak
fixes https://github.com/shader-slang/slang/issues/8271 This PR does the following, - Fail slang-test when there are VVL error messages. - VVL error for `gfx-unit-test-tool/` were not captured properly by the debug callback. - Set an environment variable, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, for CI and VisualStudio project setup. - Ignores VVL error about NullHandle is used for the acceleration structure; a fix is at ToT of VVL and not available from release build yet. - Fix VVL error complaining about the varying inputs are not provided for the tests, `gfx-unit-test-tool/linkTimeTypeLayout.internal` and `gfx-unit-test-tool/linkTimeTypeLayoutNested.internal`. --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-26Fix Metal 8-bit vector type names: emit char/uchar instead of int8_t/uint8_t ↵Copilot
(#8223) The Metal backend was generating incorrect type names for 8-bit vector types, causing compilation failures when targeting Metal. According to the Metal specification, 8-bit vector types should be named `charN` and `ucharN` (e.g., `char2`, `uchar3`) rather than `int8_tN` and `uint8_tN`. ## Problem When compiling Slang code with 8-bit vector types for Metal, the compiler would emit: ```metal uint8_t2 _S8 = uint8_t2(uint8_t(0U), uint8_t(16U)); int8_t3 _S9 = int8_t3(int8_t(0), int8_t(16), int8_t(48)); ``` But the Metal compiler expects: ```metal uchar2 _S8 = uchar2(uint8_t(0U), uint8_t(16U)); char3 _S9 = char3(int8_t(0), int8_t(16), int8_t(48)); ``` This caused errors like: ``` error: unknown type name 'uint8_t2'; did you mean 'uint8_t'? ``` ## Solution Modified `MetalSourceEmitter::emitSimpleTypeImpl()` to emit the correct Metal-specific type names for 8-bit types: - `kIROp_Int8Type` now emits `char` instead of `int8_t` - `kIROp_UInt8Type` now emits `uchar` instead of `uint8_t` This change only affects the Metal backend and ensures that vector types like `int8_t2`, `uint8_t3`, etc. are correctly emitted as `char2`, `uchar3`, etc. ## Testing - Added a new test case `tests/metal/8bit-vector-types.slang` to verify the fix - Re-enabled the previously disabled Metal test in `tests/hlsl-intrinsic/countbits8.slang` - Updated `tests/metal/byte-address-buffer.slang` to expect the correct type names - Verified that existing Metal tests continue to pass Fixes #8211. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bmillsNV <163073245+bmillsNV@users.noreply.github.com>
2025-08-26Update slang-rhi deps for gfx-unit-test (#8237)Gangzheng Tong
This PR marks the `slang-rhi` a required dependecy for `platform` and `gfx-unit-test`, and only build them when `SLANG_ENABLE_SLANG_RHI=ON`. This should allow the slang still to be built without those tests components when `SLANG_ENABLE_SLANG_RHI=OFF`. --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-26Fix `shouldEmitSPIRVDirectly` (#8019)ArielG-NV
Fixes: #8018 Changes: * Do not emit true for `shouldEmitSPIRVDirectly` with a GLSL target
2025-08-26Fix warnings from CMake version 3.31 (#8227)Sam Estep
CMake 3.31 (released [last November](https://www.kitware.com/cmake-3-31-0-available-for-download/)) deprecated compatibility with CMake versions older than 3.10, causing warnings when running commands like `cmake --preset default` in the Slang repo: ``` CMake Deprecation Warning at external/miniz/CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.10 will be removed from a future version of CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. CMake Deprecation Warning at external/lz4/build/cmake/CMakeLists.txt:13 (cmake_minimum_required): Compatibility with CMake < 3.10 will be removed from a future version of CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. ``` Those dependencies modified their `cmake_minimum_required` calls in lz4/lz4#1601 and richgel999/miniz#344 respectively to fix those warnings, so this PR bumps them both to include those changes. Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-26fix a autodiff crash (#8259)kaizhangNV
close #8068. Currently the AutoDiff aggressively scan every IR inst in searching the differentiable IR. This is not efficient and could have bug, details in https://github.com/shader-slang/slang/issues/8068#issuecomment-3214856668. This PR change the behavior. It will do a initial filter to only gather the global differentiable IRs and IRFunc and IRGeneric as well. For IRGeneric, we will pick it only when it's used in other generic function (it's only useful when dealing with dynamic dispatch). Then we will start searching reachable insts from this IR list by using the same method as before.
2025-08-25Add WASM platform support to release workflow (#8264)David A Roberts
This is a first pass at adding WASM builds to releases. ~~I haven't tested the outputs yet but it appears to build successfully in my fork at least.~~ Edit: Made a fake release in my fork for testing, seems to be working well for my use case at least: https://github.com/davidar/slang/releases/tag/v2025.999 Fixes #8207
2025-08-25Print GPU driver version in CI.yml (#8275)Jay Kwak
This commit prints an additional information of GPU version while running CI.yml. This can help us to debug when things don't work as expected.
2025-08-25Fix#8084: Batch-8: Enable cuda tests (#8268)Harsh Aggarwal (NVIDIA)
2025-08-25Fix#8083: Batch-7: Enable cuda tests (#8267)Harsh Aggarwal (NVIDIA)
2025-08-25Fix#8082: Batch-6: Enable cuda tests (#8266)Harsh Aggarwal (NVIDIA)
2025-08-25Fix#8081: Batch-5: Enable cuda tests (#8263)Harsh Aggarwal (NVIDIA)
2025-08-25Fix#8080: Batch-4: Enable cuda tests (#8261)Harsh Aggarwal (NVIDIA)
2025-08-22Fix mesh shader OutputIndices subscript error by adding missing ref accessor ↵Lujin Wang
(#7929) Fixes the Slang compiler internal error "subscript had no getter" when reading from mesh shader output index arrays (e.g., `triangles[0].x`). ## Problem The `OutputIndices` struct was missing a `ref` accessor in its `__subscript` implementation, causing the compiler to fail when trying to materialize subscript expressions as r-values. ## Solution Added the missing `ref` accessor to `OutputIndices.__subscript` using the `kIROp_MeshOutputRef` intrinsic operation, matching the pattern used in `OutputVertices` and `OutputPrimitives`. ## Files Changed - `source/slang/core.meta.slang` - Added missing `ref` accessor - `tests/bugs/gh-7925.slang` - Test case to reproduce and verify the fix Fixes #7925 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Lujin Wang <lujinwangnv@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-22Fix readlink missing include (#8260)TheGoldMonkey
On Linux, `slang-platform.cpp` compiles with libstdc++ only because `unistd.h` is being transitively included. It fails to compile with standard libraries that don't include `unistd.h` like libc++. This is the how it's being transitively included with libstdc++: ``` /home/mcvm/dev/slang/source/core/slang-platform.h /home/mcvm/dev/slang/source/core/../core/slang-string.h /home/mcvm/dev/slang/source/core/../core/slang-hash.h /home/mcvm/dev/slang/external/unordered_dense/include/ankerl/unordered_dense.h /usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/memory /usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/shared_ptr_atomic.h /usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/atomic_base.h /usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/atomic_wait.h /usr/include/unistd.h ``` Tested building with `-stdlib=libc++` and `-stdlib=libstdc++`.
2025-08-21Add record and replay support for IComponentType2 (#8215)jarcherNV
Add record and replay support for the IComponentType2 struct and its functions getTargetCompileResult and getEntryPointCompileResult.
2025-08-21Fix SLANGC_EXECUTABLE search path in slangConfig.cmake (#8200)Sergei Kachkov
This patch changes the order of searching slangc executable. This bug affects the following scenario: let's assume that user has a binary release of slang package and wants to use it via `find_package(slang CONFIG HINTS <path to binary release>)`, but there is also an environment variable that points to some other slang release (e.g. user has Vulkan SDK in the `$PATH`). In that case, find_package will successfully find a desired slang package, but find_program in slangConfig.cmake will check environment variable first, and in the result SLANGC_EXECUTABLE will point to slangc from Vulkan SDK and not from the downloaded package. Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-21Fix reflection JSON writing userAttribs section twice for some cases. (#8210)MindSpunk
`emitReflectionVarLayoutJSON` will output the `userAttribs` section twice as it gets output by `emitReflectionModifierInfoJSON` first before being output again by a direct call to `emitUserAttributes`. It seems the answer here is to just remove the extra explicit call to `emitUserAttributes` and rely on the call in `emitReflectionModifierInfoJSON`?
2025-08-21Introduce CDataLayout & -fvk-use-c-layout (#8136)Julius Ikkala
Closes #8112. ~~The issue asks for a "C layout", but in this PR I use the term "CPU layout" because this naming was pre-existing in the codebase as `kCPULayoutRulesImpl_`. The primary purpose of this layout is to match CPU-side struct definitions with the shader side. I'm open to better naming suggestions, though.~~ Edit: switched back to using `CDataLayout` & `-fvk-use-c-layout`, as the CPU target depends on the object layout rules of existing CPU layout rules, but they're incompatible with actual shaders. So a new `kCLayoutRulesImpl_` was needed anyway. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-21Implement SV_VulkanSamplePosition (#8236)davli-nv
-Adds semantic SV_VulkanSamplePosition that emits corresponding gl_SamplePosition and SpvBuiltinSamplePosition -Adds gl_SamplePosition property to glsl.meta.slang -Adds SPIRV and GLSL tests for the semantic and property -Plan is to later implement SV_SamplePosition that follows HLSL range of -0.5 to +0.5, and emits GetRenderTargetSamplePosition(SV_SampleIndex) which needs more complicated IR manipulation for HLSL and Metal Fixes #7906 --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
2025-08-20Fix nextafter() (#8195)Julius Ikkala
Fixes #8185. The previous implementation is incorrect and basically only works in the `x = 0` case. `delta` was the smallest possible positive value representable as a float, but that's below the rounding error of addition with almost all reasonably sized floats. This fixed implementation is based on bit twiddling instead. I've checked the float case against the C++ `nextafterf` with both a -inf -> inf and inf -> -inf sweep, in addition to the test included in this PR.
2025-08-20Add more system dependency options to CMake (#7987)Niklas Korz
Allows opt-in for sourcing the following dependencies from the system, instead of using the vendored ones: - miniz - lz4 - vulkan-headers - spirv-tools - glslang (some of these already had options that weren't working, as either it expected them to be static libraries or it was expecting to be embedded in another CMakeList that should provide the package, instead of finding the package itself) This is based on a patch we currently maintain inside nixpkgs, but as it frequently conflicts with new slang releases, it would be nice to see get this upstream. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Sam Estep <sam@samestep.com>
2025-08-20Add Metal support for WaveGetActiveMask and WaveActiveCountBits (#8218)Tianyu Li
## Summary - Add Metal platform support for `WaveGetActiveMask()` and `WaveActiveCountBits()` wave intrinsics - Update capability requirements to include Metal platform for subgroup ballot operations - Implement Metal-specific intrinsic assembly using `simd_ballot()` and `simd_vote` APIs ## Changes - **source/slang/hlsl.meta.slang**: - Add Metal target case for `WaveGetActiveMask()` using `simd_ballot(true)` - Update capability requirements from `cuda_glsl_hlsl_spirv` to `cuda_glsl_hlsl_metal_spirv` for wave ballot functions - **source/slang/slang-capabilities.capdef**: - Add `metal` to `subgroup_ballot_activemask` capability alias
2025-08-20Enabling via-glsl test for "merge" event (#8133)Jay Kwak
There was a case where a PR passed CI test a long time ago, and when it is merged, it caused a regression. We like to run via-glsl test when it gets merged to prevent it.
2025-08-20Reduce the dependency to thread library (#8216)Jay Kwak
Slang compiler doesn't use thread and we should declare the dependency to the thread library when we don't need it. The use of Thread is limited to the tools such as slang-test.
2025-08-20Updated support to enable batch3 (#8219)Harsh Aggarwal (NVIDIA)
Enable CUDA support for batch 3 tests - Enhanced wave operations with exclusive support - Added proper identity values for min/max operations - Fixed intrinsic name mapping issues - Updated test configurations Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-20Fix#8076 - Re-enable slangpy test (#8087)Harsh Aggarwal (NVIDIA)
Commit bdda8a9 from PR #7862 had to disable some slangy tests in ci.yml
2025-08-19Add multiple slang installations note to doc (#8231)Gangzheng Tong
Added a note section under the Installation section that warns users about potential conflicts when multiple Slang installations are present on the system. The note specifically addresses: * The scenario where Slang from Vulkan SDK might conflict with a standalone installation * How LD_LIBRARY_PATH on Linux overrides the RUNPATH in the slangc executable Closes https://github.com/shader-slang/slang/issues/7405
2025-08-19CMake: Guard inclusion of VULKAN_HEADERS and SPIRV-Headers (#8124)Sergei Popov
Don't include the VULKAN_HEADERS and SPIRV-Headers submodule if they are already included. Fix for the https://github.com/shader-slang/slang/issues/7898. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2025-08-18Emit descriptor handle correctly for ParameterBlock<DescriptorHandle> (#8206)Gangzheng Tong
In Metal, if `ParameterBlock` contains `DescriptorHandle` directly, it would be emitted as DescriptorHandle literal, which is not valid Metal code, This fix adds a case for `kIROp_DescriptorHandleType` and directs it to the Parent's `emitType` function to handle it.
2025-08-18Fix error in IR stable names Git diff CI script (#7954)Sam Estep
#7644 added a script that gets run in CI to display a human-readable diff if `source/slang/slang-ir-insts-stable-names.lua` needs to be updated. However, the `git diff` commands in that script are wrong, causing it to instead just display the man page for the `git diff` command; [here's an example](https://github.com/shader-slang/slang/actions/runs/16578560460/job/46888822691): ``` === Updating stable names === Added 1 new instructions to source/slang/slang-ir-insts-stable-names.lua === Diff of changes made === usage: git diff --no-index [<options>] <path> <path> Diff output format options ``` (followed by many lines) This PR fixes the script. Here's an example showing it working correctly after the fix: - https://github.com/shader-slang/slang/actions/runs/16578977233/job/46890240012 - https://github.com/shader-slang/slang/actions/runs/16578977233 Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-18Make LLDB IR data formatters more robust (#7927)Sam Estep
This is a followup on #7828 to fix bugs that were causing CodeLLDB to give wrong values and hang (see vadimcn/codelldb#1302) because I didn't realize that these data formatters can be passed _either_ a value of a given type _or_ a pointer to a value of that type, and need to handle both cases. I also introduced loop bounds to prevent hangs in the case where these synthetic values are constructed for things like uninitialized variables. From looking at the preexisting data formatters from #4272 in `source/core/core_lldb.py`, it seems like they _technically_ have similar bugs to this, but since those types are simpler, it's unclear to me whether that can actually manifest in meaningful ways like these bugs in `source/slang/slang_lldb.py` were doing. Anyways, to test this, put a breakpoint here: https://github.com/shader-slang/slang/blob/6d399804a353154259cf4410940f144db8f9b5cf/source/slang/slang-emit-cpp.cpp#L1733 And use this `.vscode/launch.json` for CodeLLDB: ```json { "version": "0.2.0", "configurations": [ { "name": "LLDB", "preLaunchTask": "Debug build", "type": "lldb", "request": "launch", "initCommands": ["command source .lldbinit"], "program": "build/Debug/bin/slangc", "args": [ "tests/cpu-program/cpu-hello-world-test.slang", "-target", "executable", "-o", "hello" ] } ] } ``` Before this PR, the `inst` variable will display in the debug pane as `{kIROp_StringLit 0x00007fffffff5f68}`, which is the wrong pointer value. You can also check this by running `p inst` in the Debug Console, which will print this: ``` (Slang::IRInst *) 0x000055555fdac3b8 {kIROp_StringLit 0x00007fffffff5f68} ``` In contrast, running `p *inst` prints the correct pointer value: ``` (Slang::IRInst) {kIROp_StringLit 0x000055555fdac3b8} { [op] = kIROp_StringLit [UID] = 76 [type] = 0x000055555fdac348 {kIROp_StringType None} [decorations/children] = {} [parent] = 0x000055555fdac2d0 {kIROp_ModuleInst None} [uses] = 0x000055555fdadf18 {kIROp_StringLit 0x000055555fdac3b8} } ``` But as you can see, in that case the synthetic `[value]` child is completely missing. Then if you try to expand `inst` in the debug pane, CodeLLDB will hang (or at least it does when I try this). After this PR, the hex integer for the pointer is always consistent, and CodeLLDB does not hang in the debug pane when you expand `inst`, and shows the correct `[value]` child just like when running `v *inst`. As an aside: after this PR, the `[value]` child is still missing when specifically running `p *inst` in the Debug Console. It _is_ possible to fix this: ```diff diff --git a/source/slang/slang_lldb.py b/source/slang/slang_lldb.py index 23905d8c5..d2b3a4da9 100644 --- a/source/slang/slang_lldb.py +++ b/source/slang/slang_lldb.py @@ -93,13 +93,11 @@ class IRInst_synthetic(lldb.SBSyntheticValueProvider): value: list[tuple[str, lldb.SBValue]] = [] match op.value: case "kIROp_StringLit": - string_lit_t = target.FindFirstType("Slang::IRStringLit") - string_lit = self.valobj.Cast(string_lit_t) + string_lit = self.valobj.EvaluateExpression("(Slang::IRStringLit*)this") val = string_lit.GetChildMemberWithName("value") value = [("[value]", val.GetChildMemberWithName("stringVal"))] case "kIROp_IntLit": - int_lit_t = target.FindFirstType("Slang::IRIntLit") - int_lit = self.valobj.Cast(int_lit_t) + int_lit = self.valobj.EvaluateExpression("(Slang::IRIntLit*)this") val = int_lit.GetChildMemberWithName("value") value = [("[value]", val.GetChildMemberWithName("intVal"))] diff --git a/typings/lldb.pyi b/typings/lldb.pyi index 2672ba244..3a08e9141 100644 --- a/typings/lldb.pyi +++ b/typings/lldb.pyi @@ -496,7 +496,7 @@ class SBValue: def Persist(self): ... def GetDescription(self, description): ... def GetExpressionPath(self, *args): ... - def EvaluateExpression(self, *args): ... + def EvaluateExpression(self, expr: str) -> SBValue: ... def Watch(self, *args): ... def WatchPointee(self, resolve_location, read, write, error): ... def GetVTable(self): ... ``` However, that makes the debugger run _significantly_ slower, so I'm choosing not do do it here. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-18Don't let clang-format reorder Fiddle `#include`s (#7887)Sam Estep
The documentation added by #6844 included instructions to make sure that the Fiddle `#include` in a file comes after all the other `#include`s, but it's easy to accidentally violate this via `clang-format`, as happened for `source/slang/slang-ast-modifier.h` in #7559. This PR guards against this sort of violation by separating all Fiddle `#include`s from other `#include`s via a blank line followed by a `//` line (as we already do in most cases), and also adds a sentence about this in `tools/slang-fiddle/README.md`. As a bonus, I also enabled Markdown syntax highlighting for all the code blocks in that doc file. Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-08-18Fix issue of double lowering issue a differentiable function (#8182)kaizhangNV
Close #8054. For detailed root cause is at: https://github.com/shader-slang/slang/issues/8054#issuecomment-3189579508
2025-08-18Fix constructor overload ambiguity with scalar and vector parameters (#8109)Copilot
Close #8090. When we do type coerce, we use a cache to store the conversion cost of different type. The key of the cache is defined by struct BasicTypeKey { uint32_t baseType : 8; uint32_t dim1 : 4; uint32_t dim2 : 4; ... } where dim1 and dim2 is used for dimension of vector and matrix. However the dim is only 4 bits, so `vector<int, 16>` will have the same key as `int`, which is wrong. Fix the issue by extending it to 8 bit. Also to make the hash key still within 32 bits, we adjust baseType to 5 bits, and knownConstantBitCount to 6 bits. --------- Co-authored-by: kaizhangNV <kazhang@nvidia.com>
2025-08-18Show usage of `FIDDLE END` in Fiddle doc example (#7888)Sam Estep
Similar to #7887, this PR improves the Fiddle docs a bit by showing how the `FIDDLE TEMPLATE` example would actually need to include `FIDDLE END` at some point after `FIDDLE OUTPUT`.
2025-08-18Enable CUDA Test Enablement - Batch 1: Autodiff Tests (1-16) (#8139)Harsh Aggarwal (NVIDIA)
2025-08-17Update capability atoms reference page (#8138)Sam Estep
This file is automatically overwritten by the build: https://github.com/shader-slang/slang/blob/b7df3c7aa27301f88e31ed0a7bbf230688adab6a/source/slang/CMakeLists.txt#L68-L78 It is currently out of date (running the build gives rise to unstaged changes), so this PR updates it.
2025-08-15Update cuda context creation to support cuda 13 (#8181)jarcherNV
Update cuda context creation to support both cuda 12 and cuda 13.
2025-08-15Add static functions to create blobs from data (#8179)jarcherNV
Add helper functions to create ISlangBlob and load module data from source. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-15Use 64bit int instead of emulation on metal (#8180)James Helferty (NVIDIA)
Metal's popcount prototype is `T popcount(T x)` but we want to use it to implement `countbits` where the prototype always returns `uint`. Using `popcount` directly would implicitly cast successfully to the 32-bit return value in all cases except when the argument is a 64-bit type. Thus, this change always explicitly casts the result to `$TR`, which should be one of the `uint[N]` types, and should always be able to hold the number of bits in the type. Addresses #6877
2025-08-15[CUDA] Fix incorrect `kIROp_RaytracingAccelerationStructureType` emitting ↵ArielG-NV
logic (#8168) Fixes: #8167 Current emitting logic does not work, this has been corrected. The provided test ensures our CUDA code is valid by compiling PTX from it. `m_writer->emit("OptixTraversableHandle");` should be `out <<` since `out` adds to type-name-cache; otherwise using a type twice will produce bad type-names (since we filled type-name cache with "" instead of "typeName")
2025-08-15Prohibit use of buffer.GetDimensions on metal (#8156)James Helferty (NVIDIA)
Fixes #7011
2025-08-14Clean up `natvis` and use fiddle to generate info needed for `.natvis` ↵ArielG-NV
debugging (#8192) fixes: #8188 Changes: * Fix Indentation * Add a visualizer for `NodeBase` based on changes to `slang-fiddle` --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-14[Capability System] Fix bug where capabilities do not correctly propegate if ↵ArielG-NV
AST-parent has target+set the AST-child does not (#8175) Fixes: #8174 Changes: * To determine if we propagate capabilities, we need to ensure that a `join` will do nothing (optimization since `join` is expensive + caching data for the `join` adds up to be expensive). This logic was changed in `slang-check-decl.cpp` since the current logic was incorrect. * A parent could have the set `metal+glsl` and the use-site could have `glsl`. In this case, we will not remove `metal` from the parent since `{metal+glsl}.implies({glsl})` is true. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-08-14Fix typo in "compilation ceased" error identifier (#8189)Sam Estep
2025-08-13Handle SV_Barycentrics on metal (#8163)James Helferty (NVIDIA)
Fixes #6785