Commit Graph

88 Commits

Author SHA1 Message Date
Ali Chraghi
436f53f55d spirv: implement @mulWithOverflow 2024-04-06 09:01:46 +03:30
Ali Chraghi
9785014938 spirv: OpExtInstImport in assembler 2024-04-06 08:52:38 +03:30
Ali Chraghi
0f75143c62 spirv: implement @divFloor, @floor and @mod 2024-04-06 08:50:02 +03:30
Robin Voetter
9b18125562 spirv: make generic globals invocation-local 2024-03-18 19:13:50 +01:00
Robin Voetter
20d7bb68ac spirv: add zig-specific ext inst
This may be removed again in the future...
2024-03-18 19:13:49 +01:00
Robin Voetter
e566158acf spirv: make IdResult an enum 2024-03-18 19:13:49 +01:00
Robin Voetter
9b058117f0 spirv: update assembler with new spec 2024-03-18 19:13:48 +01:00
Robin Voetter
028f532dc0 spirv: update spec to SPIRV-Headers/8b246ff
We need this "unstable" version to get the Zig identifiers.
2024-03-18 19:13:47 +01:00
Tristan Ross
099f3c4039 std.builtin: make container layout fields lowercase 2024-03-11 07:09:07 -07:00
Ali Chraghi
23b7075656 spirv: add capability to compile with x86_64 backend 2024-02-15 17:28:15 +03:30
Ali Chraghi
44c31194e3 spirv: use extended instructions whenever possible 2024-02-15 17:25:44 +03:30
Ali Chraghi
37b0aa600a spirv: make rusticl the primary testing implementation 2024-02-09 09:27:08 +03:30
Ali Chraghi
739108c9f0 spirv: support enum integer values in Assembler 2024-02-05 11:55:14 +03:30
Ali Chraghi
b41aad0193 spirv: emit vectors whenever we can 2024-02-05 11:55:14 +03:30
Ali Chraghi
afa7793351 spirv: basic shader support 2024-02-05 11:55:14 +03:30
Robin Voetter
decff51238 spirv: structured control flow 2023-11-24 17:50:11 +01:00
Robin Voetter
cb026c5d59 spirv: always emit mask constants even if no bits are set
A parameter like this is not always optional, even if that is
usually implied. SPIR-V tools fail to parse a module with an
OpLoopMerge instruction where the loop control parameter is
left out.
2023-11-24 01:11:15 +01:00
Robin Voetter
255737ea57 spirv: fix memory leak in SpvModule 2023-11-24 01:11:14 +01:00
Robin Voetter
4bf27da6a6 Revert "Revert "Merge pull request #17657 from Snektron/spirv-recursive-ptrs""
This reverts commit 9f0359d78f in an attempt to
make the tests pass again. The CI failure from that merge should be unrelated
to this commit.
2023-10-23 06:27:12 -04:00
Andrew Kelley
9f0359d78f Revert "Merge pull request #17657 from Snektron/spirv-recursive-ptrs"
This reverts commit b822e841cd, reversing
changes made to 0c99ba1eab.

This caused a CI failure when it landed in master branch.
2023-10-22 12:15:31 -07:00
Robin Voetter
6281ad91df spirv: self-referential pointers via new fwd_ptr_type
Its a little ugly but it works.
2023-10-21 17:46:54 +02:00
Robin Voetter
0552e504d0 spirv: work around OpSource parsing issue in llvm-spirv
The Khronos SPIRV-LLVM translator does not parse OpSource correctly. This
was causing tests to fail and other mysterious issues.

These are resolved by only generating a single OpSource instruction for now,
which does not have the source file locations also.

