summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAge
...
* cuda: Add more formats for texture read/write (#7012)Mukund Keshava2025-05-12
| | | | | | | | | | | | | | | | | | * WiP: Add more formats for texture reads * fix test * format code * add float2/float4 versions for 1D and 3D as well * fixed review comment * fix review comments --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Fix local constants in switch cases (#7053)Julius Ikkala2025-05-10
| | | | | | | | | | | | | | | | * Fix using local constants in switch cases * Add test * format code * Always lower switch cases with exprVal * Fix formatting --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
* Add debug information for slang inling (#6621)Mukund Keshava2025-05-10
|
* Fix SPIRV unsigned to signed widening casts (#7051)Darren Wihandi2025-05-09
| | | | | | | * Fix unsigned to signed casts for SPIRV * Add test * Fix ICE crash
* Fix various intptr_t issues by defining its width in `getIntTypeInfo` (#6786)Julius Ikkala2025-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | * Define a bit size for the intptr types * Fix intptr_t sign * Extend intptr test to check for previously broken operations * Fix intptr vector test on CUDA * Handle intptr size in getAnyValueSize * Fix formatting * Try with __ARM_ARCH_ISA_64 * On macs, int64_t != intptr_t Yikes * Move define to prelude header * Also check apple in host-prelude * Fix define location
* Fixed name mangling of generic extensions (#6671)Ronan2025-05-09
| | | | | | | | | | | | | * Fixed name mangling of generic extensions * Added tests for generic extensions linking. - Disabled bugs/gh-6331.slang since it now triggers an assertion error revealed by the new version of the mangler. * Re-enabled test gh-6331 (fixed by a5efbb1b775afb2f6b29b37d39947c41744bb005) --------- Co-authored-by: Yong He <yonghe@outlook.com>
* bitcast require the input has same width with result type (#7018)kaizhangNV2025-05-06
| | | | | | | bitcast requires the input has same width with result type, this PR ensures that we always lower the bitcast IR instruction satisfies this requirement. Close #7017.
* Output default parameter values on language server hover (#6902)Ellie Hermaszewska2025-05-07
| | | | | | | | | | | | | | | * Output default parameter values on language server hover Closes https://github.com/shader-slang/slang/issues/5782 * Add parens around binay expressions in ast print * More cases in ast print test * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Parse char literals as integers (#6989)Julius Ikkala2025-05-06
| | | | | | | | | | | * Parse char literals as integers * Fix formatting * Parse escaped chars correctly --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Add interger pack/unpack intrinsic to glsl (#6997)kaizhangNV2025-05-06
| | | | | | | | | | | * Add interger pack/unpack intrinsic to glsl Add unpack8, unpack16 and pack32 intrinsics to glsl. * add unit test * fix lowering logic for 'bitcast' * format
* Add a new capability hlsl_2018 that avoid using select/and/or (#7003)Jay Kwak2025-05-05
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Add countbits 16-bit and 8-bit support (#6433) (#6897)sricker-nvidia2025-05-05
| | | | | | | | Change adds 16-bit and 8-bit support for countbits intrinsic. In cases where a backend's native counbits lacks support, support is emulated. New tests are added for 16-bit and 8-bit support. Additional testing added for 32-bit and minor updates made to 64-bit countbits.
* Add IREnumType to distinguish enums from ints and each other (#6973)Julius Ikkala2025-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add IREnumType to distinguish enums from ints and each other * Add issue example as test * format code * Add expected test output * Fix peephole optimization hanging No idea why this PR triggered this, but there seems to have been a clear bug here anyway, so may just as well fix it now. * Move enum lowering later * Add linkage decoration to enum type * Use filecheck-buffer instead of expected.txt * Fix comment * Make enum casts actually use IR enum casts They were all BuiltinCasts by accident * Lower enum type before VM * Deal with rate-qualified types in enum cast * Allow any value marshalling for enum types * Handle new enum instructions in a couple more switches * Fix formatting --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Disable an always failing test, partial resident test with dx12 (#6983)Jay Kwak2025-05-02
|
* Add fwidth_coarse and fwidth_fine functions (#6941)pdeayton-nv2025-05-01
| | | | | | | | Fixes #6940. Add new Slang fwidth_coarse and fwidth_fine functions, similar to GLSL's fwidthCoarse and fwidthFine. Move the implementation of the GLSL functions from glsl.meta.slang to hlsl.meta.slang. Update the existing spirv/fwidth.slang test with the new functions, and add a new hlsl-intrinsic/fragment-derivative.slang test to test HLSL, SPIR-V, and GLSL targets for the new functions.
* Smoke test WASM as a part of CI (#6969)Jay Kwak2025-05-01
| | | | | | | * Simplify build of slang-wasm * Add smoke-test for slang-wasm in ci * Avoid git-clone playground
* Add `IOpaqueDescriptor::descriptorAccess`. (#6967)Yong He2025-04-30
| | | | | | | * Add `IOpaqueHandle::descriptorAccess`. * Update doc. * fix.
* Initial support for immutable lambda expressions. (#6914)Yong He2025-04-30
| | | | | | | | | | | | | * Initial support for immutable lambda expressions. * More diagnostics, and langauge server fix. * Language server fix. * Fix bug identified in review. * Add expected result. * Update expected result.
* cuda: Improve entry handling for SV_DispatchThreadID (#6925)Mukund Keshava2025-04-30
| | | | | | | | | | | | | | | | | | | | | | * cuda: Improve entry handling for SV_DispatchThreadID Fixes #6780 This commit improves CUDA entry point handling by extracting appropriate components from DispatchThreadID based on parameter type. It now properly handles uint scalar (x component only) and uint2 vector (x,y components) instead of always using the full uint3 value. Add a new test case to check for this. * format code * fix CI failure * Handle review comments --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Add subscript operator support in cuda (#6830)Mukund Keshava2025-04-30
| | | | | | | | | | | | | | | | | | | * cuda: Add support for subscript operator This CL adds support for the subscript operator for Read Only textures in cuda. Also adds a test for this. Fixes #6781 * format code * fix review comments * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Support use of `this` with Mesh Shader Outputs (`IRMeshOutputRef`) (#6920)16-Bit-Dog2025-04-29
| | | | | | | * Support `this` use of `IRMeshOutputRef` * Fix SPIR-V val error There was a type mismatch causing a spir-v failiure: `store(var, var)` instead of `store(var, load(var))`
* Add Slang Byte Code generation and interpreter. (#6896)Yong He2025-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Slang Byte Code generation and interpreter. * Fix compile issues. * format code * More compile fix. * Fix clang issue. * Fix more clang issues. * Another clang fix. * Fix clang issues. * Fix another clang issue. * Fix wasm build. * Update building.md * Fix test-server. * Fix compile error. * Fix bug. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Emit SPIRV NonReadable decoration for WTexture* (#6922)Darren Wihandi2025-04-27
|
* Added getCanonicalGenericConstraints2 (sorts constraints and allows more ↵Ronan2025-04-26
| | | | generic expressions) (#6787)
* Update spirv-tools to for SDK v2025.2 (#6893)Gangzheng Tong2025-04-25
| | | | | | | | | | | | | | | | | | | | * Update spirv-tools to for SDK v2025.2 Fixes: #6850 * bump spirv version to 1.4 for op linkage * skip-spirv-validation for coop mat * add skip-spirv-validation option to slang session desc * use SPV_ENV_UNIVERSAL_1_6 for spirv-tool env target 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>
* Implemented #pragma warning (#6748)Ronan2025-04-24
| | | | | | | | | | | | | | | | | | | | | | | | * Implemented #pragma warning Based on https://learn.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-170 * Make #pragma warning work with #includes. - SourceLoc are not sorted by inclusion order. - Construct a mapping from SourceLoc to "absolute locations" that are sorted by inclusion order (roughly represents a location in a raw file with all #include resolved). - The absolute location can be used in the pragma warning timeline * Added preprocessor #pragma warning tests. - Fixed #pragma warning (push / pop) SourceLoc - Fixed unused directiveLoc in #pragma warning parsing * #pragma warning: Added some comments and fixed some typos * Cleaned #pragma warning preprocessor implementation. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Fix attempt to construct an abstract AST node (#6905)Theresa Foley2025-04-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Work on #6892 The function `tryInferLoopMaxIterations` in `slang-check-stmt.cpp` was doing: auto litExpr = m_astBuilder->create<LiteralExpr>(); but the declaration of `LiteralExpr` in `slang-ast-expr.h` had been marked as abstract, during the switch to using the `slang-fiddle` tool to generate code: FIDDLE(abstract) class LiteralExpr : public Expr { ... } In this case, the intention of the AST design is that `LiteralExpr` should be kept abstract, and only the concrete subclasses should ever be instantiated. Because of some historical design choices, the `ASTNodeType` enumeration includes both the concrete and abstract AST classes, so the code ended up constructing a `LiteralExpr` that had the tag `ASTNodeType::LiteralExpr`. Then attempts to use the `ASTNodeDispatcher` code on such a node caused crashes, because the dispatcher code only included `case` statements for the non-abstract `ASTNodeType`s. The quick fix here was to change the `tryInferLoopMaxIterations` function to instead do: auto litExpr = m_astBuilder->create<IntegerLiteralExpr>(); A test case was added to help catch any future regressions on this specific issue. A more long-term fix should involve introducing code that statically and/or dynamically prohibits the creation of instances of AST node classes that have been marked abstract.
* update slang-rhi (#6587)Simon Kallweit2025-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * update slang-rhi submodule * slang-rhi API changes * disable agility sdk * fix texture creation * update formats in tests * Extent3D rename * use 1 mip level for 1D textures for Metal * fix texture upload * update to latest slang-rhi * update slang-rhi * format code * update slang-rhi * do not run texture-intrinsics test on metal * update slang-rhi * deal with failing tests * fix more tests * update slang-rhi --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Simon Kallweit <simon.kallweit@gmail.com>
* Fix #6544: Properly format nested type names in extensions (#6769)Harsh Aggarwal (NVIDIA)2025-04-24
| | | | | | | | | | | | | | | | | * Fix #6544: Properly format nested type names in extensions Modify DeclRefBase::toText to properly handle types defined in extensions by qualifying them with their parent type name. This ensures getFullName() returns the full name like 'FullPrecisionOptimizer<half>.State' instead of just '.State'. Also handle other nested types in structs/classes similarly. * Update extension reflection handling - with generics args and namespaces - stopping namespace inclusion for extension members - Update to use getTargetType() to handle the generic arguments - update test cases * Simplify code to remove using parentDecl
* Implement shader subgroup rotate intrinsics (#6878)Darren Wihandi2025-04-22
| | | | | | | | | | | | | * Initial implementation for SPIRV, GLSL and Metal * test add bool test * Fix and improve subgroup rotate tests * Add proper GLSL extensions and proper Metal type checking * Clean up tests and add diagnostics test for subgroup type for Metal * Update wave-intrinsics docs
* 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 quad control required SPIRV version for emit-spirv-via-glsl (#6869)Darren Wihandi2025-04-21
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Allow simplifying self-referential Phi parameters (#6870)Julius Ikkala2025-04-21
|
* Implement 64bit countbits intrinsic (#6433) (#6845)sricker-nvidia2025-04-19
| | | | | | | | | | | | | Change modifies the countbits intrinsic to use generics in order to support 64bit countbits on select platforms where this is supported. On platforms where this is not natively supported, we emulate by converting the 64-bit type into a uint2 (metal and spir-v). This should align with the implementation of other uint64_t intrinsics such as abs, min, max and clamp. Added new countbits64 test to verify changes. Updated documentation for 64bit-type-support.html
* Fix regression in partial specialization of existential arguments (#6818)kaizhangNV2025-04-17
| | | | | | | | | | | | | | | | | | | | | | Close #6589. In PR #6487, we support partial specialization. However there is a corner case we didn't handle correctly. For the IR like this: %val: specialize(...) = some inst; %arg1: specialize(...) = makeExistential(%val, ...); %arg2: %SomeConcreteType: load(...); call func(%arg1, %arg2); when we specialize the call func instruct, we will also specialize the function parameters. On our existing logic, when we find an argument is a makeExistential, we will always extract the existential value, and use its type as the new parameter. But in this case, %arg1 is not fully specialized yet, so it's type will still be a specialize. In this case, we will change the function's first parameter from an existential type to a specialize. This will result in that we lose the chance to specialize the first argument in the next iteration, because the first parameter of this function is not an existential type any more. The reason behind this is that we should always keep specializing the arguments and parameters at the same time. So this PR just does a check before specializing the parameters that if the argument cannot be fully specialized, we won't specialize the parameter this early. Instead, we will wait for the next iteration until the argument can be specialized.
* Fix SV_InstanceID for emit-spirv-via-glsl path (#6848)Darren Wihandi2025-04-17
|
* Skip cooperative vector tests when the graphics driver doesn't support it ↵Jay Kwak2025-04-16
| | | | | | | (#6841) With this PR, cooperative-vector tests will run only when the hardware can support the feature. Unfortunately, DX12 backend will always reports that cooperative-vector is NOT supported until it is officially supported in May.
* Add cooperative matrix 1 support (#6565)Darren Wihandi2025-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * initial wip for spirv * working tiled example * clean up store and load * minor fixes * fix loadAny name * add initial tests, including broken/unimplemented intrinsics * fix subscript * run tests at 16x16, remove not supported arithmetic tests * minor fixups on implementation * rename CoopMatMatrixUse * Update tests to pass validation layers locally * Add mat-mul-add test and minor fixes * Add more tests * Remove dead code * Add coopMatLoad function and tests, enforce constexpr for matrix layout * Use getVectorOrCoopMatrixElementType in place of getVectorElementType
* 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>
* Fix User Attribute string reflection (#6799)Devon2025-04-14
| | | | | | | | | | | * Fix User Attribute string reflection Fixes #6794 * Fix strings not being properly escaped --------- Co-authored-by: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
* Add SV_PointCoord to match gl_PointCoord (#6795)Julius Ikkala2025-04-14
| | | | | | | | | | | * Add gl_PointCoord support in GLSL compat mode * Add SV_PointCoord * Test on metal as well * Update SPIRV system value semantics table in docs * Update metal docs for SV_PointCoord
* Fix pointer field/member access for GLSL (#6798)Darren Wihandi2025-04-13
| | | | | | | | | * Fix pointer field access for GLSL * Add test * Fix SPIRV test * add spirv via glsl test
* Add slang-test check for D3D11 double support (#6761)aidanfnv2025-04-12
| | | | | | | | Fixes #6171 This commit adds logic for reporting double support to the d3d11 backend, for running tests on GPUs that do not support D3D11_FEATURE_DOUBLES, and add checks for that support to tests that require the feature.
* Add flag to hoist instructions (#6740)jarcherNV2025-04-11
| | | | | | | | | This fixes issue #6654 Only hoist instructions that are optimized by prepareFuncForForwardDiff. Add flag hoistLoopInvariantInsts to IRSimplificationOptions and set this to true only if called from prepareFuncForForwardDiff, then only hoist if the flag is set. Additionally, do not hoist loops if they only have a single trivial iteration.
* 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
* Get real value for typeAdapter (#6762)Gangzheng Tong2025-04-09
| | | | | | | | | | | | | * Get real value for typeAdapter When the type is mismatch and typeAdapter is used, get the real value from typeAdapter so that we don't get nullptr for irValue. This fixes the assert if uint is used for SV_VertexID, which is an int in the system binding semantic. Fixes: #6525 * Add test case; add nullptr check
* warn when the user puts a file extension in an implementing directive (#6757)Ellie Hermaszewska2025-04-08
| | | Closes https://github.com/shader-slang/slang/issues/5995
* 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>
* Add defer statement (#6619)Julius Ikkala2025-04-06
|
* Fix crash when using GLSL global uniforms and varying inputs/ouputs together ↵Darren Wihandi2025-04-05
| | | | | | | | | | | | | | | | | | | | | (#6651) * Fix incorrect assert on mixed global uniform and varyings * add test * remove unnecessary include * fix incorrect logic * fix comment grammar * address review comments and improve test * minimize diff * fix more issues for cuda build * remove unnecessary line for diff