Files
TheRock/rocm-systems/projects/clr/opencl/tests/ocltst/module/perf/OCLPerfKernelThroughput.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

104 lines
2.3 KiB
C++

/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/
/*******************************************************************************
* Kernel Throughput
*
*
*
*
*
*
******************************************************************************/
#ifndef _OCL_KernelThroughput_H_
#define _OCL_KernelThroughput_H_
#ifdef WIN32
#include "xmmintrin.h"
#endif
#include "OCLTestImp.h"
// #include <sstream>
// #define WIN32_LEAN_AND_MEAN //Restricts windows.h to include only the core
// API. #include "windows.h" #undef Yield #include <process.h> #include
//<xmmintrin.h> #include <emmintrin.h> #include <pmmintrin.h>
#define LARGE_INT long long
#define UNSIGNED_LARGE_INT unsigned long long
#define MAX_LOOP_ITER 10
typedef cl_float4 float4;
typedef void (*CPUKernel)(__m128*, __m128*, unsigned int);
class OCLPerfKernelThroughput : public OCLTestImp {
public:
OCLPerfKernelThroughput();
virtual ~OCLPerfKernelThroughput();
public:
virtual void open(unsigned int test, char* units, double& conversion, unsigned int deviceID);
virtual void run(void);
virtual unsigned int close(void);
std::string shader_;
void genShaderMadds();
void genShaderMatrixMultiply();
void checkData();
// void allocateBuffers();
void launchKernel();
// test parameters
int kernelTypeIdx_;
int memPathIdx_;
int numElementsIdx_;
int workSizeIdx_;
float gold_;
double _reqDataSize;
bool _dataSizeTooBig;
// device attributes
cl_uint maxComputeUnits_;
cl_uint maxClockFrequency_;
LARGE_INT numComputeUnits_;
LARGE_INT numWorkGroupsPerComputeUnit_;
LARGE_INT numThreads_;
cl_uint work_dim_;
size_t* global_work_size_;
size_t* local_work_size_;
// opencl objects
cl_context context_;
cl_command_queue cmd_queue_;
cl_program program_;
cl_kernel kernel_;
cl_int error_;
// buffer sizes
// kernel-specific values
int flopsPerByte_;
int matrixDim1_, matrixDim2_;
// buffers
size_t input1BufferSize_;
size_t input2BufferSize_;
size_t output1BufferSize_;
cl_mem input1Buffer_;
cl_mem input2Buffer_;
cl_mem output1Buffer_;
float* input1Ptr_;
float* input2Ptr_;
float* output1Ptr_;
// performance results
float bandwidth_; // GB/s
float gflops_; // GFlop/s
float avgKernelTime_; // microseconds
};
#endif // _OCL_KernelThroughput_H_