[all-commits] [llvm/llvm-project] f7d037: [AMDGPU] Generalize amdgcn.make.buffer.rsrc to fat...

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Tue Feb 18 12:15:51 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7d03707d1f59cddab98d49fe55d8946477f87c8
      https://github.com/llvm/llvm-project/commit/f7d03707d1f59cddab98d49fe55d8946477f87c8
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/test/CodeGenHIP/builtins-make-buffer-rsrc.hip
    M clang/test/CodeGenOpenCL/builtins-amdgcn-make-buffer-rsrc.cl
    M llvm/docs/AMDGPUUsage.rst
    M llvm/include/llvm/IR/IntrinsicsAMDGPU.td
    M llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.make.buffer.rsrc.ll
    M llvm/test/CodeGen/AMDGPU/llvm.amdgcn.make.buffer.rsrc.ll
    M llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll
    M llvm/test/CodeGen/AMDGPU/make-buffer-rsrc-lds-fails.ll
    M llvm/test/CodeGen/AMDGPU/ptr-buffer-alias-scheduling.ll
    M llvm/test/Transforms/FunctionAttrs/make-buffer-rsrc.ll
    M llvm/test/Transforms/LICM/AMDGPU/buffer-rsrc-ptrs.ll
    M mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
    M mlir/test/Target/LLVMIR/rocdl.mlir

  Log Message:
  -----------
  [AMDGPU] Generalize amdgcn.make.buffer.rsrc to fat pointers (#126828)

Attempting to pass a `ptr addrspace(7)` to functions that take `ptr`
arguments produces undesirable `addrspacecast(addrspacecast(p8 x to p7)
to p0) => addrspacecast(p8 x to p0)` folds. This results in illegal GEP
operations on buffer resources, which can't be GEP'd. (However, note
that, while unimplemneted, addressspacecast from ptr addrspace(7) to ptr
is legal - it's just an effective address computation)

To resolve this problem, and thus prevent illegal
`getelementptr T, ptr addrspace(8) %x, ...` s from being produces, this
commit extends amdgcn.make.buffer.rsrc to also be variadic in its result
type, auto-upgrading old manglings.

The logic for handling a make.buffer.rsrc in instruction selection
remains untouched and expects the output type to be a ptr addrspace(8),
as does the Clang lowering for its builtin (the pointer-to-pointer
version might want a different name in clang). LowerBufferFatPointers
has been updated to lower
amdgcn.make.buffer.rsrc.p7.p* to amdgcn.make.buffer.rsrc.p8.p* .

This'll also make exposing buffer fat pointers in Clang easier, since
you don't have to cast between a `__amdgcn_rsrc_t` and a pointer.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list