mirror of
https://github.com/ziglang/zig.git
synced 2026-02-01 04:03:40 +00:00
allow global/local/shared address spaces on amdgcn
This commit is contained in:
parent
5859d8458f
commit
3392de87dc
@ -30303,13 +30303,15 @@ pub fn analyzeAddrspace(
|
||||
const address_space = addrspace_tv.val.toEnum(std.builtin.AddressSpace);
|
||||
const target = sema.mod.getTarget();
|
||||
const arch = target.cpu.arch;
|
||||
const is_gpu = arch == .nvptx or arch == .nvptx64;
|
||||
const is_nv = arch == .nvptx or arch == .nvptx64;
|
||||
const is_gpu = is_nv or arch == .amdgcn;
|
||||
|
||||
const supported = switch (address_space) {
|
||||
.generic => true,
|
||||
.gs, .fs, .ss => (arch == .i386 or arch == .x86_64) and ctx == .pointer,
|
||||
// TODO: check that .shared and .local are left uninitialized
|
||||
.global, .param, .shared, .local => is_gpu,
|
||||
.param => is_nv,
|
||||
.global, .shared, .local => is_gpu,
|
||||
.constant => is_gpu and (ctx == .constant),
|
||||
};
|
||||
|
||||
|
||||
@ -2659,6 +2659,14 @@ pub const DeclGen = struct {
|
||||
.local => llvm.address_space.nvptx.local,
|
||||
else => unreachable,
|
||||
},
|
||||
.amdgcn => switch (address_space) {
|
||||
.generic => llvm.address_space.flat,
|
||||
.global => llvm.address_space.amdgpu.global,
|
||||
.constant => llvm.address_space.amdgpu.constant,
|
||||
.shared => llvm.address_space.amdgpu.local,
|
||||
.local => llvm.address_space.amdgpu.private,
|
||||
else => unreachable,
|
||||
}.
|
||||
else => switch (address_space) {
|
||||
.generic => llvm.address_space.default,
|
||||
else => unreachable,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user