| 1 | //===-- amdhsa_abi.h - AMDHSA ABI definition utilities --------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef __AMDHSA_ABI_H |
| 10 | #define __AMDHSA_ABI_H |
| 11 | |
| 12 | #include <stddef.h> |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | typedef struct __attribute__((aligned(8))) amdhsa_implicit_kernarg_v5 { |
| 16 | uint32_t block_count[3]; |
| 17 | uint16_t group_size[3]; |
| 18 | uint16_t remainder[3]; |
| 19 | char reserved0[16]; |
| 20 | uint64_t global_offset[3]; |
| 21 | uint16_t grid_dims; |
| 22 | char reserved1[6]; |
| 23 | __attribute__((opencl_global)) void *printf_buffer; |
| 24 | __attribute__((opencl_global)) void *hostcall_buffer; |
| 25 | __attribute__((opencl_global)) void *multigrid_sync_arg; |
| 26 | __attribute__((opencl_global)) void *heap_v1; |
| 27 | __attribute__((opencl_global)) void *default_queue; |
| 28 | __attribute__((opencl_global)) void *completion_action; |
| 29 | char reserved2[72]; |
| 30 | uint32_t private_base; // Unused on gfx9+ |
| 31 | uint32_t shared_base; // Unused on gfx9+ |
| 32 | __attribute__((opencl_global)) void *queue_ptr; |
| 33 | char reserved3[48]; |
| 34 | } amdhsa_implicit_kernarg_v5; |
| 35 | |
| 36 | _Static_assert(sizeof(amdhsa_implicit_kernarg_v5) == 256, "wrong struct size"); |
| 37 | |
| 38 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[0]) == 0, |
| 39 | "wrong offset"); |
| 40 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[1]) == 4, |
| 41 | "wrong offset"); |
| 42 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[2]) == 8, |
| 43 | "wrong offset"); |
| 44 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[0]) == 12, |
| 45 | "wrong offset"); |
| 46 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[1]) == 14, |
| 47 | "wrong offset"); |
| 48 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[2]) == 16, |
| 49 | "wrong offset"); |
| 50 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[0]) == 18, |
| 51 | "wrong offset"); |
| 52 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[1]) == 20, |
| 53 | "wrong offset"); |
| 54 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[2]) == 22, |
| 55 | "wrong offset"); |
| 56 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[0]) == 40, |
| 57 | "wrong offset"); |
| 58 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[1]) == 48, |
| 59 | "wrong offset"); |
| 60 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[2]) == 56, |
| 61 | "wrong offset"); |
| 62 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, grid_dims) == 64, |
| 63 | "wrong offset"); |
| 64 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, printf_buffer) == 72, |
| 65 | "wrong offset"); |
| 66 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, hostcall_buffer) == 80, |
| 67 | "wrong offset"); |
| 68 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, multigrid_sync_arg) == 88, |
| 69 | "wrong offset"); |
| 70 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, heap_v1) == 96, |
| 71 | "wrong offset"); |
| 72 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, default_queue) == 104, |
| 73 | "wrong offset"); |
| 74 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, completion_action) == 112, |
| 75 | "wrong offset"); |
| 76 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, private_base) == 192, |
| 77 | "wrong offset"); |
| 78 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, shared_base) == 196, |
| 79 | "wrong offset"); |
| 80 | _Static_assert(offsetof(amdhsa_implicit_kernarg_v5, queue_ptr) == 200, |
| 81 | "wrong offset"); |
| 82 | |
| 83 | #endif // __AMDHSA_ABI_H |