| Age | Commit message (Collapse) | Author |
|
* Check extensions before function parameters.
Fix decl ref formation for synthesized differentiable requirements that are inside an extension.
* Fix clang errors.
* More clang fix.
* Fix warnings.
* Fix build error.
* Fix.
* Fix typo.
|
|
* Allow implicitly casting enum types to bool.
* Fix.
|
|
Closes #4395
This commit allows Slang to use 1-dimensional matrix when targetting
HLSL. The 1-dimensional matrix is supported by DXC natively.
GLSL/Vulkan doesn't support the 1-dimensional matrix natively. It is
not trivial for Slang to convert all of matrix functions to vector or
scalar at the emitting step. We can implement this later if there are
needs. This commit disallows the use of 1-dimensional matrix for
targetting GLSL/Vulkan by the capability system; in other words, the
new 1-dimentional functions have "[require(hlsl)]".
|
|
* Add ResourceArray intrinsic type
* Move aliased parameter generation to GLSL legalization
* Add DynamicResourceEntry type for proxying layout of GenericResourceArray
* Reimplement as DynamicResource
* Add reflection test
* Don't reuse alias cache between different parameters
* Add dynamic cast extensions for buffer types
* Minor format fix
* Fix VarDecl diagnostics after finding non-appliable initializer candidates
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
|
* Allow only specific spv storage classes for binding decoration
In
https://registry.khronos.org/vulkan/specs/1.3/html/chap37.html#VUID-StandaloneSpirv-DescriptorSet-06491
it states that
If a variable is decorated by DescriptorSet or Binding, the Storage
class must be UniformConstant, Uniform and StorageBuffer.
So apply this rule to our emit-spirv logic.
* Add a unit test
* Address few comments
|
|
Fixes: #4704
Change the type we assign when getting the member variable of a legalized `ConstantBuffer<T[...]>`.
|
|
Closes #4692
This is a quick fix for the issue that SPIR-V validation error message
is not printed. A more proper way is to return the error messages to the
application and let the application handle it.
|
|
* Add decoder
* Add a replay executable to consume the decoded content
Add file-processor.cpp/h where we implement the logic to process
the captured file block by block. Each block is:
function header + parameter buffer + function tailer + function
output[optional].
After reading one block, the block of data is sent to decoder module
to dispatch the corresponding API.
Add slang-decoder.cpp/h where we implement the logic to dispatch
the slang API according to the input block data.
- Rename api_callId.h to capture-format.h
- Renmae capture_utility.cpp to capture-utility.cpp
- Renmae capture_utility.h to capture-utility.h
- Change the #include file name accordingly.
* Reorganize source files structure
Move all the capture logic code into `capture` directory.
- the capture code will be build with slang dll.
Move all the replay logic code into `relay` directoy.
- the replay code is not part of slang dll, it will be built
as a stand alone binary and link against slang dll.
Change the #include file names accordingly.
Add tools/slang-replay/main.cpp for the slang-replay stand alone
binary place holder. Will implement it later.
Update premake5.lua accordingly.
* Update cmake files
Update cmake files to change the build process for
capture and relay system.
- capture component should be build with slang dll, so we
should not include replay component.
- replay component should be a separate executable tool, which
should not include capture component.
- In order to easy use our current cmake infrastructure, move
the shared files to a `util` folder
- change the header include path
* Redesgin the interfaces of consumers
Fix some issues in capture
Finish implementing all slang-decoder functions
* Fix the AppleClang build issue
* Address few comments
- Fix the weird indent issues.
- Correct the function name for CreateGlobalSession()
- Rename file-processor to captureFile-processor to be more specific.
- Use Slang::List instead of std::vector
* record/replay: name refactor change
Refactor the naming.
Change the name "encoder/capture" to "record".
|
|
fixes: #4700
Changes:
* If a uniform object (which uses uniform locations) has explicit bindings we will warn to use `ConstantBuffer<T>` instead. We check for a warning specifically when we know an object uses uniform layouts because objects may not use a uniform-layout register even if tagged with `uniform`. A good example of this is `uniform ConstantBuffer<T>`.
|
|
Fixes: #4675
Fixes: #4683
Fixes: #4443
Fixes: #4585
Fixes: #4172
Made the following changes:
1. All capability diagnostic printing logic tries to simplify before printing. This means that we do not print atoms which imply another atom.
2. Do not print the `_` prefix part of atom names since it is misleading users on what they should use to solve a capability issue encountered. (`_Internal` `External` atom changes are not in this PR)
3. Bundle together printing of all sets which contain exactly the same atoms (excluding abstract atoms). This allows printing the following `vertex/fragment/hull/domain/... + glsl` instead of `vertex + glsl | fragment + glsl | hull + glsl | domain + glsl | ....`
4. Rework how entry-point errors are reported to users (example at bottom of PR comment)
5. Rework how atom-provenance data is collected to be leaner and more useful so we can rework the errors. There are 2 notable changes here:
* We no longer store a list which describes where the first of an `CapabilityAtom` comes from. This heavily simplifies AST logic for the capability system. AST parsing of capabilities is much faster. The trade-off is faster AST parsing and correct AST node data for slower diagnostics if an error is found
* atom-provenance data now stores a reference to an atom's use-site to provide information on **where** and **what** is wrong with user code versus only sharing **what** and not where.
|
|
* Fix for invalid swizzle causing crash
Fixes #4689
If swizzle code is provided 5+ element swizzle the checkSwizzleExpr code will do an out of bounds array access and crash.
* switch test to check for to ensure no crash
* cleanup swizzle errors to only emit once
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Support parameter block in metal shader objects.
* Ingore parameter block tests on devices without tier2 argument buffer.
* Fix warning.
* Fix texture subscript test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Fix the issue of name mangle
During our name mangling, we should add the direction of the parameter
in the name, otherwise it could have the name collision which will
result in invalid code generation:
e.g.
// in slang-module.slang
export func(float a) { ...}
// in test.slang
extern func(inout float a);
when we compile test.slang, slang will pass a pointer type to the
'func', however, in the slang-module.slang, `func` expects a value
instead of pointer. This will lead the wrong spirv code.
So we should add the parameter direction into the mangle name such
that above two symbols will have the different mangled names, and
we will catch this during IR-link stage.
* Change to use to get param direction
* Address few comments
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Metal: `Interlocked` (atomic) member function support for buffers
fixes: #4654
fixes: #4481
1. Add `Interlocked` (atomic) member function support for buffers to Metal
2. Fix `__getEquivalentStructuredBuffer` so it works with CPP/Metal targets
* add `CompareStore` support
* legalize RWByteAddressBuffer to fully replace StructuredBuffer
* destroy replaced byte-addr buffer
* cleanup as per review and add comment to explain why certain code exists
* fix flow of byte-address-buffer replacement
* toggle on option to translate byteAddrBuffer to StructuredBuffer
* cleanup unused buffers
* add treatGetEquivalentStructuredBufferAsGetThis flag to treat getEquivStructuredBuffer as a byteAddressBuffer
* comment to explain `treatGetEquivalentStructuredBufferAsGetThis`
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
column_major/row_major. (#4653)
* Allow CPP/CUDA/Metal to legalize their buffer-elements.
Fixes: #4537
Changes:
1. Matrix inputs require legalization (pack/unpack) to ensure consistent row_major/column_major throughout entire shader, the following enabled legalization pass fixes this.
2. Added missing CUDA intrinsic so CUDA can run more tests.
3. Added a memory packing test since this still fails for cpp/cuda/metal (due to having no memory packing enforcement).
* change memory packing tests to run for targets without packing
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Detect uninitialized fields in constructors
* Reachability check for early returns
* Specialized warnings for synthesized default initializers
* Handling quirks with constructors
* Addressing review comments
* Ignore synthesized constructors if they are not used
|
|
This change supports OpDebugTypePointer for a member variable whose type
is a pointer type for the outer struct that hasn't been declared yet.
It is done with new extension, "SPV_KHR_relaxed_extended_instruction",
that comes with a new instruction, "OpExtInstWithForwardRefs".
Closes #4304
|
|
Previously the warning system ignores undefined variables in nested scopes (blocks in IR).
|
|
* Initial implementation for decl-tree reflection API
This patch adds Slang API methods for walking all the declarations in the AST.
We expose this functionality through an abstract `DeclReflection` class that can be a type, function or a variable declaration.
We also provide ways to cast the decl to a `FunctionReflection`, `TypeReflection` or `VariableReflection` and traverse through the child nodes (for instance, a struct type will have component variable declarations)
This patch also adds `ISlangInternal` as an internal COM interface to allow us to cast IGlobalSession to the internal Session pointer while bypassing any wrappers (such as the capture interface)
* Update slang.h
* Remove `ISlangInternal` (its causing a diamond pattern w.r.t `ISlangUnknown`) and use `ComPtr` for proper ref management.
* Update unit-test-decl-tree-reflection.cpp
* Change `FunctionDeclBase` to use `DeclRef` instead of directly using the decl.
* Update slang-reflection-api.cpp
|
|
closes https://github.com/shader-slang/slang/issues/4667
|
|
* Add unexpected end of input error to lexer
* Add end of input test
* Simplify testcase
|
|
entry-point (#4670)
* Fixes #4656
Changes:
1. Setting a profile via slangc no-longer sets an entry-point target-stage, this is to allow slangc to follow how the SLANG-API works (else `main` is assumed to be the default entry-point)
2. If the stage specified by a profile is not equal to the stage specified by a entry-point, we throw a capability error.
3. Resolving the stage of an entry point was changed to function (mostly) equally for when 0 entry-points are specified versus to when there are 1 or more.
4. changed capabilitySet Iterator so it is invalid if backing data is nullptr (although this should never happen, it would stop crashes in the worst case).
* remove the breaking change since it likely is going to be a lot more than just a simple change due to the implicit `main` and stage through `profile` code.
* print out profile name with errors
* use target's profile for printing
* change logic to print warning in a different method (account for more cases)
* set unknown stages
|
|
* spelling
* Reduce duplication in slang lib builds
Closes (as much as possible) https://github.com/shader-slang/slang/issues/4615
The only case where we could actually make a difference would be an
embedded stdlib and static slang, which isn't a configuration anyone
actually uses. Nonetheless, clean up this bit
|
|
|
|
* Remove generated file from source and build at build time
* comments
|
|
* Add slang-llvm and slang-glslang readmes
Just extraced and updated from the original repos
* Remove redundant file
|
|
* Use slang-glslang.dll for spirv-validation
This change replaces the use of "spirv-val.exe" with an API call to
"spvtools::SpirvTools::Validate()".
Closes #4610
|
|
* Move the file public header files to `include` dir
Close the issue (#4635).
Move the following headers files to a `include` dir
located at root dir of slang repo:
slang-com-helper.h -> include/slang-com-helper.h
slang-com-ptr.h -> include/slang-com-ptr.h
slang-gfx.h -> include/slang-gfx.h
slang.h -> include/slang.h
Change cmake/SlangTarget.cmake to add include path to
every target, and change the source file to use
"#include <slang.h>" to include the public headers.
The source code update is by the script like follow:
```
fileNames_slang=$(grep -r "\".*slang\.h\"" source/ -l)
for fileName in "${fileNames_slang[@]}"
do
echo "$fileName"
sed -i "s/\".*slang\.h\"/\"slang\.h\"/" $fileName
done
```
* Fix the test issues
* Fix cpu test issues by adding include seach path
* Update cmake to not add include path for every target
Also change "#include <slang.h>" to "include "slang.h" " to
make the coding style consistent with other slang code.
* Change public include to private include for unit-test and slang-glslang
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Handle out/inout functions with separate consideration
* Fixing bug with passing aliasable instructions
* Handle autodiff functions (fwd and rev) in warning system
* Handling interface methods
* Handling ref parameters like out/inout
* Temporary fix to remaining bugs
* Refactoring methods and tests
* Recursive check for empty structs
* Using default initializable interface in tests
* Resolving CI fail
|
|
table (#4638)
|
|
|
|
|
|
|
|
(#4618)
* Add `dev` cmake preset.
* Fix incorrect codegen when returning initializer list as existential value.
* Fix cmake.
* Fixup.
|
|
generic types (#4602)
* Fix issue with synthesizing `Differential` type for self-differential generic types
The problem was that we were using the type that was performing the lookup for `.Differential` which can have substitutions based on the local context where the decl is being referenced.
We need to synthesize the type local to the decl itself
* Update auto-differential-type-generic.slang
|
|
|
|
At the moment it is always "unknown"
|
|
* Implement 64-bit version of clockARB
* Fix capability versions
* Corrections to capabilities
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* Cope with failed version parsing
* Better version parsing
* populate slang-tag-version with cmake
* Neaten cmake
|
|
* Specialize address space during spirv legalization.
* Fix.
* Fix building doc.
* Fix cmake.
* Update assert.
|
|
Spirv doesn't have instruction to do the float cast
for the matrix type. So we have to convert the matrix
row by row, and then construct them to a new matrix.
Update the unit test to make sure the cast won't miss
any elements.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Add reflection API for functions.
This change adds `SlangFunctionReflection` type in the reflection API that provides methods for querying function result type, parameters and user-defined attributes.
`ProgramLayout::findFunctionByName` can now find a function with the given name and returns a `FunctionReflection`.
`IEntryPoint` now has a `getFunctionReflection` method that returns an `FunctionReflection` for the entrypoint.
* More modifiers; make reflection API consistent.
|
|
* Treat global variables and parameters as non-differentiable when checking derivative data-flow
Global parameters are by-default not differentiable (even if they are of a differentiable type), because our auto-diff passes do not touch anything outside of function bodies.
The solution is to use wrapper objects with differentiable getter/setter methods (and we should provide a few such objects in the stdlib).
Fixes: #3289
This is a potentially breaking change: User code that was previously working with global variables of a differentiable type will now throw an error (previously the gradient would be dropped without warning). The solution is to use `detach()` to keep same behavior as before or rewrite the access using differentiable getter/setter methods.
* Fix issues with lookup witness lowering
* Update slang-ir-lower-witness-lookup.cpp
* Add tests
* Update slang-ir-lower-witness-lookup.cpp
* Cleanup
* Update nested-assoc-types.slang
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Implement non member function atomic texture support texture_buffer and texture1d
Fixes: #4538
Related to: #4291, fixes `tests/compute/atomics-buffer.slang`
Texture objects cannot use `__getMetalAtomicRef` to cast objects into atomic value type. [Texture objects mandate use of member functions](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf#Texture%20Functions). The implementation is as follows:
* We can detect texture object usage through checking for an `IRImageSubscript` Operation. `__isTextureAccess()` was added to evaluate if we have an `IRImageSubscript` operation at compile time (before `static_assert`). `__isTextureAccess()` only checks if we are targeting Metal.
* We have all parameter data needed to call a texture atomic function embedded inside `IRImageSubscript`. `__extractTextureFromTextureAccess()` and `__extractCoordFromTextureAccess()` was added to extract this data for use with Metal atomics.
Note:
* Metal documentation has various incorrect details (function names)
* Since we currently hardcode metal versions for compiling, the Metal compiler version was changed to target `Metal 3.1` (`slang-gcc-compiler-util.cpp`)
* textures do not permit atomic float operations
* add fallthrough attribute + fix bug with 'exchange instead of xor' + fix warning bug
* incorrect function name fix
* missing filecheck
* disable atomics-buffer.slang compute test since GFX issue causing it to fail
* Array support for metal interlockedAtomic and proper verification of texture with interlockedAtomic functions
* Array support for metal interlockedAtomic
* proper verification of texture with interlockedAtomic functions
note: had to seperate many functions to allow forceInlining to run
* missing getOperand(0)
* push atomic fix for metal
* fix atomic syntax for metal and hlsl emitting extra brackets (breaks tests)
* test changes and meta changes
1. max is 8 rw textures with metal because Metal has this limit. Split up tests to not hit this limit
2. added back `[0]`...,`T` to test since this legalizes metal atomic intrinsic
* macro'ify some of the atomic code
1. addresses review
2. makes code easier to modify in the future (rather than sifting through 1000 lines we can just look at ~10-30
* fix test 'check'
* missing float support due to macro
* add functions macro generates, `InternalAtomicOperationInfo`
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* initial change to test with CI for CPU/CUDA errors
* Fixes to Metal Input parameters and Output values
Note:
1. Flattening a struct is the process of making a struct have 0 struct/class members.
Changes:
1. Separated `legalizeSystemValueParameters`. This was done to make it easier to run `legalizeSystemValue` 1 system-value at a time to simplify logic. This change is optional and can be undone if not preferred.
2. Wrap everything inside a Metal legalization context. This was done since it simplifies a lot of logic and will be required for #4375
3. Created `convertSystemValueSemanticNameToEnum` and expanded the existing System-Value Enum system. This allows (sometimes) faster comparisons and helps prepare code for porting into `slang-ir-legalize-varying-params.cpp` (#4375)
4. Added a more dynamic `legalizeSystemValue` system so more than 2 types can be targeted for legalization. This is required to legalize `output`. There is still no preference for any converted type, the first valid type will be converted to.
5. Flatten all input(`flattenInputParameters`)/output(part of `wrapReturnValueInStruct`) structs and assign semantics accordingly.
6. Semantics when legalized have no specific logic other than to: 1. avoid overlapping semantics 2. Prefer assigning explicit semantics specified by a user.
7. Fixed some issue with incorrect output semantics if not a fragment stage (when there are not any assigned semantics)
* change metallib test to the correct metal test
* comment code & cleanup -- Did not address all review
Added comments for clarity + cleaned up some odd areas which were messy
* Add comment to `fixFieldSemanticsOfFlatStruct`
I found `fixFieldSemanticsOfFlatStruct` to still be confusing at a cursory glance. Added comments to make the function be more understandable.
* white space
* Address review comments
1. Fix semantic propegation.
2. Fix how we map struct fields of the flat struct to struct. This is specifically important for if reusing the same struct twice since struct member info is not unique per struct instance used.
* Fix semantic legalization by adding TreeMap
Add TreeMap to allow proper sorted-object data iteration.
* Fix some compile issues
* try to fix gcc compile error
* compile error
* fix logic bug in treeMap iterator next-semantic setter
* fix vsproject filters
* filter file syntax error
* remove need of a context to make copies stable
* Rename treemap to the more appropriate name of "treeset", adjust code comments accordingly.
* remove custom type `TreeSet` and use `std::set`
* remove TreeMap fully
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|