summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
Commit message (Collapse)AuthorAge
...
* Add `vk::offset` to specify member offsets for push constants (#6797)Darren Wihandi2025-04-21
| | | | | | | | | | | | | * Add struct member offset qualifier for SPIRV * Implement for GLSL target and add tests * clean up * fix formatting * fix typo * renamed GLSLStructOffset to VkStructOffset and added emit-spirv-via-glsl test case
* Fix matrix division by scalar for Metal and WGSL targets (#6752)Darren Wihandi2025-04-14
| | | | | | | | | | | | | | | | | * Fix matrix division by scalar for Metal and WGSL targets * Add tests * Minor fix * Fix compilation error * Convert to multiplication for WGSL * Minor cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Add a more specific diagnostic message when passing concrete value to ↵Julius Ikkala2025-04-11
| | | | | | | | | interface-typed output parameter (#6788) * More specific diagnostic for invalid concrete-to-interface arg coercion * Add test for the new error message * Fix typo in expected test result
* Support for Payload Access Qualifiers (#3448) (#6595)Harsh Aggarwal (NVIDIA)2025-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for Ray Payload Access Qualifiers (PAQs) (#3448) - Added [raypayload] attribute for struct declarations - Implemented field validation requiring read/write access qualifiers - Added diagnostic error for missing qualifiers - Enabled PAQs in DXC compiler and HLSL emission - Added new test demonstrating PAQ syntax - Implemented proper handling of ray payload attributes in IR generation * format code * Cleanup: Remove unused vars * Add check to enablePAQ only for profile >= lib_6_7 * Review Fix - Add PAQ support for DX Raytracing add enablePAQ flag to DownstreamCompileOpitons, improve PAQ handling update raypayload-attribute-paq.slang to ensure hlsl and dxil is validated * Add diagnostic test for missing paq for lib_6_7 Compile using `-disable-payload-qualifiers` aka lib_6_6 profile raypayload-attribute-no-struct.slang and raypayload-attribute.slang --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Emit errors for missing returns on unsupported targets (#6633)Darren Wihandi2025-03-21
| | | | | | | | | | | | | | | | | | | * initial wip * more WIP * preserve old lower behavior * remove unnecessary includes * add test * add no target case in test * fix broken test --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Add mesh shader output topology checks (#6592)Darren Wihandi2025-03-13
| | | | | | | | | | | | | | | | | | | * 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>
* Allow partial specialization of existential arguments. (#6487)Yong He2025-02-28
| | | | | | | | | | | | | | | | | | | | | * 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.
* Make capability diagnostic message more friendly. (#6474)Yong He2025-02-27
| | | | | | | | | | | | | | | * Make capability diagnostic message more friendly. * Fix. * Fix. * Fix. * Fix test. * Update expected fail setting for aarch64/linux * Fix.
* Allow `.member` syntax on vector and scalars. (#6424)Yong He2025-02-27
| | | | | | | | | | | | | | | | | * Allow `.member` syntax on vector and scalars. * Fix. * fix. * Fix. * update comment. * Fix tests. * Fix warning. * Add more tests.
* Clone name hint decoration when emiting Undefined (#6415)Jay Kwak2025-02-24
| | | | | | | | | | | | | | | | | * Clone name hint decoration when emiting Undefined When emiting "Undefined", we lost the information of where it was synthasized from. This prevents us from providing more helpful error messages. The issue was the when we handle "IRLoop", the inputs parameters to the Phi didn't clone the name hint decoration. This commit clones them when emiting "Undefined". * Adding more test case --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Legalize array size of SV_TessFactor and SV_InsideTessFactor (#6409)Jay Kwak2025-02-24
| | | | | | | | | | | | | | | | | | | | | | | | | | * Legalize array size of SV_TessFactor and SV_InsideTessFactor When targeting SPIR-V or GLSL, the type for SV_TessFactor must be float[4]; note that it is not a vector but an array. Similarly the type of SV_InsideTessFactor has to be an array of float[2]. When the user shader declare them as arrays smaller than the required size, Slang will legalize them to the required sizes. Note that it is not the user mistake to declare floar[3] when the hull mode is in "tri", as an example. The unused components are expected to be ignored. Note also that HLSL allows the type to be float[2|3|4] whereas GLSL and SPIR-V requires it to be always float[4]. * Change from "quad" domain mode to "tri" * Handle error case --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Fix zero size array handling in slangc (#6399)Mukund Keshava2025-02-19
| | | | | | | | | | | | | | | | | * Fix zero size array handling in slangc Fixes #2890 1. Fix zero size array handling in slangc 2. Add new zero size array diagnostic test. * format code * fix review comments --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Add new zero size array test. (#6379)Mukund Keshava2025-02-18
| | | | | Closes #2890 Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Disallow only resources in constant buffers in parameterblocks on metal (#6342)Ellie Hermaszewska2025-02-13
| | | | | | | | | | | | | * Neaten metal parameter block checking * Disallow only resources in constant buffers in parameterblocks on metal closes https://github.com/shader-slang/slang/issues/6200 * add unit test for metal parameterblock cbuffer --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Fix crash when handling uninitialized resource type (#6338)kaizhangNV2025-02-12
| | | | | | | | | | | | * Fix crash when handling uninitialized resource type close #6328. When declare a var with struct type, if the struct has a resource type field and it doesn't provide explicit constructor, because slang won't implicit construct such variable at declare site if user doesn't explicitly call the initializer list, we should report the resource type field uninitialized as an error to prevent future possible crash when legalize any use of such variable.
* Add checking for differentiability of the primal substitute function. (#6277)Sai Praveen Bangaru2025-02-11
| | | | Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Feature/initialize list side branch (#6058)kaizhangNV2025-02-05
| | | | | | | | | | | | | | | | | | | | | | * SP004: implement initialize list translation to ctor - We synthesize a member-wise constructor for each struct follow the rules described in SP004. - Add logic to translate the initialize list to constructor invoke - Add cuda-host decoration for the synthesized constructor - Remove the default constructor when we have a valid member init constructor - Disable -zero-initialize option, will re-implement it in followup (#6109). - Fix the overload lookup issue When creating invoke expression for ctor, we need to call ResolveInvoke() to find us the best candidates, however the existing lookup logic could find us the base constructor for child struct, we should eliminate this case by providing the LookupOptions::IgnoreInheritance to lookup, this requires us to create a subcontext on SemanticsVisitor to indicate that we only want to use this option on looking the constructor. - Do not implicit initialize a struct that doesn't have explicit default constructor. Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Fix warning about push constants, shaderRecordEXT (#6269)cheneym22025-02-04
| | | | | | | | | | | * Fix warning about push constants, shaderRecordEXT These resources should not warn about missing vk::binding. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Fix combined sampler documentation and warning (#6207)cheneym22025-01-29
| | | | | | | | | | | * Fix combined sampler documentation and warning * Update comment, show detailed '-fvk-t-shift' message in warning instead of generic '-fvk-xxx-shift' * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Add bgra8 format (#6163)Darren Wihandi2025-01-24
| | | | | | | | | | | | | | | | | * add brga8 format * add tests * minor fixes * cleanup * maybe fix broken quad control test * add missing xslang flag on test --------- Co-authored-by: Yong He <yonghe@outlook.com>
* improve error message on generic value decls (#6169)Darren Wihandi2025-01-24
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Fix incorrect resolve of specialization instance (#6162)Jay Kwak2025-01-23
| | | | | | | | | | | | | | | | | | * Fix incorrect resolve of specialization instance While checking the uninitialized variables, we were not resolving the specialized instance correctly. This commit repeats the resolve while the result is a specialization instance. A new test is added for this: tests/diagnostics/uninitialized-generic.slang After the problem is fixed, it revealed another problem in existing tests: tests/compute/nested-generics2.slang tests/diagnostics/uninitialized-local-variables.slang When a struct has a member variable whose type is a generic type, we cannot iterate over its member variables yet, because the type is unknown until the generic function/struct is specialized. We will have to give up checking for these cases.
* Refactor _Texture to constrain on texel types. (#6115)Yong He2025-01-17
| | | | | | | | | * Refactor _Texture to constrain on texel types. * Fix tests. * Fix. * Disable glsl texture test because rhi can't run it correctly.
* Inline global constants that contains opaque handles for legalization. (#6098)Yong He2025-01-15
| | | | | | | | | * Inline global constants that contains opaque handles for legalization. * Add diagnostics on opaque type global variables. * Fix. * Fix test.
* Fix #5354, change diagnostic definition error message and expect output in ↵wij2025-01-14
| | | | | test (#6067) Co-authored-by: Yong He <yonghe@outlook.com>
* Fix potential test failures due to SPIRV validation failure (#6047)Jay Kwak2025-01-10
| | | | | | | | | | | There are a few tests that are currently passing but could fail when conditions change little bit. When slang-test runs with `test-server`, the spirv validation fails and the test gets reported as failed even though they are actually passing. To avoid the potential problem, this commit adds an empty entry point. Co-authored-by: Yong He <yonghe@outlook.com>
* Use disassemble API from SPIRV-Tools (#6001)Jay Kwak2025-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Check for undefined %id in spirv_asm block. (#5966)Yong He2024-12-30
|
* Check mismatching method parameter direction against interface declaration. ↵Yong He2024-12-30
| | | | (#5964)
* Check decl nesting for namespaces. (#5910)Yong He2024-12-18
|
* Add verification logic on push and specialization constants. (#5887)Yong He2024-12-17
| | | | | | | | | * Add verification logic on push and specialization constants. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Enable exprs for GLSL binding layout qualifiers (#5807)Darren2024-12-10
| | | | | | | | | | | | | | | | | | | * Allow glsl set and binding layout qualifiers to be compile time integer exprs * add new tests * add comments * cleanup on asserts * addressed review comments and cleanup * fix missing set expr in test * fixed tests and cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Report error on nested functions. (#5792)Yong He2024-12-09
| | | | | | | | | * Report error on nested functions. * Fix. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Fix crash on recursive types. (#5796)Yong He2024-12-09
| | | Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Conform non-suffixed integer literals (#5717)Darren Wihandi2024-12-03
| | | | | | | | | | | | | | | | | | | | | * Make non-suffixed integer literal type resolution conform to C * Update integer literal tests * Clean up integer literal implementation a bit * Update docs on integer literals * Clean up docs update * Clean up docs update * Add comment on INT64_MIN edge case * Fixed failing test, fixed formatting and cleaned up code --------- Co-authored-by: Yong He <yonghe@outlook.com>
* [AD] Add support for resolving custom derivatives where generic parameters ↵Sai Praveen Bangaru2024-11-22
| | | | | | | | | can't be automatically inferred (#5630) * [AD] Add support for resolving custom derivatives where generic parameters can't be automatically inferred * Fix failing tests * Update custom-derivative-generic.slang
* Change how DeclRef::toText works (#5592)Sai Praveen Bangaru2024-11-20
| | | | | | | * Change how DeclRef::toText works We now ignore the decl-ref heirarchy since that only includes nodes with specialization info & simply walk up the tree of decls, while emitting any specializations present in the decl-ref. * Update some tests. Add cases for direct refs to generic params & Lookup decl refs
* Constant-fold for the type-casting in switch-case labels (#5436)Jay Kwak2024-10-30
|
* Replace the word stdlib or standard-library with core-module for source code ↵Jay Kwak2024-10-28
| | | | | (#5415) This commit changes the word "stdlib" or "standard library" to "core module" in the source code.
* Properly check switch case. (#5341)Yong He2024-10-20
|
* Add diagnostic to verify the left hand side of a generic constraint. (#5112)Yong He2024-09-19
| | | | | * Add diagnostic to verify the left hand side of a generic constraint. * Fix comment.
* Lower the priority of looking up the rank of scope (#5065)kaizhangNV2024-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Lower the priority of looking up the rank of scope In the previous change of #5060, we propose a way to resolve the ambiguous call when considering the scope of a function. But this rule should be considered as a low priority than "specialized candidate", aka. we should consider more "specialized candiate" first. * Count distance between reference site to declaration site Compare the candidate by calculating distance from reference site to declaration site via nearest common prefix in the scope tree. This will involve finding the common parent node of two child nodes and how sum the distance from the common parent to the two child nodes. * Change the priority higher than 'getOverloadRank' * Don't evaluate the scope rank algorithm on generic If the candidate is generic function, the function parameters won't be checked before 'CompareOverloadCandidates', so it will results in that the candidates this function could be invalid. We should not evaluate the distance algorithm in this case, instead we will evaluate later when the candidate is in flavor of Func or Expr since then all the type checks for the function will be done.
* Add `IRWArray` interface, and make StructuredBuffer conform to them. (#5097)Yong He2024-09-18
| | | | | | | | | * Add `IRWArray` interface, and make StructuredBuffer conform to them. * Update user guide. * Fix. * Fixes.
* Add load paths to return value check (#5042)venkataram-nv2024-09-09
|
* Support entrypoints defined in a namespace. (#5011)Yong He2024-09-05
| | | | | * Support entrypoints defined in a namespace. * Fix test.
* Fix extension override behavior, and disallow extension on interface types. ↵Yong He2024-09-04
| | | | | | | | | | | | | (#4977) * Add a test to ensure extension does not override existing conformance. * Fix doc. * Update documentation. * Fix doc. * Add diagnostic test.
* Ignoring construct field warnings on delegatory methods (#4911)venkataram-nv2024-08-28
| | | | | | | | | | | * Ignoring construct field warnings on delegatory methods * Generalizing instruction usage type interface * Skip collection when searching for stores * Adding separate construct delegation tests * Treating differentiable functions as stores
* Include inout cast operation as an aliasing instruction (#4859)venkataram-nv2024-08-16
| | | | | | | | | | | | | | Previously, the warnings were: ``` environment.slang(22): warning 41022: inout parameter 'seed' is never written to public float3 environment_sample(StructuredBuffer <Environment_sample_data> sample_buffer, inout int seed) ^~~~~~~~~~~~~~~~~~ hit.slang(5): warning 41022: inout parameter 'seed' is never written to float3 sample_lights(inout uint seed) ^~~~~~~~~~~~~ ``` With this commit they should not be emitted.
* Do not zero-initialize groupshared and rayquery variables (#4838)ArielG-NV2024-08-14
| | | | | | | | | | | | | | | | | | | | | | | * Do not zero-initialize groupshared and rayquery variables Fixes: #4824 `-zero-initialize` option will explicitly not: 1. Set any groupshared values to defaults 2. Set any rayQuery object to a default state (currently invalid code generation) * grammer * disallow groupshared initializers disallow groupshared initializers & adjust tests accordingly * remove disallowed groupshared-init expression * do not default init if non-copyable --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Warn when inout parameter is never written (#4777)venkataram-nv2024-08-12
| | | | | | | Addresses #4698 as one approach to diagnose the potential problem. Emit warnings when a user marks a parameter as `inout` but never writes to it in the function. A new intrinsic function `unmodified(out T)` has been added to explicitly indicate that an `inout` variable will not be modified in the function. This is only one way to address the specific validation error in #4698. In general it seems that DXC does some more extensive checks on actual struct fields (as opposed to observing arbitrary struct writes), so that will be the next step.