summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2025-07-07Language server: sort completion candidate by relevance. (#7626)Yong He
* Language server: sort completion candidate by relevance. * Small adjustment.
2025-07-04Make copysign function differentiable (#7585)Copilot
* Initial plan * Implement copysign forward and backward derivatives Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix copysign test format to use expected.txt file Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add wgsl support to copysign and fix y==0 derivative case Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add wgsl support to copysign helper functions Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix copysign derivative to return 0 when either x or y is 0 Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
2025-07-03Language Server Enhancements (#7604)Yong He
* Language Server: auto-select the best candidate in signature help. * Fix constructor call highlighting + goto definition. * Add test. * format code * Improve ctor signature help. * Add tests. * Fix decl path printing for extension children. * Allow goto definition to show core module source. * c++ compile fix. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-07-03Replace SLANG_ALIGN_OF with C++11 alignof (#7523)Julius Ikkala
* Replace SLANG_ALIGN_OF with C++11 alignof * Fix formatting (again)
2025-07-03Fix for mixed block/embedded usage of structs in SPIRV (#7608)James Helferty (NVIDIA)
* Add test for mixed use of uniform/ParameterBlock Adds a test that uses the same struct as a parameter and as a ParameterBlock. * Fix for SPIRV block declaration issue Fixes #7431 * Fix formatting * Collect struct param usage in first pass Reduces number of iterations over the entire program. * more formatting fixes * formatting * Remove unused variable
2025-07-03Remove a test from expected-failure-github for MacOS (#7526)Jay Kwak
This commit removes the following test from expected-failure-github.txt because the issue is addressed on slang-rhi side. tests/compute/cbuffer-legalize.slang.2 syn (mtl)
2025-07-03Don't use access::sample for multisample texture in metal (#7601)Gangzheng Tong
* don't use access::sample for multisample texture * Add test case * format code (#7603) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-07-03Enable tests for CUDA (#7593)Mukund Keshava
Enable intrinsic tests for cuda. Most of these tests were either disabled or just not enabled for cuda. Fixes #7592 Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-07-02Fix crash when using wrong type for inout parameter with WGSL target (#7588)Copilot
* Initial plan * Fix crash in WGSL L-value cast lowering with type mismatches Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Apply formatting to fix Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Update test to verify successful compilation instead of error checking Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-07-02[HLSL, SPIRV_1_3] Hoist OpSelect returning a composite into `if`/`else` (#7594)ArielG-NV
* emit var and hoist out OpSelect if Composite * cleanup comment * address review check for version in spv context use phi node instead of using var move inst's using a list (not in-place modification) * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-07-02Fix spurious vk::binding warnings when attribute is present (#7581)Copilot
* Initial plan * Fix spurious vk::binding warnings when attribute is present - Modified _maybeDiagnoseMissingVulkanLayoutModifier to check for GLSLBindingAttribute before warning - Changed function to return bool indicating if warning was actually issued - Updated call sites to properly track warning state to reduce duplicates - Tested fix resolves the issue while preserving correct warnings when needed Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Add test case for vk::binding spurious warning fix Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Update test to use filecheck format as requested Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Remove full file path from CHECK directives as requested Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix code formatting with clang-format Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix behavioral regression in vk-bindings test caused by warning flag logic Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-07-02Fix for emitting ArrayStride decoration for arrays of opaque types (#7568)Jerran Schmidt
* WIP opaque type decoration fix * Clearer intent * Formatting * Added test for fix
2025-07-02Defer immutable buffer loads when emitting spirv. (#7579)Yong He
* Defer immutable buffer loads when emitting spirv. * Fix. * Fix. * Fix. * Fix tests. * Fix test.
2025-07-01Misc language server improvements. (#7569)Yong He
* Misc language server improvements. * Fix. * Fix decl path printing for existential lookup. * More existential decl path fix. * Polish. * Fix test.
2025-07-01Allow Link time constant array length sizing, warn on unsupported ↵Ellie Hermaszewska
functionality (#7067) * Add link time array layout test * Add link time constant array size compilation test * Link time constant array size test * Allow getting link time array size Closes https://github.com/shader-slang/slang/issues/6753 * format * Switch to SIMPLE test and check output * Implement without binary api changes * diagnose on link time constant sized array * fix test --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-07-01Add arguments for controlling floating point denormal mode (#7461)aidanfnv
* Implement -fp-denorm-mode slangc arg * Split fp-denorm-mode into 3 args for fp16/32/64 * Remove redundant option categories * Use emitInst for multiple of the same OpExecutionMode * Fix formatting * Remove -denorm any * Re-add option categories * emitinst for ftz * Use enums for type text * Remove extra categories again * Add tests for denorm mode * Move denorm mode to post linking * format code (#8) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * regenerate command line reference (#9) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * Clean up tests * Fix option text * format code (#10) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * Add tests for "any" mode * Return "any" enum if option not set * Simplify emission logic * Add support for generic entrypoints * Move denorm modes to end of CompilerOptionName enum * format code (#11) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * Move new enum members to before CountOf * Add not checks to tests, fix generic test, add functionality tests * Rename denorm to fpDenormal * Clean up functional test * Rename denorm test dir * Fix formatting, regenerate cmdline ref * Fold simple tests into functional tests, add more dxil checks * Remove no-op DX tests, make tests more consistent * Disable VK functionality tests that will fail on the CI configs * Fix formatting * Add comments to disabled tests explaining why --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-06-30Emit sample index when constructing a `OpImageTexelPointer` (#7563)ArielG-NV
* fix #7554 * format code * test ms and non ms texture --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-06-30Add MLP training examples. (#7550)Yong He
* Add MLP training examples. * Formatting fix. * Fix. * Improve documentation on coopvector. * Improve doc. * Update doc. * Fix typo. * Cleanup shader. * Cleanup. * Fix test. * Fix type check recursion. * Fix. * Fix. * Fix override check.
2025-06-30Implement IFloat.scale for vectors, matrices (#7545)James Helferty (NVIDIA)
* Test for IFloat.scale usage Test that using IFloat.scale doesn't cause an internal compiler error. * Generic implementation of IFloat.scale() Fixes #7156 * Implement IFloat.scale for matrix Adds matrix implementation and test coverage. * Avoid explicitly constructing a matrix * Remove intrinsicOp from IFloat.scale impls Updates IFloat.scale implementations: - Remove __intrinsic_op($(kIROp_Mul)) since we're providing an implementation - Add [__unsafeForceInlineEarly] where missing
2025-06-29Support the GLSL/SPIR-V Built-in variable `DeviceIndex` (#7552)ArielG-NV
* Support DeviceIndex * format code * regenerate command line reference --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-06-28Minimal optional constraints (#7422)Julius Ikkala
* Parse optional witness syntax * Allow failing optional constraint * Make `is` work with optional constraint * Allow using optional constraint in checked if statements * Fix tests * Make it work with structs * Fix MSVC build error * Disallow using `as` with optional constraints * Update test to match split is/as errors * Add tests * Fix uninitialized variables in tests * Add tests of incorrect uses & fix related bugs * Mention optional constraints in docs * format code * Fix type unification with NoneWitness * Fix formatting --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Nathan V. Morrical <natemorrical@gmail.com>
2025-06-27Enable Vulkan Validation Layer in CI (#7543)Gangzheng Tong
* Disable spirv-opt for the tests with debugfunction VVL errors * Enable VVL in CI * Add 2 expected failure tests until we update VVL to 1.4.319 which contains the fix * update slang-rhi * Revert "Disable spirv-opt for the tests with debugfunction VVL errors" This reverts commit 5327460057f533af81ea60a556e43abe805d5816.
2025-06-26Fix tuple AST & IR layout size queries (#7502)Julius Ikkala
* Fix tuple AST & IR layout size queries * Don't peephole sizeof if size is still indeterminate
2025-06-26Fix for OpUConvert producing invalid opcode when to/from signs differ (#7398)Jerran Schmidt
* Fix for OpUConvert outputting scalar type for mixed sign vector type conversions * Fix compiler warning * Added regression test for UConvert vector fix * Formatting * getUnsignedType helper * Formatting * Fix for addtional int types * Helper function to convert signed type to unsigned type
2025-06-26Fix the invalid SPIRV decoration issue (#7527)kaizhangNV
* Fix the invalid SPIRV decoration issue Close #7508. SPIRV doesn't allow decoration on type with Private or Function storage class. In our lowering logic, if the array type is used by buffer type it will always have stride operand after lowering, so if the array is not used by buffer type, it must be used only by thread_local or group_shared variable, and it will not have stride operand. For this case, we don't need to emit stride decoration for SPIRV.
2025-06-26Correct the scope for DebugLocalVariable (#7516)Lujin Wang
* Correct the scope for DebugLocalVariable All of the DebugLocalVariable instructions have their scope set to DebugCompilationUnit. The scope should instead be set to a DebugFunction, or a DebugLexicalBlock which is recursively inside a DebugFunction. Register the debug info for the function instructions, which helps findDebugScope() to find the right DebugFunction scope for DebugLocalVariable. * Add a test for DebugLocalVariable To check the scope, which should be a DebugFunction.
2025-06-26Add matrix operand for OpCooperativeVectorMatrixMulAddNV (#7524)Gangzheng Tong
* Add matrix operand for OpCooperativeVectorMatrixMulAddNV * update tests to use the supported UINT32 input component type * Add MatrixCSignedComponentsKHR for coopVecMatMulAddPacked --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2025-06-25Fix Phi elimination pass sometimes leaving broken insts in release builds ↵Julius Ikkala
(#7499) * Make phi elimination pass modify branches in-place * Add test and fix formatting * Avoid double removal of param insts
2025-06-25Fix ambiguous reference for 'extern' and 'export' (#7515)kaizhangNV
Close #7509. When there are both `export` and `extern` decls in lookup result, we should remove all `extern` decls.
2025-06-25Fix generation of wgsl case arms (#7374)Swoorup Joshi
* Fix generation of wgsl case arms * Added test case to test generation of switch case --------- Co-authored-by: Harsh Aggarwal (NVIDIA) <haaggarwal@nvidia.com>
2025-06-19Always emit DepthReplacing execution mode when writing to FragDepth (#7450)dubiousconst282
2025-06-18Fix retry logic for unit test (#7471)Jay Kwak
* Fix the ignored unit-tests on retry * Retrigger CI * Add more error messages * Don't use test-server for retry of unit-test to see error messages * Clean up cl.yml Remove 'has-gpu' because it is unused after debug became full-gpu-test. Renamed files to make the meaning more clear: - Renamed expected-failure.txt to expected-failure-via-glsl.txt - Renamed expected-failure-github-runner.txt to expected-failure-no-gpu.txt * Rename cpu-hello-world.slang to avoid name conflict to example We have an example whose executable name is cpu-hello-world.exe. It gets built when you run `cmake --build`, but it gets overwritten by slang-test when it tests `tests/cpu-program/cpu-hello-world.slang`. This PR renames to avoid the name conflict. * Remove debug code --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-06-18Fix coopvector neg intrinsic. (#7481)Yong He
* Fix coopvector neg intrinsic. * Add test case.
2025-06-18Fix additional VVL violations (#7377)Gangzheng Tong
* fix: add sampleCount and mipMaps to st2DMS_f32v4 Fix VUID-VkImageCreateInfo-samples-02257: The Vulkan spec states: If an OpTypeImage has an MS operand 1, its bound image must not have been created with VkImageCreateInfo::samples as VK_SAMPLE_COUNT_1_BIT * Fix VUID-VkShaderModuleCreateInfo-pCode-08740 Rename VK_KHR_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME to VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME * fix: add sampleCount and mipMaps to st2DMS_f32v4 Fix VUID-VkImageCreateInfo-samples-02257: The Vulkan spec states: If an OpTypeImage has an MS operand 1, its bound image must not have been created with VkImageCreateInfo::samples as VK_SAMPLE_COUNT_1_BIT * Fix VUID-VkShaderModuleCreateInfo-pCode-08740 Rename VK_KHR_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME to VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME * Fix VUID-vkCmdDispatch-None-06479 Use correct format for combined depth texture. * Fix VUID-vkCmdDispatch-format-07753 by setting format Parse filtering mode for sampler because the RGBA8* formats do not support linear filtering * Create MS texture type for sample count > 1 * Use different texture formats for depth compare and gather ops * Use clearTexture for init the data for MS textures
2025-06-18Fix false negative result for CUDA with recent versions (#7409)Jay Kwak
* Fix false negative result for CUDA with recent versions From CUDA version 12.8 and above, nvrtc returns an exit code treated as an error. Some of slang-test test cases had to change from TEST to DIAGONOSTIC_TEST to handle it properly.
2025-06-17LanguageServer: Enhance auto completion for override. (#7465)Yong He
* Add additional completion keywords. * LanguageServer: Enhance auto completion for `override`.
2025-06-16Fix for missing signedness cast in SwizzleIR (#7448)Jerran Schmidt
* Cast if there is a signedness mismatch on the swizzle * Move isSignedType to slang-util and add test --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-06-16Require `override` keyword for overriding default interface methods. (#7458)Yong He
* Require `override` keyword for overriding default interface methods. * Update doc. * Fix test.
2025-06-13Skip processing import declarations after errors (#7393)James Helferty (NVIDIA)
* Add test case for missing import attribution Add a test case that imports a non-existent file, followed by a valid file. Tests for absence of a bug where slang reports existent files as non-existent if they're imported after a non-existent file. * Skip processing imports after errors Skip processing additional imports after the first error. This behavior is already observed in Linkage::loadSourceModuleImpl, but since that happenes after import processing already started, a false diagnostic gets generated for a missing import. By hoisting this check out before the import is processed, the diagnostic message for a missing file is no longer erroneously generated. Fixes #6453 * Revert "Skip processing imports after errors" This reverts commit 6b2fef09782414de4c5e017c4ecb5f2affa0c199. * Remove early abort of import processing Partial revert of commit 04f1bad Reverts an early return in Linkage::loadSourceModuleImpl() whenever any error diagnostic message has already been generated. This was causing earlier errors to prevent subsequent imports from succeeding, and was misattributing them to a missing file. Fixes #6453 --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-06-13Allow interface methods to have default implementations. (#7439)Yong He
2025-06-13Fix a bug in empty array legalization. (#7444)Yong He
2025-06-13Fix issue that struct with member is not its Differential type (#7434)kaizhangNV
Close #6176. If the struct has a `no_diff` member, it should not be its Differential type. We miss this check.
2025-06-13Add new capdef for lss intrinsics (#7427)Mukund Keshava
* Add new capdef for lss intrinsics Fixes #7426 Raygen shaders need to be supported for only hitobject APIs. So we need a special capability for that, instead of a common one. * regenerate command line reference --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-06-12Fix issue of missing scope for 'Differential' type (#7433)kaizhangNV
* Fix issue of missing scope for 'Differential' type When we synthesize the struct decl for Differential type, we should add the ownedScope for this decl, because the scope is used in lots of locations in the following synthesized processes, e.g. constructor synthesize. And that could cause surprising behavior, e.g. the 'this' expression could access the members of parent struct decl. Fix the issue by adding the scope. The containerDecl will be the Differential struct decl itself, parent scope will be the parent struct. * Add a unit-test
2025-06-12Fix argument to float3 cbuffer tests (#7391)James Helferty (NVIDIA)
Results of these tests had been marked ignored, because they failed on VK with the GLSL backend. This change removes them from the expected-failure.txt file and adds the correct command line option to avoid using the GLSL target. Addresses concern raised on #7282
2025-06-12Diagnose on use of struct inheritance. (#7419)Yong He
* Diagnose on use of struct inheritance. * fix test. * Fix tests. * fix. --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
2025-06-12Fix intermittent debug failures with Debug build (#7369)Jay Kwak
This PR replaces enable/disable style C function calls with C++ RAII style code. In debug build, when an assertion failed in between enable and disable functions, an exception is thrown and the disable function is not called. RAII style code is safer for an exception
2025-06-11Fix an issue in extension override. (#7402)Yong He
* Fix an issue in extension override. * Fix typo in comment.
2025-06-10Fix reflection to json issue (#7379)kaizhangNV
Apply argument buffer tier2 rule when using parameter block for Metal target. Close #6803.
2025-06-10Allow checking capabilities in specific stages (#7375)jarcherNV
This allows checking capabilities in any stage, needed specifically for the hlsl_2018 capability which is defined for sm_5_1 and above. Stage specific capabilities such as cs_5_1 would not find this in any stage other than compute, so we need to restrict the check to only desired stages.