summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
Commit message (Collapse)AuthorAge
...
* `slangc` tool experience improvements. (#4140)Yong He2024-05-08
| | | | | | | | * `slangc` tool experience improvements. Fixes #4123. Fixes #4127. * Update doc.
* Add host shared library target. (#4098)Yong He2024-05-03
| | | | | | | | | | | | | * Add host shared library target. * Attempt fix. * Fix warnings. * try fix. * Fix test. * Fix.
* Copy default target's optionSet to code-gen target's optionSet (#4073)kaizhangNV2024-05-01
| | | | | | | | | | In current implementation, the some options will be to added to the target that is only specified by command line "-target". But if user specifies the target by just using slang API, e.g. 'spAddCodeGenTarget', those options will be missed. To fix the problem, we copy the default target's options to the code-gen target's option set. The default target will only be useful when there is no target specified in the command line.
* Fix compile failures when using debug symbol. (#4069)Yong He2024-05-01
| | | | | | | | | * Fix compile failures when using debug symbol. * Various fixes. * Fix intrinsic. * Fix test.
* Avoid classifying methods with `[numthreads]` as entry points for ↵Sai Praveen Bangaru2024-04-30
| | | | CUDA-related targets (#4063)
* Change stdlib to not depend on short-circuit (#4056)kaizhangNV2024-04-30
| | | | | | Do not use "&&" to implement the intrinsic kIROp_And, instead define a 'and' function in stdlib. So it will be up to us to determine whether we want to use 'short-circuit' behavior in stdlib.
* Add option -disable-short-circuit (#4054)kaizhangNV2024-04-30
| | | | | Add option -disable-short-circuit to disable short circuit for logic operators && and ||. Also, disable the short circuit by default in the stdlib.
* Metal: Vertex/Fragment builtin and layouts. (#4044)Yong He2024-04-30
| | | | | | | | | * Metal: Vertex/Fragment builtin and layouts. * Fix. * Fix test. * Emit user semantic on vertex/fragment attributes.
* Add metal downstream compiler + metallib target. (#3990)Yong He2024-04-19
| | | | | | | * Add metal downstream compiler + metallib target. * Add more comments. * Add missing override.
* Add skeleton for metal backend. (#3971)Yong He2024-04-17
|
* Fix the issue that 'spGetDependencyFilePath' report 'unknown' (#3927) (#3939)kaizhangNV2024-04-12
| | | | | | Fix the issue that 'spGetDependencyFilePath' will report "unknown" for the source code is from string. We only reported valid file path when the source code is file a file, so we change that to report a valid file name even when the source code is from the string.
* Add missing astBuilder setting in `ComponentType::tryFoldIntVal`. (#3934)Yong He2024-04-12
|
* Fix the issues when compiling slang to library (#3936)kaizhangNV2024-04-11
|
* Allow COM based API to discover and check entrypoints without [shader] ↵Yong He2024-04-09
| | | | | | | | | attribute. (#3914) * Allow COM based API to discover and check entrypoints without [shader] attribute. * Undo changes. * More comments.
* Fix inconsistent digest of precompiled module. (#3796)Yong He2024-03-19
|
* Fix name mangling and source file finding logic for precompiled module ↵Yong He2024-03-18
| | | | | | | | | validation. (#3784) * Fix name mangling. * Fix source validation. * Caching and search path fixes.
* Fix `sessionDesc.defaultMatrixLayoutMode` being ineffective. (#3753)Yong He2024-03-12
| | | | | | | | | | | | | | | | | | | * 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.
* Link-time specialization fixes. (#3734)Yong He2024-03-11
| | | | | * Fix method synthesis logic for static differentiable methods. * Support link-time constants in thread group size reflection.
* 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.
* Link-time constant and linkage API improvements. (#3708)Yong He2024-03-07
| | | | | | | | | | | | | * Link-time constant and linkage API improvements. * Fix. * Allow module name to be empty. * Fix. * Fix. * Fix compile error.
* Add `IGlobalSession::getSessionDescDigest`. (#3669)Yong He2024-03-04
| | | | | * Add `IGlobalSession::getSessionDescDigest`. * Fix.
* [SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644)Yong He2024-02-28
| | | | | | | * [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix.
* Allow default values for `extern` symbols. (#3632)Yong He2024-02-26
| | | | | | | * Allow default values for `extern` symbols. * Fix. * Fix test.
* Add slangc interface to compile and use ir modules. (#3615)Yong He2024-02-23
| | | | | | | | | * Add slangc interface to compile and use ir modules. * Fix glsl scalar layout settings not copied to target. * Fix. * Cleanups.
* Add API for querying and reusing precompiled binary modules. (#3614)Yong He2024-02-22
|
* Fix SPIRV lowering issue. (#3608)Yong He2024-02-21
| | | | | | | | | | | | | * Fix SPIRV pointer lowering issue. Fixes #3605. * Add another pointer test. Fixes #3601. * Fixes #3600. * Fix #3595.
* 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.
* Refactor compiler option representations. (#3598)Yong He2024-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor compiler option representation. * Fix binary compatibility. * Add a test for specifying compiler options at link time. * Fix binary compatibility. * Fix binary compatibility. * Fix backward compatibility on matrix layout. * Fix. * Fix. * Fix. * Fix gfx. * Fix gfx. * Fix dynamic dispatch. * Polish.
* Support loading serialized modules. (#3588)Yong He2024-02-15
| | | | | | | | | | | | | | | | | | | | | * Support loading serialized modules. * Fix. * Fix vs solution files * Fix glsl module loading. * C++ fix. * Fix. * Try fix c++ error. * Try fix. * Fix. * Fix.
* Unify GLSL and HLSL buffer block parsing. (#3552)Yong He2024-02-06
| | | | | | * Unify GLSL and HLSL buffer block parsing. Automatic GLSL module recognition. * Fix.
* Capability type checking. (#3530)Yong He2024-02-02
| | | | | | | | | * Capability type checking. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Atomics+Wave ops intrinsics fixes. (#3542)Yong He2024-02-02
| | | | | | | | | | | | | | | * Fix atomics intrinsics, increase kMaxDescriptorSets. * Add SPIRVASM to known non-differentiable insts. * Support fp16 wave ops when targeting glsl. * Fixes. * Fix vk validation errors. * Fix. * Add to allowed failures.
* FP16 atomics for RWByteAddresBuffer, fp32 atomics for images. (#3536)Yong He2024-02-01
| | | | | | | | | | | | | * FP16 atomics for RWByteAddresBuffer, fp32 atomics for images. * Fix spelling. * Add overload. * Fix test failures. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add slangc option to specialize entrypoint + auto glsl mode. (#3531)Yong He2024-02-01
| | | | | | | | | | | * Add slangc option to specialize entrypoint. * Auto enable glsl mode when input file has glsl extension name. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Capability def parsing & codegen + disjoint sets (#3451)Yong He2024-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Capability def parsing & codegen + disjoint sets This change adds a capability definition file, and a code generator to produce C++ code that defines the capability enums and necessary data structures around the capabilities. Extends the existing CapabilitySet class to support expressing disjoint sets of capabilities. This sets up for the next change that will enhance our type checking with reasoning of capability requirements. * Fix cmake. * Fix warning. * Fix. * Fix isBetterForTarget to prefer less specialized option. * Fix. * Fix premake. * Fix intrinsic. * Fix vs sln file. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add compiler settings to shader cache key (#3439)skallweitNV2024-01-09
|
* Fix issue with entry point result not being available via ↵jsmall-nvidia2024-01-03
| | | | `spGetEntryPointCodeBlob` if defined in a serialized module. (#3431)
* 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>
* Change default visibility of interface members and update docs. (#3381)Yong He2023-12-06
| | | | | | | | | * Update behavior around interfaces and docs. * Update toc --------- 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>
* Add GLSL Compatibility. (#3321)Yong He2023-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Parse glsl buffer blocks to GLSLInterfaceBlockDecl * Parse glsl local size layout declarations * Parse (and ignore) glsl version directives * spelling * Better l-value interpretation for glsl interface blocks * Better l-value interpretation for glsl interface blocks * Add compile flag for enabling glsl * Parse and ignore precision modifiers. * Automatically import `glsl` module for compatiblity. * Complete vector and matrix types for glsl * Remove generated file from repo * Bump .gitignore * do not mark out globals as params * Synthesize entrypoint layout from global inout vars. * update test result. * Allow HLSL semantic on global variables. * Fix. * Fix test. * Fix win32 compile error. * Add more builtin input/output and texture intrinsics. * Add struct/array constructor syntax. * Skip `#extension` lines. * overide operator * for matrix/vector multiplication. * Add `matrixCompMult`. * Parse modifiers in for loop init var declr. * Add more glsl intrinsics, add stage into to var layout. * Allow `int[3] x` syntax. * Fix array type syntax. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: Yong He <yhe@nvidia.com>
* Report spirv-opt time. (#3271)Yong He2023-10-11
| | | | | | | | | * Report spirv-opt time. * Removing timing logic in `loadModule`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Fix for epoch/ASTBuilder* nullptr issue (#3240)jsmall-nvidia2023-09-26
| | | | | | | | | * Fix issue with failing tests tests/serialization/serialized-module-test.slang tests/serialization/extern/extern-test.slang * Fix issue with session destruction order on Session. * Improve comment.
* Fix GLSL output for `gl_ClipDistance` input builtin. (#3193)Yong He2023-09-07
| | | | | | | | | * Fix GLSL output for `gl_ClipDistance` input builtin. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Allow bitwise or expressions and numeric literals in spirv_asm blocks (#3157)Ellie Hermaszewska2023-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add -spirv-core-grammar option to load alternate spirv defs Also embed a version to use by default * Use perfect hash for spv op lookup * Neaten perfect hash embedding * Refactor spirv grammar lookup in preperation for more kinds of lookups * Load spirv capability list from spec * Add all SPIR-V enums to lookup table * regenerate vs projects * appease msvc * Use string slices for spir-v core grammar lookups * wiggle * comment * Add OpInfo for spv ops * regenerate vs projects * Embed op names * Add min/max operand counts and enum categories to spirv info * neaten * Operand kinds for spirv ops * Store and embed all information relating to spirv enums and qualifiers * Use SPIR-V spec to position instructions in spirv_asm blocks * Neaten spir-v info embedding * Neaten perfect hash embedding * Add assignment syntax to spirv_asm snippets * Better errors for spirv_asm parser * Add warning for too many operands in spirv asm * squash warnings * neaten * test wiggle * Lookup enums for spirv * Put OpCapability and OpExtension in the correct place for spirv_asm blocks * Tests for OpCapability and OpExtension * ci wiggle * Add expected failure * Allow raising immediate values to constant ids where necessary in spirv_asm blocks * Allow bitwise or expressions and numeric literals in spirv_asm blocks * test numeric literals * Fix memory issues. * fix. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* SPIRV: debug source and debug line. (#3109)Yong He2023-08-15
|
* Use ankerl/unordered_dense as a hashmap implementation (#3036)Ellie Hermaszewska2023-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correct namespace for getClockFrequency * missing const * Add missing assignment operator * Remove unused variables * Return correct modified variable * Use stable hash code for file system identity * terse static_assert * Structured binding for map iteration * Make (==) and getHashCode const on many structs * Add ConstIterator for LinkedList * Replace uses of ItemProxy::getValue with Dictionary::at * Extract list of loads from gradientsMap before updating it * Const correctness in type layout * Add unordered_dense hashmap submodule * Use wyhash or getHashCode in slang-hash.h * refactor slang-hash.h * Use ankerl/unordered_dense as a hashmap implementation Notable changes: - The subscript operator returns a reference directly to the value, rather than a lazy ItemProxy (pair of dict pointer and key) slang-profile time (95% over 10 runs): - Before: 6.3913906 (±0.0746) - After: 5.9276123 (±0.0964) * 64 bit hash for strings So they have the same hash as char buffers with the same contents * Narrowing warnings for gcc to match msvc * revert back to c++17 * Correct c++ version for msvc * Use path to unordered_dense which keeps tests happy * Do not assign to and read from map in same expression * Remove redundant map operations in primal-hoist * Split out stable hash functions into slang-stable-hash.h * 64 bit hash by default * regenerate vs projects * Correct return type from HashSetBase::getCount() * correct width for call to Dictionary::reserve * Use stable hash for obfuscated module ids * Signed int for reserve * clearer variable naming * Parameterize Dictionary on hash and equality functors * Allow heterogenous lookup for Dictionary * missing const * Use set over operator[] in some places * Remove unused function * s/at/getValue
* Clean up and improve Val deduplication performance. (#3069)Yong He2023-08-09
| | | | | | | | | | | | | | | * Clean up and improve Val deuplication performance. * Fix. * Fix. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Fix `Val` deduplication bug. (#3050)Yong He2023-08-07
| | | | | | | | | | | | | * Fix `Val` deduplication bug. * Fix * Concat stdlib files into a single module. * Remove unnecessary logic in `resolve`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Redesign `DeclRef` and systematic `Val` deduplication (#3049)Yong He2023-08-04
| | | | | | | | | | | | | | | | | | | | | | | * Redesign DeclRef + Deduplicate Val. * Update project files * Fix warning. * Fix. * Fix. * Remove `Val::_equalsImplOverride`. * Rmove `Val::_getHashCodeOverride`. * Remove `semanticVisitor` param from `resolve`. * Cleanups. --------- Co-authored-by: Yong He <yhe@nvidia.com>