[clang] clang: Add builtin header for amdhsa abi (PR #181993)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 18 06:04:06 PST 2026
================
@@ -0,0 +1,80 @@
+//===-- amdhsa_abi.h - AMDHSA ABI definition utilities --------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __AMDHSA_ABI_H
+#define __AMDHSA_ABI_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+typedef struct __attribute__((aligned(8))) amdhsa_implicit_kernarg_v5 {
+ uint32_t block_count[3];
+ uint16_t group_size[3];
+ uint16_t remainder[3];
+ char reserved0[16];
+ uint64_t global_offset[3];
+ uint16_t grid_dims;
+ char reserved1[14];
+ __attribute__((opencl_global)) void *hostcall_buffer;
+ __attribute__((opencl_global)) void *multigrid_sync_arg;
+ __attribute__((opencl_global)) void *heap_v1;
+ __attribute__((opencl_global)) void *default_queue;
+ __attribute__((opencl_global)) void *completion_action;
+ char reserved2[72];
+ uint32_t private_base; // Unused on gfx9+
+ uint32_t shared_base; // Unused on gfx9+
+ __attribute__((opencl_global)) void *queue_ptr;
+ char reserved3[48];
+} amdhsa_implicit_kernarg_v5;
+
+_Static_assert(sizeof(amdhsa_implicit_kernarg_v5) == 256, "wrong struct size");
+
+_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[0]) == 0,
----------------
jhuber6 wrote:
Not sure we need to assert on every member of a naturally aligned struct, but I suppose it does prove that the offsets we use are correct.
https://github.com/llvm/llvm-project/pull/181993
More information about the cfe-commits
mailing list