diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-03-18 15:59:56 +0100 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-03-30 12:20:24 +0300 |
| commit | 3357c59cebacb6b60da865376b20d2b307d12ec1 (patch) | |
| tree | 51edbb19a1f063888bac386c6a51ba250e361b11 /src/BuiltinFn.zig | |
| parent | 83051b0cbf31b76e824d3911a7f4a0be3c0cf94d (diff) | |
| download | zig-3357c59cebacb6b60da865376b20d2b307d12ec1.tar.gz zig-3357c59cebacb6b60da865376b20d2b307d12ec1.zip | |
new builtins: @workItemId, @workGroupId, @workGroupSize
* @workItemId returns the index of the work item in a work group for a
dimension.
* @workGroupId returns the index of the work group in the kernel dispatch for a
dimension.
* @workGroupSize returns the size of the work group for a dimension.
These builtins are mainly useful for GPU backends. They are currently only
implemented for the AMDGCN LLVM backend.
Diffstat (limited to 'src/BuiltinFn.zig')
| -rw-r--r-- | src/BuiltinFn.zig | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/BuiltinFn.zig b/src/BuiltinFn.zig index 79c6617483..4a98a5a615 100644 --- a/src/BuiltinFn.zig +++ b/src/BuiltinFn.zig @@ -118,6 +118,9 @@ pub const Tag = enum { union_init, Vector, volatile_cast, + work_item_id, + work_group_size, + work_group_id, }; pub const MemLocRequirement = enum { @@ -980,5 +983,25 @@ pub const list = list: { .param_count = 1, }, }, + .{ + "@workItemId", .{ + .tag = .work_item_id, + .param_count = 1, + }, + }, + .{ + "@workGroupSize", + .{ + .tag = .work_group_size, + .param_count = 1, + }, + }, + .{ + "@workGroupId", + .{ + .tag = .work_group_id, + .param_count = 1, + }, + }, }); }; |
