[llvm] [AMDGPU] Split struct kernel arguments (PR #133786)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 10:15:40 PDT 2025


================
@@ -0,0 +1,373 @@
+//===--- AMDGPUSplitKernelArguments.cpp - Split kernel arguments ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// \file This pass flats struct-type kernel arguments. It eliminates unused
+// fields and only keeps used fields. The objective is to facilitate preloading
+// of kernel arguments by later passes.
----------------
yxsamliu wrote:

Since the struct-type kernel arguments contain useless fields preventing us from preloading all useful kernel arguments or fields, this optimization cannot be done by reordering arguments. Besides, reordering arguments also requires similar ABI change since the kernel launching ABI accepts an array of pointers to args and lays out them in kernel arg segment by HSA metadata.

Will add tests to llvm-test-suite to do comprehensive tests.

https://github.com/llvm/llvm-project/pull/133786


More information about the llvm-commits mailing list