See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188
2023-10-15 17:07:39 +02:00
Robin Voetter
f858bf1616 spirv: air bitcast for non-numeric non-pointer types 2023-10-15 14:00:07 +02:00
Robin Voetter
31ad2d72a7 spirv: use CacheString for source_file_names instead of []const u8 2023-10-15 13:59:26 +02:00
Robin Voetter
a3d77bdba9 spirv: get rid of SpvModule arena 2023-10-15 13:59:25 +02:00
Robin Voetter
4e22f811e7 spirv: opaque types 2023-10-15 13:59:20 +02:00
Robin Voetter
572517376a spirv: air dbg_var_val and dbg_var_ptr 2023-09-23 12:36:56 -07:00
Robin Voetter
b845c9d532 spirv: generate module initializer 2023-09-23 12:36:56 -07:00
Robin Voetter
b30cd67987 spirv: put global var initializers in functions 2023-09-23 12:36:44 -07:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
r00ster91
6e84f46990 std: replace builtin.Version with SemanticVersion 2023-06-17 13:17:34 -07:00
Andrew Kelley
275652f620 stage2: move opaque types to InternPool 2023-06-10 20:42:30 -07:00
Andrew Kelley
5e636643d2 stage2: move many Type encodings to InternPool
Notably, `vector`.

Additionally, all alternate encodings of `pointer`, `optional`, and
`array`.
2023-06-10 20:42:27 -07:00
Robin Voetter
3c4cc1eedb spirv: eliminate remaining uses of emitConstant 2023-05-30 19:43:37 +02:00
Robin Voetter
0c41945a01 spirv: rename TypeConstantCache -> Cache 2023-05-30 19:43:37 +02:00
Robin Voetter
0552a8b11f spirv: translate remaining types 2023-05-30 19:43:37 +02:00
Robin Voetter
fcb422585c spirv: translate remaining types 2023-05-30 19:43:37 +02:00
Robin Voetter
112acb1bda spirv: cache strings for debug names 2023-05-30 19:43:37 +02:00
Robin Voetter
a72179fed0 spirv: translate structs to cache key 2023-05-30 19:43:37 +02:00
Robin Voetter
f13a6ee19e spirv: cache pointers 2023-05-30 19:43:36 +02:00
Robin Voetter
e05ace7673 spirv: cache function prototypes 2023-05-30 19:43:36 +02:00
Robin Voetter
8c72ad5320 spirv: cache for ints 2023-05-30 19:43:36 +02:00
Robin Voetter
aade6f1195 spirv: cache for floats 2023-05-30 19:43:36 +02:00
Robin Voetter
b2a984cda6 spirv: basic setup for using new type constant cache 2023-05-30 19:43:36 +02:00
Robin Voetter
96a66d14a1 spirv: TypeConstantCache 2023-05-30 19:43:36 +02:00
Robin Voetter
c92cc5798f spirv: make constant handle float, errorset, errorunion
This is in preparation of removing indirect lowering again. Also
modifies constant() to accept a repr so that both direct as well
as indirect representations can be generated. Indirect is not yet
used, but will be used for globals.
2023-05-20 18:02:30 +02:00
Robin Voetter
e26d8d0604 spirv: make decl deps a hash map instead of an arraylist
The same declaration can be added to the dependency set multiple
times, and in this case we still need to emit it once. By making
this list a hash map instead, we can do that quite easily.

This commit also introduces some additional debug logging regarding
decls.
2023-05-11 20:31:51 +02:00
Robin Voetter
5d896a6cc6 spirv: fix use-after-realloc in resolveType()
The pointer to a slot in a hash map was fetched before a recursive call.
If the hash map's size changed during the recursive call, this would write
to an invalid pointer.

The solution is to use an index instead of a pointer. Note that care must be
taken that resolved types (from the type_cahce) must not be accessed, as they
might be incomplete during this operation.
2023-05-11 20:31:50 +02:00
Robin Voetter
979b410258 spirv: Do not generate the Alignment attribute on pointers for now
It seems that some implementations may have problems with these right now,
like Intel and Rusticl. In theory, these attributes should be superficial
on the pointer type, as alignment guarantees are also added via the
alignment option of the OpLoad and OpStore instructions. Therefore, get rid
of them for now.
2023-04-09 01:51:55 +02:00