aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2025-05-25 12:36:53 +0200
committerGitHub <noreply@github.com>2025-05-25 12:36:53 +0200
commitdc6ffc28b57a96fd03f62bc665b6ed28b8e9e67b (patch)
treebeb8163c07c11faa90131a1df1d589016d93b231 /src/target.zig
parent35ba8d95a1afd0bebba3c32cf68990f5129fabfe (diff)
parent4bf1e4d198abd2018bf23f9067617800a2bc0554 (diff)
downloadzig-dc6ffc28b57a96fd03f62bc665b6ed28b8e9e67b.tar.gz
zig-dc6ffc28b57a96fd03f62bc665b6ed28b8e9e67b.zip
Merge pull request #23815 from alichraghi/master
spirv: unroll all vector operations
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/target.zig b/src/target.zig
index 4931b11eba..6119b002a4 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -501,21 +501,26 @@ pub fn addrSpaceCastIsValid(
/// part of a merge (result of a branch) and may not be stored in memory at all. This function returns
/// for a particular architecture and address space wether such pointers are logical.
pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool {
- if (target.os.tag != .vulkan) {
- return false;
- }
+ if (target.os.tag != .vulkan) return false;
return switch (as) {
// TODO: Vulkan doesn't support pointers in the generic address space, we
// should remove this case but this requires a change in defaultAddressSpace().
// For now, at least disable them from being regarded as physical.
.generic => true,
- // For now, all global pointers are represented using PhysicalStorageBuffer, so these are real
- // pointers.
+ // For now, all global pointers are represented using StorageBuffer or CrossWorkgroup,
+ // so these are real pointers.
.global => false,
- // TODO: Allowed with VK_KHR_variable_pointers.
- .shared => true,
- .constant, .local, .input, .output, .uniform, .push_constant, .storage_buffer => true,
+ .physical_storage_buffer => false,
+ .shared => !target.cpu.features.isEnabled(@intFromEnum(std.Target.spirv.Feature.variable_pointers)),
+ .constant,
+ .local,
+ .input,
+ .output,
+ .uniform,
+ .push_constant,
+ .storage_buffer,
+ => true,
else => unreachable,
};
}
@@ -802,7 +807,8 @@ pub fn zigBackend(target: std.Target, use_llvm: bool) std.builtin.CompilerBacken
.powerpc, .powerpcle, .powerpc64, .powerpc64le => .stage2_powerpc,
.riscv64 => .stage2_riscv64,
.sparc64 => .stage2_sparc64,
- .spirv64 => .stage2_spirv64,
+ .spirv32 => if (target.os.tag == .opencl) .stage2_spirv64 else .other,
+ .spirv, .spirv64 => .stage2_spirv64,
.wasm32, .wasm64 => .stage2_wasm,
.x86 => .stage2_x86,
.x86_64 => .stage2_x86_64,