| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
| |
There was a bug that causes the compiler failing to treat a `no_diff
TypePack` as a type pack, and thus diagnose an error when resolving the
following call.
The fix is to unwrap any ModifiedType wrappers in `IsTypePack()` check.
|
| |
|
|
|
|
|
|
|
|
| |
Fixes #8439
When checked, generic type equality constraints types are now in a
canonical order, allowing for a commutative type equality operator.
---------
Co-authored-by: Mukund Keshava <mkeshava@nvidia.com>
|
| |
|
|
|
|
|
|
|
| |
Changes default for render-test to sm_6_5.
Since sm_6_5 is the new default, remove the -use-dxil option, add
-use-dxcb option
Remove -use-dxil option from all test cases.
Add -use-dxcb to two tests that needed it.
Fixes #7611
|
| |
|
|
|
|
|
|
|
| |
* emit literal values in getTypeNameHint for bool, str etc.
* add test for specializing generics with bool literals
* fix build error
* add specializing with Enum type test
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Do not print errors in _coerce when "JustTrying".
While figuring out which generic-overload works best, `_coerce()` is
printing errors and Slang compilation terminates prematurely.
When `TryCheckGenericOverloadCandidateTypes()` is calling `_coerce()` in
"JustTrying" mode, the error messages should be snoozed.
The following logic shows the intention of how to silence the error
messages, but the chain of `sink` was broken in the middle and
`_coerce()` was using `getSink()` from the SemanticVisitor.
val = ExtractGenericArgInteger(
arg,
getType(m_astBuilder, valParamRef),
context.mode == OverloadResolveContext::Mode::JustTrying ? nullptr : getSink());
* Use tempSink when available.
|
| |
|
|
| |
generic expressions) (#6787)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fixed generic interface specialization crashes:
- Add an export decoration to specialized generic interfaces.
* Fixed generic interface specialization crashes:
- Add an export decoration to specialized generic interfaces.
- Use getTypeNameHint(...) instead of a manual mangler.
* In cloneInstDecorationsAndChildren: specialize all linkage decorations, not just the exports.
- If a linkage decoration is already present, it is not specialized and replaced by the specialized one.
- If a specialization uses the TypeNameHint, sanitize it to be used as an identifier.
- Use the identifier name sanitizer from slang-mangle.
* Added tests/generics/generic-interface-linkage.slang
- See #6601 and #6688
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#6121)
* Fix circularity issue with checking multiple generic interface constraints
* Create multi-generic-interface-constraint.slang
* Update multi-generic-interface-constraint.slang
* Update slang-check-inheritance.cpp
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
| |
* Allow __subscript<T> syntax.
* Fix.
|
| |
|
|
|
|
|
| |
* Fix prebound parameter pack - argument list matching logic.
* Move tests.
* Fix.
|
| |
|
|
|
|
|
|
|
| |
Require the 'half' rendering feature for WebGPU, so that we can detect when
the f16 feature is not available, for the following tests:
- tests/language-feature/generics/tuple.slang
- tests/language-feature/generics/variadic-0.slang
This helps to address issue #5605.
|
| |
|
|
|
|
|
|
|
| |
Some tests are now passing and are enabled.
Other tests are still failing, but are given comments categorizing the failures.
Tests in the 'Not supported in WGSL' category are also removed from the expected failures
list. (Though they are still kept disabled for WebGPU, of course.)
This closes #5519.
|
| |
|
| |
This closes issue #5505.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix WGSL parameter block binding.
* Re-enable tests.
* Update failure list.
* Fix entrypoint parameters.
* Update tests.
* Enable stat-var test.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
(#5200)
* Fix crash when compiling associatedtypes with generic interface constraints.
* delete hlsl.meta.slang.temp.h.
* Fix.
|
| |
|
|
|
|
|
|
|
| |
* Add `IRWArray` interface, and make StructuredBuffer conform to them.
* Update user guide.
* Fix.
* Fixes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix inccorect dropping of declref during Unification of DeclaredSubtypeWitness.
* Add extension test.
* Specialize existential return types when possible.
* Fix.
* Fix.
* Fix falcor issue.
|
| |
|
|
|
|
|
| |
DeclaredSubtypeWitness. (#5041)
* Fix inccorect dropping of declref during Unification of DeclaredSubtypeWitness.
* Add extension test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support `where` clause.
* Fix.
* Fix parser.
* Enhance test to cover traditional __generic syntax.
* Update user-guide.
* Support `where` clause on associatedtype.
* Fix.
* Put in more comments.
|
| |
|
|
|
|
|
| |
* Make sure `NullDifferential` and its witness are removed after autodiff.
* Fix.
* Add a test.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Support dependent generic constraints.
* Fix warning.
* Update comment.
* Fix.
* Add a test case to verify fix of #3804.
* Address review.
|
| |
|
|
|
|
|
|
|
| |
* Variadic Generics Part 2: IR lowering and specialization.
* Update design doc status.
* Update design doc.
* Resolve review comments.
|
| |
|
|
|
|
|
|
|
|
|
| |
* Allow generic type deduction from ParameterBlock arguments.
* Fix test.
* Update expected failure list.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* Fix lowering of static consts in a generic function.
* Fix.
* Fix.
* Fix lowering of shading rate builtin.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support visibility control and default to `internal`.
* Fix wip.
* Fixes.
* Fix.
* Fix test.
* Add legacy language detection and compatibility for existing code.
* Add doc.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Improve generic type argument inference.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* wip: clean up IArithmetic
* wip.
* Cleanup builtin arithmetic interfaces.
* Fix.
* Fixes.
* Fix.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Parameter binding and gfx fixes.
* Add diagnostics on entry point parameters.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial support for generic interfaces.
* Cleanup.
* Add generic syntax for interfaces.
* Add `IArray`.
* Fix.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Initial support for generic interfaces.
* Cleanup.
* Add generic syntax for interfaces.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A commonly requested feature is to be able to supply only some
of the arguments to a generic explicitly, while allowing the rest
to be inferred. A common example is a function that performs some
kind of conversion:
To convert<To, From>( From fromValue ) { .... }
A user would like to be able to call this operation like:
int i = convert<int>( 1.0f );
but the current Slang type checker requires all or none of the generic
arguments be supplied. Supplying all of the arguments is tedious:
int i = convert<int, float>( 1.0f );
In this case, the `float` type argument is redundant and could be
inferred from context. However, if the user tries to omit the generic
argument list:
int i = convert( 1.0f );
The current type-checker cannot infer the `int` type argument (even if
one might claim it *should* infer based on the desired result type).
This change adds support for the `convert<int>(...)` case, by allowing
a generic to be applied to a prefix of its explicit arguments, and then
inferring the remaining arguments from contextual information when that
"partially applied" generic is applied to value-level arguments.
Most of the changes are just plumbing: adding the notion of a partially
applied generic and then supporting them during overload resolution.
A single test case is included that covers the `convert`-style use case.
It is likely that more testing is needed to cover failure modes of this
feature.
|
| |
|
|
|
|
|
| |
* Small fix to enable generic typealias.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* Compiler time evaluation of all int and bool operators.
* Fix linux compile error.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
| |
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Warning on bool to float conversion.
* Fix test cases.
* Improve.
* LanguageServer: don't show constant value for non constant variables.
* Fix tests.
* Fix warnings in tests.
Co-authored-by: Yong He <yhe@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change converts a large number of our existing tests to use the `ShaderObject` support that was added to the `gfx` layer.
In many cases, tests were just updated to pass `-shaderobj` and the result Just Worked.
In other cases, a `name` attribute had to be added to one or more `TEST_INPUT` lines.
For tests that did not work with shader objects "out of the box," I spent a little bit of time trying to get them work, but fell back to letting those tests run in the older mode.
Future changes to the infrastructure will be needed to get those additional tests working in the new path.
Along with the changes to test files, the following implementation changes were made to get additional tests working:
* Because the shader object mode uses explicit register bindings (from reflection), the hacky logic that was offseting `u` registers for D3D12 based on the number of render targets gets disabled (by another hack).
* The "flat" reflection information coming from Slang was not correctly reporting "binding ranges" for things that consumed only uniform data (which would be everything on CUDA/CPU), so it was refactored to properly include binding ranges for anything where the type of the field/variable implied a binding range should be created (even if the `LayoutResourceKind` was `::Uniform`).
* A few fixes were made to the CUDA implementation of `Renderer`, in order to get additional tests up and running. Most of these changes had to do with texture bindings, which hadn't really been tested previously.
In addition, a few changes were made that were attempts at getting more tests working, but didn't actually help. These could be dropped if requested:
* As a quality-of-life feature (not being used) the `object` style of `TEST_INPUT` line is upgraded to support inferring the type to use from the type of the input being set.
* Any `object` shader input lines get ignored in non-shader-object mode.
|
|
|
* Fixes for IR generics
There are a few different fixes going on here (and a single test that covers all of them).
1. Fix optionality of trailing semicolon for `struct`s
======================================================
We have logic in the parser that tries to make a trailing `;` on a `struct` declaration optional. That logic is a bit subtle and couild potentially break non-idiomatic HLSL input, so we try to only trigger it for files written in Slang (and not HLSL). For command-line `slangc` this is based on the file extension (`.slang` vs. `.hlsl`), and for the API it is based on the user-specified language.
The missing piece here was that the path for handling `import`ed code was *not* setting the source language of imported files at all, and so those files were not getting opted into the Slang-specific behavior. As a result, `import`ed code couldn't leave off the semicolon.
2. Fix generic code involving empty `interface`s
================================================
We have logic that tries to only specialize "definitions," but the definition-vs-declaration distinction at the IR level has historically been slippery. One corner case was that a witness table for an interface with no methods would always be considered a declaration, because it was empty. The notion of what is/isn't a definition has been made more nuanced so that it amounts to two main points:
* If something is decorated as `[import(...)]`, it is not a definition
* If something is a generic/func (a declaration that should have a body), and it has no body, it is a declaration
Otherwise we consider anything a definition, which means that non-`[import(...)]` witness tables are now definitions whether or not they have anything in them.
3. Fix IR lowering for members of generic types
===============================================
The IR lowering logic was trying to be a little careful in how it recurisvely emitted "all" `Decl`s to IR code. In particular, we don't want to recurse into things like function parameters, local variables, etc. since those can never be directly referenced by external code (they don't have linkage).
The existing logic was basically emitting everything at global scope, and then only recursing into (non-generic) type declarations. This created a problem where a method declared inside a generic `struct` would not be emitted to the IR for its own module at all *unless* it happened to be called by other code in the same module.
The fix here was to also recurse into the inner declaration of `GenericDecl`s. I also made the code recurse into any `AggTypeDeclBase` instead of just `AggTypeDecl`s, which means that members in `extension` declarations should not properly be emitted to the IR.
Conclusion
==========
These fixes should clear up some (but not all) cases where we might emit an `/* unhandled */` into output HLSL/GLSL. A future change will need to make that path a hard error and then clean up the remaining cases.
* fixup: tabs->spaces
|