<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-ir-serialize.cpp, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2020-09-17T20:47:57+00:00</updated>
<entry>
<title>Share debug information between AST and IR (#1547)</title>
<updated>2020-09-17T20:47:57+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-09-17T20:47:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b9cddcb9c718f986ee5e4f7c6189ee2ebea4ace1'/>
<id>urn:sha1:b9cddcb9c718f986ee5e4f7c6189ee2ebea4ace1</id>
<content type='text'>
* Test if blob is returned.

* Rename serialize files so can be grouped.

* StringRepresentationCache -&gt; SerialStringTable

* Split out SerialStringTable from slang-serialize-ir

* First pass at reorganizing serialization/containers. Remain some issues about debug info.

* Fix bug in calculating sourceloc.

* Improve calcFixSourceLoc

* Make allocations for payload RiffContainer align to at least 8 bytes. This is important for read, if the payload can contain 8 byte aligned data. Note this has no effect on Riff file format alignment rules.

* Improve comments around RiffContainer and alignment.

* Remove SerialStringTable, can just use StringSlicePool instead.

* Typo fix for Clang/Linux.

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>AST Serialization in Modules (#1524)</title>
<updated>2020-08-31T17:02:55+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-08-31T17:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=69025ad82238a7402b18d9c566fac1574faef684'/>
<id>urn:sha1:69025ad82238a7402b18d9c566fac1574faef684</id>
<content type='text'>
* First pass at filter for AST serial writing.

* Serialization of AST for modules.

* Removed some commented out source.

Co-authored-by: Tim Foley &lt;tfoleyNV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Fix for bug where memory that has been allocated with new T[] (within a list) is freed with free in the RiffContainer. (#1473)</title>
<updated>2020-07-31T16:25:58+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-07-31T16:25:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fc8b5758ca7a9b3aaf2f93d45ff570fab2a68bb8'/>
<id>urn:sha1:fc8b5758ca7a9b3aaf2f93d45ff570fab2a68bb8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Clean up unused code for IR object ownership (#1416)</title>
<updated>2020-06-30T19:25:27+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-06-30T19:25:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8ced9d2a0efaca8f6dbdaf427be1db52844787b5'/>
<id>urn:sha1:8ced9d2a0efaca8f6dbdaf427be1db52844787b5</id>
<content type='text'>
There was a small but non-trivial amount of code across `IRModule`, the `ObjectScopeManager`, and `StringRepresentationCache` that had to do with managing the lifetimes of `RefObject`s that might be referenced by IR instructions (and thus need to be kept alive for the lifetime of the IR module).

We have long since migrated to a model where IR instruction do not include owned references to `RefObject`s, so these facilities weren't actually needed. This streamlines `IRModule`'s declaration, and trims code that we aren't actually using.

One note for the future is that the `StringRepresentationCache` no longer does what its name implies (it is not a cache of `StringRepresentation`s), so we should consider giving it a more narrowly scoped name. I didn't include that in this change because I wanted to keep the diffs narrow and easy to review.

A follow-on renaming change should be trivial if/when we can agree on what the type should be called at this point. Alternatively, we could simply bake the functionality of `StringRepresentationCache` into he IR deserialiation logic itself, since that is the only code using it.</content>
</entry>
<entry>
<title>Renamed UnownedStringSlice::size to getLength to make match String. (#1254)</title>
<updated>2020-03-03T00:14:18+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2020-03-03T00:14:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=cbba1f2ba451f31e910d59fb9efbadc5e370c095'/>
<id>urn:sha1:cbba1f2ba451f31e910d59fb9efbadc5e370c095</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Feature/string hash review (#1142)</title>
<updated>2019-12-04T17:38:38+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-12-04T17:38:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5df582dd3229789364ae3fa75575fd978ca3282d'/>
<id>urn:sha1:5df582dd3229789364ae3fa75575fd978ca3282d</id>
<content type='text'>
* * Added ConstArrayView
* Made StringSlicePool have styles
* Remove point about strings not having terminating 0 (they do), and restriction around ""

* spCalcStringHash -&gt; spComputeStringHash

* Small code improvements.
Closer to coding conventions.

* Fix small bug with Empty adding c string.

* Fix typo in assert.

* Fix ArrayView compiling issue on gcc/clang.

* Remove tabs.

* Improve comments around StringSlicePool.
Simplify getting the added slices.
</content>
</entry>
<entry>
<title>getStringHash on string literals (#1140)</title>
<updated>2019-12-03T14:58:59+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-12-03T14:58:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=9653dcc2c9d5d20d3d0e8918aaf1d5b09e963060'/>
<id>urn:sha1:9653dcc2c9d5d20d3d0e8918aaf1d5b09e963060</id>
<content type='text'>
* WIP getStringHash

* Have a use.

* Add slang-string-hash.h/.cpp

* Use StringSlicePool for holding strings for StringHash.
Add outputBuffer to string-literal-hash.slang so value can be tested.
Ignore the GlobalHashedStringLiterals instruction on emit.

* Add all the hashed string literals to ProgramLayout.

* Add reflection support for hashed string literals to reflection test.

* Fix string literal hash test.

* Small fixes to pass test suite.

* Fix issue in serialization where IRUse is not correctly initialized.

* Fix problem initializing IRUse for string hash pass.
Remove hack from slang-ir-specialize - specially handling if user is not null.

* * Use shared builder when replacing getStringHash
* Comments for functions in slang-ir-string-hash
* Do not allow zero length string literals. Could be allowed, but doing so would require StringSlicePool to have a special case (or some other mechanism)
</content>
</entry>
<entry>
<title>Clean up the concept of "pseudo ops" (#1136)</title>
<updated>2019-11-23T02:54:38+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-11-23T02:54:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c6393465795e700a68458ff618041104f89ed42b'/>
<id>urn:sha1:c6393465795e700a68458ff618041104f89ed42b</id>
<content type='text'>
* Clean up the concept of "pseudo ops"

Built-in functions in the Slang standard library can be marked with `__intrinsic_op(...)` to indicate that they should not lower to functions in the IR, and that instead call sites to those functions should be translated directly to the IR.
There are two cases where `__intrinsic_op(...)` gets used:

1. In the case where the argument to `__intrinsic_op(...)` is an actual IR instruction opcode, the IR lowering logic directly translates a call into an instruction with the given opcode. The arguments to the call become the operands of the instruction.

2. In the case where the argument to `__intrinsic_op(...)` is one of a set of "pseudo" instruction opcodes, the IR lowering logic directly handles the lowering to IR with dedicated code. The operands to the call might be handled differently depending on the kind of operation.

The compound operators like `+=` are the most important example of these "pseudo" instructions.
It doesn't make sense to handle them as true function calls (although that would work semantically), nor does it make sense to have a single IR instruction with such complicated semantics.

An earlier version of the compiler used the same enumeration for both the true IR instruction opcodes and these "pseudo" opcodes, with the simple constraint that the pseudo opcodes were all negative while the real opcodes were positive. That design got changed up over a few refactorings, and because there was never a good explanation in the code itself of what "pseudo" opcodes were, we eventually ended up in a place where the in-memory and serialized IR encodings included logic to try to deal with the possibility of these "pseudo" opcodes, even though the entire design of the lowering pass meant that they'd never appear in generated IR.

This change tries to clean up the mess in a few ways:

* The terminology is now that these are "compound" intrinsic ops, to differentiate them from the more common case of intrinsic ops that map one-to-one to IR instructions.

* The declaration of the compound intrinsic ops is no longer in a file related to the IR, and doesn't use the `IR` naming prefix, so somebody looking at the IR opcodes cannot become confused and think the compound ops are allowed there.

* The IR encoding in memory and when serialized is updated to not account for or worry about the possibility of "pseudo" ops.

* The compound ops are declared in such a way that ensures their enumerant values are all negative, so that they are yet again trivially disjoint from the true IR opcodes.

A more drastic change might have split `__intrinsic_op` into two different modifier types: one for the trivial single-instruction case and one for the compound case.
Doing this would make the change more invasive, though, because there are places in the meta-code that generates the standard library that intentionally handle both single-instruction and compound ops (because built-in operators can translate to either case).

* fixup: missing file

* cleanups based on review feedback
</content>
</entry>
<entry>
<title>Added -ir-compression &amp; fixes for ir compression issues (#1129)</title>
<updated>2019-11-20T18:25:44+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-11-20T18:25:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=8a7e729632a9c7e9f0fa84e3686904bd0cc2ecc5'/>
<id>urn:sha1:8a7e729632a9c7e9f0fa84e3686904bd0cc2ecc5</id>
<content type='text'>
* Added ir-compression option.

* Fix issues around ir-compression.

* Fix typo in test name.
</content>
</entry>
<entry>
<title>Add basic support for entry points in `.slang-lib` files. (#1112)</title>
<updated>2019-11-07T02:43:33+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-11-07T02:43:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fedda2e5342d3bfbdbbdd3ca232b3f69fff81ef7'/>
<id>urn:sha1:fedda2e5342d3bfbdbbdd3ca232b3f69fff81ef7</id>
<content type='text'>
* Add basic support for entry points in `.slang-lib` files.

The basic idea here is that when writing out a `.slang-lib` file based on a compile request, we include new sections in the generated RIFF that represent the entry points that were requested. The entry-point information is serialized in an entirely ad hoc fashion (a future change might clean it up to use the `OffsetContainer` machinery), and contains the name, profile, and mangled symbol name of an entry point.

When deserializing this information, we create a list of "extra" entry points that gets attached to the front-end compile requests. These "extra" entry points get turned into `EntryPoint` objects at the same place in the code that entry points specified on the command line or via API would be checked, but the extra entry points bypass the semantic checking and just create "dummy" `EntryPoint` objects.

Aside: the ability for a compile request to end up with entry points that weren't originally specified via API or command-line is not new. We already had support for compiling a translation unit with entry points entirely specified via `[shader(...)]` attributes, and this new support tries to function similarly.

Because the "dummy" entry points don't retain AST-level information, several parts of the code have been modified to defensively check for `EntryPoint` objects without a matching AST declaration, and skip over them.
The main place where this creates a problem is paramete binding, where ignoring the dummy entry point is appropriate since we currently assume linked-in library code has been laid out manually.

One small cleanup here is that the `-r` command-line flag and the `spAddLibraryReference` API functio now bottleneck through a common routine to do their work, so that they both gain the new behavior without needing copy-paste programming.

In order to keep the existing test case for library linking with entry points working, I had to add a flag to the `render-test` tool so that it can skip specifying entry point names as part of the compile request it creates. In that case it must instead assume that the entry points will be added to the compile request via other means. This logic is a bit magical, and hints that we should be looking for other ways to expose the library linking functionality over time.

* fixup: remove alignment assertion
</content>
</entry>
</feed>
