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 / src / omega_chip_enum.h

25 lines · 946 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2#ifndef OMEGA_CHIP_ENUM_H
3#define OMEGA_CHIP_ENUM_H
4#include "cudapp_native.h"
5#include "omega_gpu_chip.h"
6#include <stdlib.h>
7#ifndef CUDAPP_MIGRATION_PENDING_C_CHIP_ENUM_POLICY
8#define CUDAPP_MIGRATION_PENDING_C_CHIP_ENUM_POLICY 0
9#endif
10/* Modes: row identity, raw vendor, display class, field mask, output slot, dot entry. */
11static inline uint64_t omega_chip_enum_decide(uint64_t mode, uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
12#if CUDAPP_MIGRATION_PENDING_C_CHIP_ENUM_POLICY
13 if (mode == 0) return a == c && b == d;
14 if (mode == 1) return a == OMEGA_GPU_PCI_VENDOR_NVIDIA;
15 if (mode == 2) return (a >> 16) == 0x03u;
16 if (mode == 4) return (int64_t)a < (int64_t)b && c;
17 if (mode == 5) return a == '.';
18 return a & b;
19#else
20 uint64_t result;
21 if (omega_chip_enum(&result, mode, a, b, c, d) != OMEGA_OK) abort();
22 return result;
23#endif
24}
25#endif