interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tools / prof / stamp_oracle.c

35 lines · 1005 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2/* Differential oracle for emit_stamp in src/omega_gpu_cmdlist.c.
3 * Prints the six method words, one per line. It does not open a device. */
4#include <stdint.h>
5#include <stdio.h>
6#include <stdlib.h>
7
8static uint32_t bw_mthd(uint32_t subc, uint32_t mthd, uint32_t count) {
9 return (2u << 28) | (count << 16) | (subc << 13) | (mthd >> 2);
10}
11
12int main(int argc, char **argv) {
13 unsigned long long va;
14 unsigned long long slot;
15 unsigned long long addr;
16 char *end = NULL;
17 if (argc != 3) {
18 return 2;
19 }
20 va = strtoull(argv[1], &end, 10);
21 if (end == argv[1] || *end != '\0') {
22 return 2;
23 }
24 slot = strtoull(argv[2], &end, 10);
25 if (end == argv[2] || *end != '\0') {
26 return 2;
27 }
28 addr = va + slot * 16ull;
29 printf("%u\n%llu\n0\n%u\n%u\n0\n",
30 bw_mthd(1u, 0x0158u, 5u),
31 slot,
32 (unsigned)addr,
33 (unsigned)(addr >> 32));
34 return 0;
35}