- Emitting `OpCapability` and `OpExtension` from assembly is no longer allowed (tbh it never was because we silently ignored them).
They now `fail` with a message pointing users at `-mcpu`.
- `tools/gen_spirv_spec.zig` now also emits `Extension` and the `Capability.dependencies()`.
Also To keep the feature set a reasonable size, the generator filters to an allowlist of `KHR` and `EXT` entries.
We can decide which vendors to allow later if a use-case is found.
- `tools/update_cpu_features.zig` now uses the generated `spec.zig` and emits a feature for every
capability and extension, with the capability's `.deps` populated from `Capability.dependencies()`.
- `Module.finalize`, `Module.entryPoints`, `Module.addCapability`, `Module.addExtension`
and `sections.capabilities`/`sections.extensions` are deleted.
- Linker now verifies that an `.spv` object declares the `Linkage` capability
It's a 32-bit pointer and passed on the stack; the upper 32 bits of the stack
slot are garbage. This means that we ask the kernel to write to some random
64-bit location, which it will just silently fail to do (the process is in x32
mode; nothing can be mapped up there), and consequently, the thread's child_tid
field will never be populated, causing a later join() to hang.
Adds target info for the PSX. Builds fine with the following:
```zig
const target = b.resolveTargetQuery(.{
.os_tag = .psx,
.cpu_arch = .mipsel,
});
```
the only "problem" being that it spits out an error from LLVM even
though generating an object file succeeds:
```sh
❯ zig build
install
└─ install generated to main.o
└─ compile obj obj Debug mipsel-psx failure
error: warning: MIPS-I support is experimental
```
Exposes OpControlBarrier and OpMemoryBarrier so compute kernels do not
need to hand-roll inline asm for workgroup synchronisation. Scope and
MemorySemantics mirror the SPIRV-Headers unified1 grammar bit-for-bit;
workgroupBarrier() matches the semantics of GLSL barrier().
Co-authored-by: Quint Daenen <quint@daenen.email>
If one overrides `SelfInfo` in their `root.debug`, it is no longer possible
to refer to the default `SelfInfo` that the std.debug uses.
This allows the developer to still refer to the std's default without
copying the SelfInfo zig files to their project.
Before this fix, integer overflow would be hit later on, after this function would fail to report that `n` bits were not available.
Fixes https://codeberg.org/ziglang/zig/issues/35789
This is the one syscall that returns a u64 despite usize == u32 in these ABIs.
Rather than huge API churn for all return types in std.os.linux just to benefit
these incredibly niche ABIs, just special-case this particular syscall, as we do
with a few others depending on arch.
under this condition, `name[name.len - localhost.len]` will always be 'l'
move back one more to observe the dot
this minus is safe because this branch is only reachable if `name.len > localhost.len`
The comment was just bogus given that these are private (COW) mappings.
This code will need extra logic for handling multiple load segments
overlapping the same page, but the deleted logic was not even close.
Closes#30966
AstGen doesn't emit a `ref` ZIR inst if it encounters a dereference `.*`
with a reference result location (`ref`/`ref_coerced_ty`/`ref_const`),
since the operand of the dereference expression already is a reference.
This caused some problems as Zig allows `.*` on both single-item *and* C
pointers, but most logic in Sema assumes that everything with a reference
rl is always a single-item pointer. This largely didn't cause any issues
since C pointers can do everything single-item pointers can, but it caused
Sema to mistake `&p.*[0]` with `@TypeOf(p) == [*c][n]T` for an index into
a many-item pointer `[*][n]T` instead of a single-item pointer `*[n]T`.
To avoid such problems in the future, a pointer obtained from `&p.*` is
now always turned into a proper single-item pointer. This is achieved by
introducing two new ZIR instructions, `deref` and `ref_deref`:
For `ptr.*`:
```
%1 = validate_deref(%ptr)
%2 = load(%ptr)
```
vvv
```
%1 = deref(%ptr)
```
For `&ptr.*`:
```
%1 = validate_deref(%ptr)
// use %ptr directly
```
vvv
```
%1 = ref_deref(%ptr)
// use %1
```
This makes `validate_deref` superfluous, so it's been removed.
Also fixes `node_offset_deref_ptr` source location to actually point to
the pointer being dereferenced and uses it to provide better source locs
for `deref` and `ref_deref`.
A handful of changes to get the regressed behavior tests running again.
- Replace `decorateBlockOffsets` with a recursive function `decorateLayout`
that walks arrays, vectors, structs, unions, optionals, and error unions,
emitting `ArrayStride` and member `Offset` decorations at every
level. Previously we weren't handling nested types.
- Restrict `Block` decoration to struct types with
`uniform`, `push_constant`, `storage_buffer` storage classes.
Previously we decorated through every pointer, contaminating the cached struct
type so the same shape used as a stack local also picked up `Block`.
- Lower `ptr_slice_ptr_ptr` and `ptr_slice_len_ptr`
- No longer emit a redundant `**T` typed `OpVariable` for function parameters.
Logical addressing also forbids such variables.
- Eliminate dead code from invocation globals unreachable from any entry point.
Reverting the workaround in `lib/std/start.zig`.
Execution modes (e.g. `LocalSize`, `OriginUpperLeft`) were previously set
via `gpu.executionMode()`, which used inline assembly to emit `OpExecutionMode`.
The SPIR-V assembler now rejects this instruction and retrieves execution mode information
from function cc, deleting `gpu.executionMode()` entirely.
Two new `spirv_task` and `spirv_mesh` calling conventions are also added
and `PackedCallingConvention.unpack()` now takes a trailing data slice.
`Entry.extractTo` writes output using a given writer instead of to a destination dir. `extract` now calls `extractTo`.
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35232
Identifiers like `u0_` should be legal but were previously rejected because
they were spuriously interpreted as primitive integer type identifiers.
Now the integer is first parsed and only if that succeeds it's checked for
a leading zero.
Previous commit fixed the crash but used this error code:
```
/// The interface name is longer than the host operating system supports.
NameTooLong,
```
More appropriate error code based on the documentation is:
```
/// If this is returned, more detailed diagnostics can be obtained by
/// calling the `Parsed.init` function.
ParseFailed,
```