summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-08-22Add skeleton of a language reference. (#4808)Theresa Foley
The files being checked in here were initially written 2-3 years ago. They are very clearly incomplete, outdated and, quite often, inaccurate. The intention of this change is to get an initial skeleton in place for the large-scale structure of a language reference (for now avoiding the term "specification" and all the weight it carries). Future commits should be able to add to flesh out this skeleton and start to make the document more complete and more accurate.
2024-08-22Feature/capture unit test (#4898)kaizhangNV
* record/replay: Add tests Modify the hello-world example to generate the hash code for the entry point spirv code, so that we can compare it with replaying the example. Add the test script to run the example and compare the hash code with replaying it. * Check nullptr for out Diagnostics We need to check whether the output Diagnostics is a nullptr, because it's allowed. * Fix the double free pointers * Add triangle example as the new test for record-replay Change the example base to add the offline rendering path because we don't want to display anything when we're in the test mode. This change involves introducing a TestBase that will parse the command line option. It will decide whether we are in the test mode. Disable all the swapchain and windows related creation, instead we will only create one single framebuffer for the render target. * Address comments TODO: In the follow up patches, I will add more tests and integrate the test flow into slang-unit-test.
2024-08-22Fix a false failure when using the latest SPIR-V (#4904)Jay Kwak
* Fix a false failure when using the latest SPIR-V --------- Co-authored-by: Ellie Hermaszewska <github@sub.monoid.al> Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-08-21Update CONTRIBUTION.mdJay Kwak
Fix a mistake on a command line argument for building slang-llvm
2024-08-21Dont require llvm for building generators (#4895)Ellie Hermaszewska
* Dont require llvm for building generators * Fetch slang-llvm.so from correct release (#4847) * Fetch slang-llvm.so from correct release Closes https://github.com/shader-slang/slang/issues/4648 Should close https://github.com/shader-slang/slang/issues/4812 * Update docs * Correct documentation on cmake option * Neaten cmake script * Fix fetching on windows --------- Co-authored-by: Yong He <yonghe@outlook.com> * Be a bit more careful dealing with release list fetching failure * clarify error messages --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-21Allow creating draft releases from tags containing "draft" (#4896)Ellie Hermaszewska
* Allow creating draft releases from tags containing "draft" * make draft releases prereleases too
2024-08-20Revert "Fetch slang-llvm.so from correct release (#4847)" (#4893)Yong He
This reverts commit 579d59c761cb0460701e0e820eb066275fe357b3.
2024-08-20Proposal: A simpler and more flexible `IDifferentiable` system (#4865)Sai Praveen Bangaru
Designed to work for both value types as well as ref/ptr/buffer types Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-20Support dependent generic constraints. (#4870)Yong He
* Support dependent generic constraints. * Fix warning. * Update comment. * Fix. * Add a test case to verify fix of #3804. * Address review.
2024-08-20Fix `tests\autodiff\reverse-while-loop-3.slang` test (#4886)ArielG-NV
* Fix `tests\autodiff\reverse-while-loop-3.slang` test Fixes: #4876 Fix `tests\autodiff\reverse-while-loop-3.slang` test to have correct listed output values * set default to 1 (different val) --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-20Exclude synthesized code from code auto documentation system (#4889)ArielG-NV
* Exclude synthesized code from code auto documentation system Fixes #4888 Changes to exclude synthesized code from code-auto-documentation system * syntax change for cleanup
2024-08-20Track uninitialized values of `Ptr<Specialize<T>>` inside type `T` without ↵ArielG-NV
hang (#4885) * Track uninitialized values of `Ptr<Specialize<T>>` inside type `T` without hang Fixes #4878 Track uninitialized values of `Ptr<Specialize<T>>` inside type `T` without hang * change method used to resolve base of specialization
2024-08-20Fixes #4879 (#4881)ArielG-NV
track containor-decl with `DifferentialType` scope varaible synthesized
2024-08-20Fetch slang-llvm.so from correct release (#4847)Ellie Hermaszewska
* Fetch slang-llvm.so from correct release Closes https://github.com/shader-slang/slang/issues/4648 Should close https://github.com/shader-slang/slang/issues/4812 * Update docs * Correct documentation on cmake option * Neaten cmake script * Fix fetching on windows --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-20Implement Path::createDirectoryRecursive (#4871)kaizhangNV
* Implement Path::createDirectoryRecursive Implement Path::createDirectoryRecursive with existing Path::createDirectory that uses system call instead of c++ standard lib. * Change the use of 'while(1)' to 'for(;;)'
2024-08-19Remove using SpvStorageClass values casted into AddressSpace values (#4861)Ellie Hermaszewska
* Remove using SpvStorageClass values casted into AddressSpace values Also removes support for specific storage classes in __target_intrinsic snippets * remove SLANG_RETURN_NEVER macro * squash warnings * Make nonexhaustive switch statement error on gcc * Add SLANG_EXHAUSTIVE_SWITCH_BEGIN/END macros --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-19Tuple swizzling, concat, comparison and `countof`. (#4856)Yong He
* Tuple swizzling and element access. * Update proposal status. * Cleanup. * Fix merrge error. * Address review.
2024-08-18Variadic Generics Part 2: IR lowering and specialization. (#4849)Yong He
* Variadic Generics Part 2: IR lowering and specialization. * Update design doc status. * Update design doc. * Resolve review comments.
2024-08-18Make sure to resolve overloaded expr for call args. (#4864)Yong He
2024-08-16Avoiding the use of the global AST builder in DeclRefType::create (#4866)venkataram-nv
2024-08-16Include inout cast operation as an aliasing instruction (#4859)venkataram-nv
Previously, the warnings were: ``` environment.slang(22): warning 41022: inout parameter 'seed' is never written to public float3 environment_sample(StructuredBuffer <Environment_sample_data> sample_buffer, inout int seed) ^~~~~~~~~~~~~~~~~~ hit.slang(5): warning 41022: inout parameter 'seed' is never written to float3 sample_lights(inout uint seed) ^~~~~~~~~~~~~ ``` With this commit they should not be emitted.
2024-08-16Design proposal: IFunc interface. (#4851)Yong He
* Design proposal: IFunc interface. * fix code error.
2024-08-16Update documentation for #include to indicate it is for legacy code and new ↵Ellie Hermaszewska
code should use modules (#4862) Closes https://github.com/shader-slang/slang/issues/4281
2024-08-15Variadic Generics Part 3: language server (#4850)Yong He
2024-08-15Refactoring benchmark CI pipeline (#4855)venkataram-nv
* Refactoring benchmark CI pipeline * Combine setup and run steps
2024-08-15Make precompileForTargets work with Slang API (#4845)cheneym2
* Make precompileForTargets work with Slang API precompileForTargets, renamed to precompileForTarget, does not need an EndToEndCompileRequest and some objects created from it are not necessary either. Take only a target enum and a diagnostic blob as input and handle everything else internally, such as creating the TargetReq with chosen profile. Fixes #4790 * Update slang-module.cpp * Update slang-module.cpp
2024-08-15fix getVKAdapters on MoltenVK (#4852)skallweitNV
2024-08-14Design proposal for Tuple types. (#4848)Yong He
* Design proposal for Tuple types. * formatting.
2024-08-14Variadic Generics Part 1: parsing and type checking. (#4833)Yong He
2024-08-14Design proposal for variadic generics (#4821)Yong He
* Design proposal for variadic generics * Update IR lowering section. * fix typo. * Fix error. * Fix typos. * fix typos. * typo fix. * update reviewers. * update implementation info. * update implementation info. * update pr link. * rewording. * more rewording. * grammar fix.
2024-08-14Do not zero-initialize groupshared and rayquery variables (#4838)ArielG-NV
* Do not zero-initialize groupshared and rayquery variables Fixes: #4824 `-zero-initialize` option will explicitly not: 1. Set any groupshared values to defaults 2. Set any rayQuery object to a default state (currently invalid code generation) * grammer * disallow groupshared initializers disallow groupshared initializers & adjust tests accordingly * remove disallowed groupshared-init expression * do not default init if non-copyable --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-14Issue/legalize resource (#4769)kaizhangNV
* Fix the issue that NonUniformResourceIndex is ignored Fix the issue that after `specializeFunctionCalls`, `NonUniformResourceIndex` is ignored in the generated specialized function. The reason is that if the function has a non-uniform resource parameter, we will legalize it by replacing the resource parameter with a index, and indexing of the resource will be moved inside the specialized function. e.g. ``` void func(ResourceType resource) { ... } func(resource[NonUniformResourceIndex(0)]) ``` will be specialized into ``` void func(int index) { resource[index]; } func(0); ``` In this case, inside the function, we will loose the information about whether the resource is a non-uniform. So we add the handling for this corner case by adding insert a `NonUniformResourceIndex` into the specialized function: ``` void func(int index) { int nonUniformIdx = NonUniformResourceIndex(index); resource[nonUniformIdx]; } ``` * Fix the issue that arguments mismatch after specilization callsite specializeCall() call could cause arguments mismatch with the parameters of the specialized function. For example, if the function parameter contains a resource type ``` void func(ResourceType res) { ... } int index = ... func(resources[index]); ``` This will be specialized into ``` void func(int index) { resources[index] } int index = ... func(index); ``` However, if we have more than 1 call sites, and the other call site doesn't use `int` as the index, e.g. ``` uint index = ... func(resources[index]); ``` this call site will be specialized into ``` uint index = ... func(index); ``` this will be invalid, because the argument doesn't match the parameter. so we just add the data type of the new arguments into the function key such that For the uniformity info, we add a new attribute "IROp_NonUniformAttr", so we will form a IRAttributedType that encodes both uniformity and data type, and use it as the key of call info. So if there is call site using the different data type for the resource index, we will specialize a new function for this. * Handle the intCast and uintCast operation Since after intCast/uintCast of nonuniformIndex, it's still a nonuniformIndex. So we will handle this case as well. Also, add a new test to cover this.
2024-08-13GitHub action benchmark (#4804)venkataram-nv
Adds a new Github CI action for benchmarking the slangc compiler on the MDL shaders. For now, the results are only dumped to the output of the CI, which can be later viewed through raw logs. The next step is to use github-action-benchmark to push these results into a page which will show the benchmark results over time as commits are pushed.
2024-08-13FIx issue with specializing witness tables (#4839)Sai Praveen Bangaru
2024-08-13Do not add carrage return to shell scripts (#4811)Jay Kwak
This commit prevents GIT from adding carrage return characters to shell script files whose file extension is ".sh". Currently git automatically adds a carrage return characters to all lines in text files, which makes them Windows text file. This causes a trouble when a shell script is submitted and it is ran on WSL, because bash on WSL expects the script files in a unix text file format. Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-13Update build steps for MacOS (#4813)Jay Kwak
This commit adds a quick build step for MacOS on CONTRIBUTION.md. It is unclear what are the conditions that slang-llvm needs to be rebuilt locally. An issue is filed for it, #4812
2024-08-12Emit memory qualifier once for GLSL targets (#4819)ArielG-NV
Fixes #4818 Emit memory qualifier once for GLSL targets. Co-authored-by: Yong He <yonghe@outlook.com>
2024-08-12Support unicode identifier names. (#4772)Yong He
* Support unicode identifier names. * Fix. * Fix language server. * Fix build errors. * Fix. * Fix offset translation in language server.
2024-08-12Warn when inout parameter is never written (#4777)venkataram-nv
Addresses #4698 as one approach to diagnose the potential problem. Emit warnings when a user marks a parameter as `inout` but never writes to it in the function. A new intrinsic function `unmodified(out T)` has been added to explicitly indicate that an `inout` variable will not be modified in the function. This is only one way to address the specific validation error in #4698. In general it seems that DXC does some more extensive checks on actual struct fields (as opposed to observing arbitrary struct writes), so that will be the next step.
2024-08-07Reduce dependency on std library (#4785)skallweitNV
2024-08-07More reflection API features. (#4740)Sai Praveen Bangaru
* More reflection API features. + Lookup methods and members (by string) on types + Fix issue with looking up non-static members through the scope operator '::' + `GenericReflection`: Cast a decl to generic to access unspecialized generic parameter names and constraints + `GenericReflection`: Use `getGenericContainer()` from function, variable or type to access the 'nearest' generic parent along with specialization info + `GenericReflection::getConcreteType` and `GenericReflection::getConcreteIntVal`: to get the concrete type of a param in the context of the reflection object + `GenericReflection::getOuterGenericContainer` to go up one level and get the outer generic declarations (if there are more than one enclosing generic scopes) + `DeclReflection::getParent`: go to parent declaration. + Change `VariableReflection` to be a `DeclRef` rather than a decl (allows us to return properly substituted types for methods, members, and more) * Fix Falcor issue
2024-08-06Fix auto-diff synthesized method naming conventions (#4714)Sai Praveen Bangaru
* Fix auto-diff synthesized method naming conventions * Update tests; remove unused var
2024-08-06Remove disassemle debug code (#4779)cheneym2
Some debug code was left in by accident which called DXC to disassemble the DXIL it produced.
2024-08-06Support an Upper-case variant of [NumThreads] and [Shader] (#4780)Jay Kwak
Closes #4746. This commit adds a support for "NumThreads" and "Shader" attribute keyword, which is in CamelCasing starting with an upper case letter. The attribute keywords in HLSL are case-insensitive. As an example, one of D3D documents says, "The attribute name "Shader" is case insensitive." https://microsoft.github.io/DirectX-Specs/d3d/WorkGraphs.html Slang, however, doesn't support the case-insensitivity. They should be all lower-case or CamelCasing starting with an upper case.
2024-08-05Initial support for precompiled DXIL in slang-modules (#4755)cheneym2
* Add embedded precompiled binary IR ops Add IR operations to embed precompiled DXIL or SPIR-V blobs into IR. Adds a BlobLit literal that is mostly identical to StringLit except for its inability to be displayed, e.g. in dumped IR. In the future, the blob might be dumped as hexadecimal, but for now it is summarized as "<binary blob>". * EmbeddedDXIL and SPIR-V options The options, '-embed-dxil' and '-embed-spirv' in slangc, will cause a target dxil or spirv to be compiled and stored in the translation unit IR when written to a slang-module. Subsequent changes actually implement the options. * Per-translation unit DXIL precompilation When -embed-dxil is specified, perform a precompilation to DXIL of each TU, linked only with stdlib. Embed the resulting DXIL for the TU in a IR op. Being part of IR, the precompiled DXIL can be serialized to disk in a slang-module. Upon loading slang-modules, the new IR op will be searched for and the precompiled DXIL blob is saved with the loaded Module. During linking, if all the Modules have precompiled blobs they will be sent to the downstream compile commands as libraries instead of source, skipping the downstream compilation, using DXC only for linking. Fixes Issue #4580 * Remove placeholder embedded SPIRV support Code was added only to sketch out how other precompiled bins will be supported. * Remove the rest of the SPIRV placeholder support * Fix warnings, test error on non-windows * Remove lib_6_6 hack, add dxil_lib capability * Allocate blob value from irmodule memarena * Add null check after memarena allocation * Restore the request->e2erequest code path for generatewholeprogram * Update capability handling, move EmbedDXIL enum to end to preserve abi * Remove lib_6_6 hack * Move ICompileRequest functions to end
2024-08-01Allow a enum case to reference a previously defined value. (#4768)Yong He
2024-08-01Perform type legalization on StructuredBuffer element. (#4767)Yong He
2024-08-01Allow implicit 'uniform' entrypoint parameters. (#4765)Yong He
* Allow impliocit 'uniform' entrypoint parameters. * Fix. * Fix. * Fix. * Fix.
2024-07-31Allow generic type deduction from ParameterBlock arguments. (#4766)Yong He
* Allow generic type deduction from ParameterBlock arguments. * Fix test. * Update expected failure list. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-07-31Feature/replayer (#4750)kaizhangNV
* record/replay: Implement the json consumer Finish the implementation of json consumer. Fix some bug in the block processing as Tailer is not a necessary block so if the Magic bit is "HEAD", we should keep processing. * record/replay: Implement the replayer component Implement the replayer consumer, and also finish the slang-replay standalone app that will run the while replayer. It can take an option "--convert-json | -cj" which will convert the record binary file to a human readable json file. If there is no option provided, it will replay the record file by default. TODO: #4764 is created to remove the std::filesystem usage.