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 / tests / gpu_om_ir_boundary_test.c

31 lines · 1254 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2#include "omega_gpu_om_ir.h"
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6
7static uint32_t boundary(uint64_t *result,uint64_t op,uint64_t a,uint64_t b,uint64_t c,
8 void *iv,uint64_t ni,void *mv,uint64_t nm) {
9 uint64_t *ins=iv,*meta=mv;
10 (void)a;(void)b;(void)c;
11 if(ni!=OMEGA_OM_IR_WORDS||nm!=OMEGA_OM_IR_META)return 1;
12 memset(ins,0,ni*sizeof *ins);memset(meta,0,nm*sizeof *meta);
13 for(unsigned i=0;i<3;i++)for(unsigned f=1;f<=5;f++)ins[i*8+f]=UINT64_MAX;
14 ins[0]=BW_IR_MOV_IMM;ins[1]=0;ins[6]=0x3f800000u;
15 ins[8]=op;ins[9]=1;ins[10]=0;
16 ins[16]=BW_IR_EXIT;
17 meta[0]=3;meta[1]=2;meta[64]=meta[65]=1;
18 *result=0;return 0;
19}
20int main(void) {
21 BlackwellIRProgram *p=malloc(sizeof *p);if(!p)return 2;
22 int last=omega_gpu_om_ir_replay(boundary,BW_IR_LAST,0,0,0,p,NULL);
23 int past=omega_gpu_om_ir_replay(boundary,(uint64_t)BW_IR_LAST+1,0,0,0,p,NULL);
24 free(p);
25 if(last!=OMEGA_OM_IR_OK||past!=OMEGA_OM_IR_REPLAY) {
26 fprintf(stderr,"om-ir-boundary: FAIL (last=%d, past=%d)\n",last,past);
27 return 1;
28 }
29 puts("om-ir-boundary: PASS (BW_IR_LAST accepted; BW_IR_LAST+1 refused)");
30 return 0;
31}