summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/modules
Commit message (Collapse)AuthorAge
* Allow entry points with missing numthreads on CPU targets (#8678)Julius Ikkala2025-10-10
| | | | | | | | | | | | | | | | | | | | | | | Several tests have compute entry points without a `[numthreads(x,y,z)]` decoration. Currently, none of these tests run on the CPU target, as they crash the compiler. I took a look at the SPIR-V emitter, which falls back to a workgroup size of (1,1,1): https://github.com/shader-slang/slang/blob/1e0908bd7107dfbdac912b693c3ab9bd6e1dc8b3/source/slang/slang-ir-spirv-legalize.cpp#L1635-L1643 To match this behaviour, this PR implements a fallback solution that makes `emitCalcGroupExtents()` emit (1,1,1). This PR is both a question and a suggestion; I'm not sure the approach here is at all reasonable. Personally, I'd just like to explicitly add `[numthreads(1,1,1)]` to all such tests, but I don't know if it's actually legal and supported to not have a `numthreads`. So the implementation here is a bit conservative. I ran across these when I went through tests for the upcoming LLVM target. These were the final blockers to get all autodiff and language-features tests passing (not counting the ones using things like wave intrinsics and barriers etc.)
* Use symbol alias instead of wrapper synthesis to implement link-time types. ↵Yong He2025-10-07
| | | | | | | | | | | | | | | | | | | | | | | | | | (#8603) This change achieves link-time type resolution with a different mechanism. For `extern struct Foo : IFoo = FooImpl;`, instead of synthesizing a wrapper type `Foo` that has a `FooImpl inner` field and dispatches all interface method calls to `inner.method()`, this PR completely removes this synthesis step, and instead just lower such `extern`/`export` types as `IRSymbolAlias` instructions that is just a reference to the type being wrapped. Then we extend the linker logic to clone the referenced symbol instead of the SymbolAlias insts itself during linking. By doing so, we greatly simply the logic need to support link-time types, and achieves higher robustness by not having to deal with many AST synthesis scenarios. Closes #8554. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Fix public unscoped enum constants not visible across module boundaries (#7864)Copilot2025-07-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial plan * Fix public unscoped enum constants visibility across module boundaries Add visibility modifier copying in CompleteDecl for unscoped enum cases. When synthesizing static const declarations for unscoped enum cases, copy the visibility modifiers from the original enum declaration to ensure they have the same visibility scope across module boundaries. Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Create new visibility modifier instances instead of sharing existing ones Address reviewer feedback to avoid sharing modifier instances between declarations since modifiers form a linked list. Now creates new instances of the appropriate visibility modifier type (Public, Private, or Internal) instead of reusing the existing instance. Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Move unscoped enum visibility tests into subdirectory structure Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Use createByNodeType for visibility modifier creation as suggested Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * format code (#7867) Co-authored-by: slangbot <186143334+slangbot@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: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
* Fix intermittent debug failures with Debug build (#7369)Jay Kwak2025-06-12
| | | | | 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
* Disable 23 tests failing assertions (#7317)Jay Kwak2025-06-04
|
* Check mismatching method parameter direction against interface declaration. ↵Yong He2024-12-30
| | | | (#5964)
* Fix a crash when search for files. (#5818)Yong He2024-12-10
| | | Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Fix parsing logic of for loops' initial statement. (#5813)Yong He2024-12-10
|
* enable more metal tests (#4326)skallweitNV2024-06-10
|
* Metal compute tests (#4292)skallweitNV2024-06-07
|
* Parser and module finding logic fixes. (#3720)Yong He2024-03-08
| | | | | | | | | * Fix parsing logic of `struct` decl. Fixes #3716. * Allow `loadModule` to find modules with underscores. * Fix test.
* Language server robustness fix. (#3607)Yong He2024-02-20
| | | | | | | | | * Language server robustness fix. * Allow parameter name to be the same as its type. * fix * Fix test.
* Fixes for `module` and `include`. (#3519)Yong He2024-01-25
| | | | | | | | | * Fix type checking of enum cases. * Allow decl to have same name as module. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Handle import, entrypoint and global params in included files. (#3395)Yong He2023-12-08
| | | | | | | | | | | * Handle `import`, entrypoint and global params in included files. * Fix language server. * Extend `_createScopeForLegacyLookup` for `__include`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Support `include` for pulling file into the current module. (#3377)Yong He2023-12-05
| | | | | | | | | | | * Support `include` for pulling file into the current module. * Add auto-completion, hover info and goto-def support. * Disable warning for missing `module` declaration for now. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Include a "stack trace" with nested-import errors (#1872)T. Foley2021-06-06
* Include a "stack trace" with nested-import errors When errors occur in nested `#include` files it is often helpful to have a "stack trace" / traceback of the `#include` chain that led from a root translation unit to the file with an error. This change implements a similar feature for `import`s. It is worth noting that `import`s don't really *require* this kind of compiler support the way `#include`s do because the intention is that the meaning of an `import`ed file does not depend on the order or nesting of `import`s. As such, when trying to *fix* an error in an `import`ed file, you usually don't care how it came to be `import`ed into your shaders. The use case here is somebody adapting a large body of Slang code to use in a different codebase, such that they have certain `.slang` files they don't actually intend to have compile correctly, and they want to be able to diagnose how they came to include those files when/if they cause problems. The actual feature implementation is pretty simple because we already track a stack of active `import`s so that we can detect and diagnose recursive `import`s. This change simply changes the disagnostics when there is an error in imported code so that instead of just noting the inner-most `import` site it lists all the `import` sites that were active at the time. The change includes a test case to confirm that the behavior works (at least for the case of a parse error). * fixup: test outputs Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>