// Run relu on the Intel UHD 770 iGPU (SYCL, Level-Zero/OpenCL). Shared DDR5 memory. #include #include #include #include #include using namespace sycl; int main(){ queue q{gpu_selector_v}; auto d=q.get_device(); printf("device: %s\n", d.get_info().c_str()); printf(" compute units: %u, global mem: %.2f GB\n", d.get_info(), d.get_info()/1e9); const size_t n=64ull*1024*1024; // 256 MB/array float* in =malloc_device(n,q); float* out=malloc_device(n,q); if(!in||!out){ printf("alloc failed\n"); return 1; } std::vector h(n); for(size_t i=0;i(n),[=](id<1> i){ out[i]=in[i]>0.f?in[i]:0.f; }).wait(); }; for(int w=0;w<5;++w) run(); // warmup (JIT compile) std::vector o(n); q.memcpy(o.data(),out,n*4).wait(); bool ok=true; for(size_t i=0;i0?h[i]:0; if(o[i]!=e) ok=false; } double best=1e30; for(int r=0;r<12;++r){ auto a=std::chrono::high_resolution_clock::now(); run(); auto b=std::chrono::high_resolution_clock::now(); best=std::min(best,std::chrono::duration(b-a).count()); } printf("iGPU relu (fp32, 64M): %.1f GB/s (%.2f ms) %s\n", gb/best, best*1e3, ok?"OK":"FAIL"); free(in,q); free(out,q); return 0; }