summaryrefslogtreecommitdiff
path: root/tests/spirv
AgeCommit message (Collapse)Author
2024-07-10Specialize address space during spirv legalization. (#4600)Yong He
* Specialize address space during spirv legalization. * Fix. * Fix building doc. * Fix cmake. * Update assert.
2024-07-01Supply SPIRV capability for textureQueryLod (#4522)venkataram-nv
2024-06-12Add slangc flag to `-zero-initialize` all variables (#3987)ArielG-NV
* Default (zero'd) values with `-zero-initialize` flag Adds `-zero-initialize` flag to set values to a __default() expression if they are missing a initExpr. * address review and ensure __default calls ctor + zero's fields. 1. We must keep zero-initialize in SemanticsDeclHeaderVisitor. This is done because else a ctor will be initialized before we can set struct fields to `__default`. 2. IRDefaultCtorDecoration was added to track default ctor's with parent struct. 3. ParentAggTypeModifier was added to track ChildOfStruct->IRType for sharing data such as with functions. This is required to ensure we associate a lowered function with a lowered struct type * Removed decoration to track defaultCtor in favor of field. This was done since decorations are checked for IR objects, storing auxillary info does not work here as a result if usable object. * address some review comments Since `IDefaultInitializable` is taking a considerabley larger amount of time than anticipated I am pushing some of the other fixes requested. I did not remove the "IRStruct storing a default Ctor" hack yet. mostly renamed/adjusted tests to work as intended added test to ensure we don't synthisize a junk `= 0` when not in `zero initialize` mode removed member in favor of sharedContext+dictionary. * a working but incorrect impl * default init without any IR hacks (fully working aside from generic/containored-types) * Finish zero init code 1. IDefaultInitializer interface was added. If conforming, your type may be zero-initialized. To Conform a `__init()` is required 2. `[OnlyAutoInitIfForced]` was added. This attribute states that a default initializer should only be implicitly called if forced by the compiler (`zero-initialize` for example). This allows types which implicitly/explicitly conform to IDefaultInitialize to have optional auto-init behavior (which is Slang's default for user structs) to be disabled. * note about `[OnlyAutoInitIfForced]`. This is required for std-lib to not automatically resolve init-expressions for std-lib, but it has the added benifit of allowing user made structs/classes to control the default behavior of initializing * fix ErrType assumption * testing why dx12 fails local but passes CI * push vector changes to generic test * push syntax adjustment, still figuring out what is wrong with cuda. * remove debug changes & adjust style * fix field-init expressions with structs initializers don't init a static in a ctor. This would be illegal code and wrong code (init list in lower-to-ir) * minor adjustments temporarily while the rest of the issue is discussed * fix * implement IDefaultInitializable * remove a unneeded whitespace change * fix type checking error should be checking if a valid type is `Type`, not `BasicExpressionType` * needs to be DeclRefType, not Type * fix langguage server error * change findinheritance for correctness + cleanup * remove return false verified the issue was `findInheritance` * push attempt at language server fix * still trying to fix inheritance * added extension support, remove redundant code Did not address all review comments yet, want to see if CI also passes my changes * undo a change which caused CI to fail * change logic + DefaultConstructExpr setup code to use defaultConstructExpr when possible to construct a default without overhead of invoke/related also changed code so parent's defaultInitializable propegates to derived member * 1. fix error in `isSubtype` 2. add flag to isSubtype `subtypeInheritanceIsNotFullyResolved` was added since we may not be done the lookup stage but still require `isSubtype` checking to verify usage of inheritance while working with inheritance. In This case we will just skip `ensureLookup` and "caching" (since we don't have a cache invalidation system, nor need) * fix bug in logic + add test to better catch the bug * address comment + isSubTypeOption + wrapper type test, * fix wrong code adjustment I checked on the CI and realized I caused a failure, mistake was made not negating some code * syntax, class naming capital * remove stdlib default initialize changes, replace with `__default()` for init * remove redundant code + fix defaultConstruct emitting previously defaultConstruct emitting was crashing due to having generics unresolved. By not resolving the default construct immediately, everything works. * remove a coment * add test to ensure static variables dont `init` inside a struct's `__init` * fix Ptr members breaking struct use * address review and add -zero-initialize test `-zero-initialize` test was added to be sure debug pointers are not broken with default init values --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-06-12Add option to preserve shader parameter declaration in output SPIRV. (#4344)Yong He
* Add option to preserve shader parameter declarations in output. * Add test.
2024-06-11Fix global value inlining for spirv_asm blocks. (#4339)Yong He
2024-06-11SPIRV backend: add support for tessellation stages, (#4336)Yong He
2024-06-11Fix `GetAttributeAtVertex` for spirv and glsl targets. (#4334)Yong He
2024-06-10Fix SPIRV emit for `Flat` decoration and TessLevel builtin. (#4318)Yong He
2024-06-10Support all integer typed indices in StructuredBuffer Load/Store/[]. (#4311)Yong He
* Support all integer typed indices in StructuredBuffer Load/Store/[]. * Fix tests. --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2024-06-08SPIRV `Block` decoration fixes. (#4303)Yong He
* SPIRV `Block` decoration fixes. - SPIRV does not allow duplicate `Block` decorations. So we shouldn't be generating them. - Also fixes duplication of OpName. - SPIRV and HLSL do not allow ConstantBuffer with trailing unsized arrays. Added a check in the front-end against such code. * Convert failing cross-compile tests to filecheck. --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2024-06-01Support different SPIRV versions. (#4254)Yong He
2024-05-30Support SPIR-V DebugTypePointer (#4228)Jay Kwak
2024-05-30Update document regarding pointer (#4248)Jay Kwak
And also add an actual test case from the User Guide example.
2024-05-14Remove use of `G0` and `__target_intrinsic` in stdlib. (#4170)Yong He
* Remove use of `G0` and `__target_intrinsic` in stdlib. * Fix. * Fix calling intrinsic in global scope.
2024-05-08Support `getAddress` of a single-element vector swizzle. (#4138)Yong He
Fixes #4112.
2024-05-08Support `[__ref]` attribute to make `this` pass by reference. (#4139)Yong He
Fixes #4110.
2024-05-08Fix legalization of `kIROp_GetLegalizedSPIRVGlobalParamAddr`. (#4141)Yong He
2024-05-03Fix `Ptr::__subscript` to accept any integer index. (#4100)Yong He
* Fix `Ptr::__subscript` to accept any integer index. * Fix `Ptr::__subscript` to allow 64bit indices.
2024-05-01SPIRV: Fix performance issue when handling large arrays. (#4064)Yong He
* SPIRV: Fix performance issue when handling large arrays. * Add test for packing. * Fix clang.
2024-05-01SPIRV: Fix storage class for unwrapped pointers (#4068)cheneym2
In SPIRV legalization, a struct wrapper is created around push constants but is not itself legalized. Putting the struct type into the work list causes the storage access of the push constant pointer to be PhysicalStorageBuffer as expected, instead of Function scope that was produced without the added struct legalization. Adds a SPIRV test that exercises the fix. Fixes #3946 Co-authored-by: Yong He <yonghe@outlook.com>
2024-04-19Enable NonUniformResourceIndex support for glsl, hlsl and spirv (#3899)sriramm-nv
Fixes #387676* ForceInline SampleLevel to allow decorations to apply * explictly add all the SPIRVAsmOperand Insts in non-differentiable list, which might get inadvertently processed when these functions are inlined into the main shader * Support NonUniformResourceIndex for SPIR-V target Fixes #3876 * add a new IR instruction for NonUniformResourceIndex * slang ir emitter for nonuniform resource index * update the hlsl meta slang * Add test cases for NonUniformResourceIndex access for buffers and textures, with/without cast, nested access etc. * add default c-like emitter for nonuniformresourceinfo * added hlsl emitter * added glsl emitter * requisites for spirv enabling - new decorator for nonuniformresourceindex - emitter for nonuniformresourceindex signature change * add hasResourceType checker * add rwStructBuffType in resourcetype checker * add a case for nonuniformres in emitDecorations * DO NOT COMMIT: This change adds special handling for RWStructBuf within the isResourceType function, if it is a pointer to this resource, return true to make it work with nonuniformres test * spirv emitter for decorations - update the emitLocalInst to perform decorations at the end * added main spirv emitter code * slang emit spirv bugfix * hacky way of supporting Call Inst * move code to cleanup nonuniform inst into helper function * remove stale codefrom test * add spirv decoration for nonuniform * update test to remove global variables * update coherent-2 test * update comment for special handling * update the spirv legalize to handle nested nonuniforms improved logic that handles call ops, rwstructbuf, nested nonuniforms etc. * update nonuniform-array-of-tex test * missed removing nonuniform inst causing duplicate decorations * add glsl and hlsl variants of nonuniform tests * repurpose the hasResource function into something specific for nonuniform inst decoration helper * clean up comments and code around spirv-legalization to emit nonuniform inst by recursively looking into the inst * use the helper canDecorateNonUniformInst to convert `nonUniformResourceInfo` inst to decoration * converted compute/unbounded-array-of-array cross compile test into a simple check test * update contains Resource helper function to be more generic * clean up the case for opcall handling with nonuniform resource inst * update ptr to struct buffer check to be more explicit and rename the function to check for ptr to resource type * update comments and fix the test for coherent * fix typos * update logic on spirv legalize to delete dead instructions - for some reason this doesn't automatically happen * add comments to declarations * add NonuniformResourceIndex to the non-differential inst list
2024-04-10Properly compile `gl_WorkgroupSize`. (#3925)Yong He
* Properly compile `gl_WorkgroupSize`. * Update source/slang/slang-ir-translate-glsl-global-var.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
2024-04-03Not emit DepthReplacing when frag shader uses SV_Position. (#3893)Yong He
2024-04-03Update glsl intrinsic for GroupMemoryBarrierWithGroupSync (#3890)Yong He
* Update glsl intrinsic for `GroupMemoryBarrierWithGroupSync`, * Add spirv tests for `GroupMemoryBarrierWithGroupSync`.
2024-04-02Fix the erroneous logic of determining whether or not to emit ↵Yong He
DepthReplacing. (#3885) * Fix the erroneous logic of determining whether or not to emit DepthReplacing. Closes #3884. * Fix. * More cleanup.
2024-03-25Fix missing PerPrimitive decoration in mesh shader output. (#3828)Yong He
2024-03-21Partially implement vk_buffer_ref proposal. (#3814)Yong He
2024-03-21Support arrow operator `->` on pointers. (#3812)Yong He
2024-03-20Fix spirv generation for using output stream in a function. (#3806)Yong He
* Fix spirv generation for using output stream in a function. * polish.
2024-03-18Fix SPIRV for mesh shaders, checks for invalid target code&recursion. (#3788)Yong He
* Fix #3780. * Fixers #3781. * Add test for #3781. * Diagnose error on unsupported builtin intrinsic types. * Add check for recursion. * Fix. * Fix. * Fix recursion detection. * Fix. * Fix. * Fix recursion logic. * More fix.
2024-03-12Fix `sessionDesc.defaultMatrixLayoutMode` being ineffective. (#3753)Yong He
* Fix `sessionDesc.defaultMatrixLayoutMode` being ineffective. * Fix matrix layout in buffer pointer. * Attempt to fix. * Fix buffer element type lowering for buffer pointers. * Add comment. * Fix test. * Fix member lookup in `Ref<T>`. * Fix validation error. * Enhance test.
2024-03-12Make type names spec-conformant in SPIRV reflect. (#3748)Yong He
* Preserve ByteAddressBuffer user type name. * Make user type lowercase. * Make typenames conform to spec. * Use `SpvOpDecorateString`.
2024-03-12[SPIRV] Use VectorTimesScalar opcode. (#3737)Yong He
* [SPIRV] Use VectorTimesScalar opcode. * Fix.
2024-03-11Add `-fvk-use-dx-position-w` and fix ExecutionMode ordering for geometry ↵Yong He
shaders. (#3731) * Add `-fvk-use-dx-position-w`. * Fix ordering of OutputVertices and output primitive type decoration in spirv. * Fix. * fix * Fix. * Move test around.
2024-03-10Fix spirv builtin for `SV_ShadingRate`. (#3730)Yong He
2024-03-08[SPIRV] fix code gen for `SV_Coverage`. (#3718)Yong He
* [SPIRV] fix code gen for `SV_Coverage`. * Fix #3714, #3699. * Fix.
2024-03-07[SPIRV] Fix pointer lowering bug. (#3713)Yong He
* [SPIRV] Fix pointer lowering bug. * Update falcor CI setting.
2024-03-03Fix SPIRV pointer codegen. (#3664)Yong He
2024-03-01Make slangc commandline parsing compatible with renderdoc. (#3658)Yong He
* Make slangc commandline parsing compatible with renderdoc. * Fix tests.
2024-03-01Various SPIRV fixes. (#3655)Yong He
* Various SPIRV fixes. * Fix debugValue.
2024-02-28[SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644)Yong He
* [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix.
2024-02-23SPIRV Fixes. (#3622)Yong He
* Use SpvSourceLanguageSlang enum. * Fix spirv entrypoint interface. * Cleanup. * Add error on unknown spirv opcode. * Fix CI. * Fix.
2024-02-21Fix SPIRV lowering issue. (#3608)Yong He
* Fix SPIRV pointer lowering issue. Fixes #3605. * Add another pointer test. Fixes #3601. * Fixes #3600. * Fix #3595.
2024-02-10Fix spirv legalization of nested ararys. (#3567)Yong He
* Fix spirv legalization of nested ararys. * Fix test.
2024-02-08Support pointers in SPIRV. (#3561)Yong He
* Support pointers in SPIRV. * Fix test. * Enhance test. * Fix test. * Cleanup.
2024-02-05Add per-buffer data layout control. (#3551)Yong He
* Add per-buffer data layout control. Fixes #3534. * Fixes. * Robustness. * Update test. * Fix.
2024-02-03Fix spirv emit that leads to pathological downstream time. (#3546)Yong He
2024-01-24[SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488)Yong He
* [SPIRV] Support `globallycoherent` modifier. * Fix. * Disable executable cooperative vector tests. * Update expected failure. * [SPIRV] Emit varying output index decoration. * Add test. * Update tests. * Fix test. * Emit `SpvExecutionModeEarlyFragmentTests`. * Lower `StructuredBuffer<bool>`. * Support globallycoherent on ByteAddressBuffer. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-23SPIRV Legalization fixes. (#3479)Yong He
* Fix CFG legalization for SPIRV backend. * Emit DepthReplacing execution mode. * Fix do-while lowering. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-22Bug fixes for the direct spirv backend. (#3474)Yong He
* Fix GLSL legalization bug that leads to crash. * Update diagnostic id to avoid conflict. * Fix std140 layout logic. --------- Co-authored-by: Yong He <yhe@nvidia.com>