CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / tests / amd-kfd / layout-oracle.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | /* Test-only oracle: no product links this file. The system header supplies all numbers/layouts. |
| 3 | * Allowed boundary: AGENTS.md tests and PROVENANCE.md class A, following tests/share/abi-oracle.c. |
| 4 | * Native execution prints requests.tsv. Cross compilation keeps the exact same values in .kfdlayout, |
| 5 | * so objcopy can check x86-64 layouts without executing a cross binary or opening any device. */ |
| 6 | #include <linux/kfd_ioctl.h> |
| 7 | #include <stddef.h> |
| 8 | #include <stdint.h> |
| 9 | #include <stdio.h> |
| 10 | |
| 11 | #define R(name, type, n) {(uint64_t)AMDKFD_IOC_##name, sizeof(struct type), n}, |
| 12 | #define F(type, field) {offsetof(struct type, field), sizeof(((struct type *)0)->field), 1}, |
| 13 | #define A(name, type, n) {0, sizeof(struct type), n}, |
| 14 | #define C(name, val) {(uint64_t)(val), 0, 0}, |
| 15 | #define U(name) {0, sizeof(__u32), 1}, |
| 16 | #define UF(name) {0, sizeof(__u32), 1}, |
| 17 | struct row { uint64_t a, b, c; }; |
| 18 | __attribute__((section(".kfdlayout"), used)) |
| 19 | const struct row kfd_layout[] = { |
| 20 | #include "layout-fields.inc" |
| 21 | }; |
| 22 | #undef R |
| 23 | #undef F |
| 24 | #undef A |
| 25 | #undef C |
| 26 | #undef U |
| 27 | #undef UF |
| 28 | #define R(name, type, n) #name, |
| 29 | #define F(type, field) #field, |
| 30 | #define A(name, type, n) #name, |
| 31 | #define C(name, val) #name, |
| 32 | #define U(name) #name, |
| 33 | #define UF(name) #name, |
| 34 | static const char *const labels[] = { |
| 35 | #include "layout-fields.inc" |
| 36 | }; |
| 37 | int main(void) { |
| 38 | for (size_t i = 0; i < sizeof(kfd_layout)/sizeof(kfd_layout[0]); ++i) |
| 39 | printf("%llu\t%llu\t%llu\t# %s\n", |
| 40 | (unsigned long long)kfd_layout[i].a, |
| 41 | (unsigned long long)kfd_layout[i].b, |
| 42 | (unsigned long long)kfd_layout[i].c, labels[i]); |
| 43 | return ferror(stdout) ? 74 : 0; |
| 44 | } |