summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-03-20Add Nix flake for direnv (#6635)Sam Estep
* Add Nix flake for direnv * Use Sai's suggestion for the `description` * Make `.envrc` optional * Move Nix docs to their own section * Tweak wording * Tweak wording more * Add `nixfmt` --------- Co-authored-by: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-20Add -dump-module command to slangc (#6638)cheneym2
* Add -dump-module command to slangc The new -dump-module command to slangc will load and disassemble a slang module, similar to what would be seen by the -dump-ir command, except that -dump-ir tells slangc to print IR as it performs some compilation command. That is, -dump-ir requires some larger compilation task. -dump-module on the otherhand requires no additional goal and will simply load a module and print its IR to stdout independently from other compilation steps. Its intended purpose is to inspect .slang-module files on disk. It can also be used on .slang files which will be parsed and lowered if slang does not find an associated ".slang-module" version of the module on disk. The compilation API is extended with a new IModule::disassemble() method which retrieves the string representation of the dumped IR. Closes #6599 * format code * Use FileStream not FILE * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-20Delete unused Dockerfile (#6629)Sam Estep
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-20Make image format reflection easier (#6550)Devon
* image format json reflection * format code * use direct include --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-19Output SPV_KHR_compute_shader_derivatives extension string instead of the NV ↵Darren Wihandi
extension (#6641) * Output SPV_KHR_compute_shader_derivatives instead of the NV extension * add alias for nv extension
2025-03-19Add SPIRV atomic debug type (#6616)Darren Wihandi
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-19Fix reinterpret and bitcast and generic arg parsing. (#6627)Yong He
* Fix reinterpret and bitcast. * Fix warning. * Fix. * Fix. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-18Implement floating-point pack/unpack intrinsics for all targets (#6503)Darren Wihandi
* Implement floating-point pack/unpack intrinsics * remove unused functions and update caps in glsl meta file * rename pack capability
2025-03-18Fix MSVC warning D9025 when building external dependencies. (#6630)Yong He
* Fix MSVC warning D9025 when building external dependencies. * revert unrelated change.
2025-03-18Fix `IRVar` hoisting when its already in the right block. (#6626)Sai Praveen Bangaru
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-17Delete accidental `lock` file (#6620)Sam Estep
2025-03-17Add auto-diff support for `GetOffsetPtr` (#6625)Sai Praveen Bangaru
2025-03-17Fix crash when swizzling non-differentiable types (#6613)Sai Praveen Bangaru
* Fix crash when swizzling non-differentiable types * Update slang-ir-autodiff-fwd.cpp
2025-03-17Add error diagnostic vectors and matrices with disallowed element types (#6596)Anders Leino
- Add the diagnostic messages, and code to emit them - Add some tests This helps to address issue #6183.
2025-03-16Add help screen to slang-test (#6611)Gangzheng Tong
This commit adds a help screen to slang-test to improve usability; and update README.md with clearer instructions. The help screen is displayed when: - User explicitly requests help with -h or --help flags - An unknown option is provided - A required argument for an option is missing The help screen provides comprehensive documentation of all available options, organized into sections: - Basic options (e.g. bindir, test-dir) - Output modes (e.g. appveyor, travis, teamcity) - Test prefix usage explanation Fixes: #6560 Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-15fix trimming of "v" from version string (#6605)Paradox84
Current releases are removing "v" from "vulkan-sdk-1.4.309.0" when they were supposed to remove it from something like "v1.2.4" https://github.com/shader-slang/slang/releases/tag/vulkan-sdk-1.4.309.0 Fixed it so it only removes "v", if next character is a number Co-authored-by: Yong He <yonghe@outlook.com>
2025-03-15Fix lowering of associated types in generic interfaces (#6600)Sai Praveen Bangaru
* Fix lowering of associated types in generic interfaces. * Update diff-assoctype-generic-interface.slang * Fix-up lowering of differentiable witnesses for implicit ops * Update slang-ir-autodiff-transcriber-base.cpp * Fix issue with differentiating type-packs
2025-03-14Implement GetDimensions for structured buffers on WGSL (#6609)Darren Wihandi
* Implement structured buffer GetDimensions for WGSL * byte address buffer fix * enable wgsl test and minor fixups * maybe fix get equivalent structured buffer * remove unnecessary include * clean up some code in meta file
2025-03-14Fix: Respect user-defined output directory settings for libraries (#6604)Harsh Aggarwal (NVIDIA)
* Fix: Respect user-defined output directory settings for libraries Modified SlangTarget.cmake to properly respect CMAKE_LIBRARY_OUTPUT_DIRECTORY, CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_ARCHIVE_OUTPUT_DIRECTORY variables when they are explicitly set by the user. This ensures libraries and executables are placed in the directories specified by the user, including handling Multi-Config generators like Visual Studio, Xcode, and Ninja Multi-Config. Fixes #5896: Shared library build output location ignores CMAKE setting * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-13Use an explicit dependency for generated headers instead of source file ↵Ellie Hermaszewska
dependency (#6594) * Simplify text writing for core module headers * Use an explicit dependency for generated headers instead of source file dependency From the CMake Docs > Do not list the output in more than one independent target that may build in parallel or the instances of the rule may conflict. Instead, use the add_custom_target() command to drive the command and make the other targets depend on that one. See the Example: Generating Files for Multiple Targets below. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-03-13Correct buffer length calculation in dumpSourceBytes (#6593)Ellie Hermaszewska
No functional change as overallocating was ok, but this was wrong Co-authored-by: Yong He <yonghe@outlook.com>
2025-03-13Add mesh shader output topology checks (#6592)Darren Wihandi
* initial wip * more wip * add test * add unexpected for invalid target * fixups and improve error message * fixups and improve error message * remove incorrect comment --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-03-13test for link type layout caching (#6567)Ellie Hermaszewska
* format code * test for link type layout caching --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-13test that link time extern struct layouts are visible for nested types (#6568)Ellie Hermaszewska
closes https://github.com/shader-slang/slang/issues/6556
2025-03-12add SLANG_USER_CONFIG (#6584)Simon Kallweit
* add SLANG_USER_CONFIG * format code --------- Co-authored-by: Simon Kallweit <skallweit@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Simon Kallweit <64953474+skallweitNV@users.noreply.github.com>
2025-03-12Migrate render-test away from deprecated compile request API (#6514)Anders Leino
* Add a simple interface parameter test Since there's no documentation, it's nice to have a simple test case in order to experiment with this feature of the testing framework. * Add shader entry point attributes to tests * Fix specialization arguments for tests - Add some missing arguments - Rremove one extraneous argument. * Stop using deprecated compile request in render-test Use a session object instead of the deprecated compile request object. This closes issue #4760.
2025-03-12Add referenced modules as libraries when creating a session (#6569)Anders Leino
In the legacy compile request based API, the referenced modules are added to the request's linkage libraries as part of compiler option parsing. In the non-legacy compilation API, the argument parsing creates a temprary compile request and so those libraries only survive as options. This change will look for such options when creating an ISession object, and again add the referenced modules to the libraries of the new linkage that's contained in the ISession object. This is done in two steps: 1. Factor out a helper to create a referenced module artifact in the same way as it's done during legacy option parsing. 2. Use the helper function to create artifacts to add to the linkage libararies, when the session is created. This helps to address issue #4760, because it enables passing in downstream modules via options, as is required for the following tests: tests/library/library-test.slang.2 (dx12) tests/library/export-test.slang.2 (dx12)
2025-03-11Set the HLSL supported compiler version to 2018 (#6502)Tony (Atanas) Zlatinski
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2025-03-11Don't crash when precompiling twice (#6576)cheneym2
Abort precompileForTarget if it's already done. Fixes #6516
2025-03-11IR: Add SPIR-V disassembly for embedded downstream IR dumps (#6529)Mukund Keshava
* IR: Add SPIR-V disassembly for embedded downstream IR dumps When dumping IR that contains embedded downstream SPIR-V code (via EmbeddedDownstreamIR instructions), display the disassembled SPIR-V instead of just showing "<binary blob>". This CL also does: - Adds a new interface for disassembly and get result. - Modify export-library-generics.slang test test to check for the disassembled SPIR-V Fixes #6513 * Add module-dual-target-verify test Fixes #6517 Adds a new test to verify that dxil and spirv targets are stored separately in the precompiled blob. * Fix review comments from cheneym2 * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-11Add missing error check (#6570)cheneym2
Bail from test if shader doesn't compile.
2025-03-10UseHighestVersion when calling spirv-link (#6559)cheneym2
Precompiled SPIR-V bits can independently resolve to different versions of SPIR-V. To avoid a linker error about mismatched versions, use a linker feature to automatically use the highest version listed in the modules. Fixes #6548
2025-03-10Add module reference options to options list when parsing them (#6539)Anders Leino
* Add module reference options to options list when parsing them Previously, the module was just added to the compile request directly. This is a problem because the non-deprecated command line option parsing interface IGlobalSession::parseCommandLineArguments just creates a temporary compile request. Therefore these options are currently not detected by the API. This helps to address issue #4760 since it will need to access these modules in order to supply all of the required code. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-10Sharpen condition on warning about used capabilities relative to selected ↵Anders Leino
profile (#6538) If the profile/capability in options set, but set to unknown, then don't count the setting as requesting a particular profile/capability. This helps in addressing issue #4760 because the new session-based compilation API always adds a profile setting via Linkage::addTarget, even if the profile is unknown. That caused lots of tests to fail due to unexpected output: "warning 41012: entry point 'computeMain' uses additional capabilities that are not part of the specified profile..." The old compilation request -based API did not add profile/capabiltiy to the options, and so did not generate this warning.
2025-03-07Fix SPIRV generator ID. (#6536)Yong He
2025-03-07Add option to exclude webgpu-dawn and slang-tint (#6537)jarcherNV
Add option to exclude webgpu-dawn and slang-tint from the build, for environments that need to build Slang without internet access.
2025-03-06Fix a bug in default ctor synthesizing (#6527)kaizhangNV
* Fix a bug in default ctor synthesizing - This is fix for the implementation bug, when a struct has explicit ctor we should not synthesize the default ctor anymore. - When invoke the synthesized ctor converted from initializer list, we should check if the struct is a c-style type if it struct has no synthesized ctor. In this case we should report error because it's invalid to use initializer list here. - The only exception is the unsized array, we still have to fall back to use the legacy initializer list logic to initialize the unsized array until we formalize a proper solution. - update test.
2025-03-07Update build to allow setting external paths (#6528)jarcherNV
* Update build to allow setting external paths Update the build to allow setting user-specific paths for the external modules. This allows building Slang without also fetching the external modules, assuming they are already present elsewhere locally.
2025-03-06Fix lowering of `extern` types with defaults. (#6512)Yong He
* Fix lowering of `extern` types with defaults. * Fix test. * Fix test.
2025-03-07Show adapter info in slang-test CI runs (#6535)cheneym2
It might be beneficial for debugging issues to know what graphics adapters are in use for CI runs. It is also helpful to ensure the -show-adapter-info option in slang-test doesn't bitrot.
2025-03-06Update SPIRV-Tools and fix new validation errors. (#6511)Yong He
* Update SPIRV-Tools and fix new validation errors. * Implement pointers for glsl target. * Reworked packStorage/unpackStorage code gen to operate on pointers rather than values.
2025-03-06Get options also from the default target (#6530)Anders Leino
This helps to address issue #4760. The particular issue motivating this fix is that IGlobalSession::parseCommandLineArguments uses a temporary compile request to parse options. The compile request only adds the OptionKind::ForceDXLayout (-fvk-use-dx-layout) to the "current target" which may be the default target, which IGlobalSession::parseCommandLineArguments didn't look for, meaning that options like ForceDXLayout were just ignored. This leads to test failures in tests that rely on this option, e.g. tests/spirv/cbuffer-dx-layout-1.slang.
2025-03-05Add module organization suggestion doc (#6509)cheneym2
* Add module organization suggestion doc Suggest one method to keep slang modules organized in the file system. Closes #4841
2025-03-05Support SPIR-V deferred linking option (#6500)cheneym2
The new option "SkipDownstreamLinking" will defer final downstream IR linking to the user application. This option only has an effect if there are modules that were precompiled to the target IR using precompileForTarget(). Until now, the default behavior for SPIR-V was to use deferred linking, and the default behavior for DXIL was to use immediate/internal linking in Slang. This change only affects the SPIR-V behavior such that both deferred and non-deferred linking is supported based on the new option. To support the non-deferred option, Slang will internally call into SPIRV-Tools-link to reconstitute a complete SPIR-V shader program when necessary (due to modules having been precompiled to target IR). Otherwise, if SkipDownstreamLinking is enabled, the shader returned by e.g. getTargetCode() or getEntryPointCode() may have import linkage to the SPIR-V embedded in the constituent modules. Closes #4994 Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-03-05Fix codegen bug when targeting PTX with new API (#6506)Anders Leino
* Add cuda codegen bug repro This just compiles tests/compute/simlpe.slang for PTX with the new compilation API, in order to reproduce a code generation bug. * Detect entrypoint more robustly when applying ConstRef hack during lowring For shaders like tests/compute/simple.slang, which have a 'numthreads' attribute but no 'shader' attribute, the old compile request API would add an EntryPointAttribute to the AST node of the entry point. However, the new API doesn't, and so a certain ConstRef hack doesn't get applied when using the new API, leading to subsequent code generation issues. This patch also checks for a 'numthreads' attribute when deciding whether to apply the ConstRef hack. This closes issue #6507 and helps to resolve issue #4760. * Add expected failure list for GitHub runners Our GitHub runners don't have the CUDA toolkits installed, so they can't run all tests.
2025-03-04Fix option set serialization bug (#6515)Anders Leino
This helps to address issue #4760.
2025-03-03Document how unit tests are defined and run (#6448)Anders Leino
This closes issue #4771.
2025-02-28Consolidate multiple inouts/outs into struct (#6435)Mukund Keshava
* Consolidate multiple inout/outs into struct Fixes #5121 VUID-StandaloneSpirv-IncomingRayPayloadKHR-04700 requires that there be only one IncomingRayPayloadKHR per entry point. This change does two things: 1. If an entry point has the one inout or out, or has only ins, then stay with current implementation. 2. If there are multiple outs/inouts, then create a new structure to consolidate these fields and emit this structure. These two code paths are split into two separate functions for clarity. This patch also adds a new test: multipleinout.slang to test this. * Address review comments * Refactor code as per review comments * format code * fix failing tests --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-28Allow partial specialization of existential arguments. (#6487)Yong He
* Allow partial specialization of existential arguments. * Fix. * Add test case for improved diagnostics. * Fix compile error. * Fix tests. * Fix. * Fix test. * Fix compile issue. * Fix typo. * Address comment.
2025-02-28Implement sparse texture Sample* intrinsics for SPIRV (#6377)Darren Wihandi
* implement sparse residency samples for spirv * udpate test * separate tests to non-combined and combined sampler * remove expected failure * add expected failure for dx12 combined sampler test * remove expected failure * fix submodule merge * add back dx12 test failure --------- Co-authored-by: Yong He <yonghe@outlook.com>