xref: /aosp_15_r20/external/clpeak/include/clpeak.h (revision 1cd03ba3888297bc945f2c84574e105e3ced3e34)
1 #ifndef CLPEAK_HPP
2 #define CLPEAK_HPP
3 
4 #include <iostream>
5 #include <stdio.h>
6 #include <iomanip>
7 #include <string.h>
8 #include <sstream>
9 #include <common.h>
10 #include <logger.h>
11 
12 #define BUILD_OPTIONS " -cl-mad-enable "
13 
14 using namespace std;
15 
16 class clPeak
17 {
18 public:
19   bool forcePlatform, forcePlatformName, forceDevice, forceDeviceName, forceTest, useEventTimer;
20   bool isGlobalBW, isComputeHP, isComputeSP, isComputeDP, isComputeIntFast, isComputeInt, isTransferBW, isKernelLatency, isComputeChar, isComputeShort;
21   ulong specifiedPlatform, specifiedDevice;
22   char *specifiedPlatformName;
23   char *specifiedDeviceName;
24   char *specifiedTestName;
25   logger *log;
26 
27   clPeak();
28   ~clPeak();
29 
30   int parseArgs(int argc, char **argv);
31 
32   // Return avg time in us
33   float run_kernel(cl::CommandQueue &queue, cl::Kernel &kernel, cl::NDRange &globalSize, cl::NDRange &localSize, uint iters);
34 
35   int runGlobalBandwidthTest(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
36 
37   int runComputeSP(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
38 
39   int runComputeHP(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
40 
41   int runComputeDP(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
42 
43   int runComputeInteger(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
44 
45   int runComputeIntFast(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
46 
47   int runComputeChar(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
48 
49   int runComputeShort(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
50 
51   int runTransferBandwidthTest(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
52 
53   int runKernelLatency(cl::CommandQueue &queue, cl::Program &prog, device_info_t &devInfo);
54 
55   int runAll();
56 };
57 
58 #endif // CLPEAK_HPP
59