From 87a4e331502924179453fa360427c41cd16cce1a Mon Sep 17 00:00:00 2001 From: jatang Date: Wed, 8 Mar 2023 15:55:54 -0500 Subject: [PATCH] SWDEV-386095 - Remove GL dependency from oclperf Change-Id: Ie65e2b51af399e0816bb1f5283c8f2e7a330c730 [ROCm/clr commit: 94b1872628c18f0e286d3fde5f7de8f6b9826ae5] --- .../tests/ocltst/module/common/CMakeLists.txt | 19 ---------------- .../tests/ocltst/module/gl/CMakeLists.txt | 11 ++++++++++ .../OCLGLPerfSepia.cpp} | 22 +++++++++---------- .../OCLPerfSepia.h => gl/OCLGLPerfSepia.h} | 6 ++--- .../tests/ocltst/module/gl/TestList.cpp | 3 ++- .../tests/ocltst/module/perf/CMakeLists.txt | 6 ----- .../tests/ocltst/module/perf/TestList.cpp | 6 ----- 7 files changed, 27 insertions(+), 46 deletions(-) rename projects/clr/opencl/tests/ocltst/module/{perf/OCLPerfSepia.cpp => gl/OCLGLPerfSepia.cpp} (97%) rename projects/clr/opencl/tests/ocltst/module/{perf/OCLPerfSepia.h => gl/OCLGLPerfSepia.h} (95%) diff --git a/projects/clr/opencl/tests/ocltst/module/common/CMakeLists.txt b/projects/clr/opencl/tests/ocltst/module/common/CMakeLists.txt index 9424445dea..888151b416 100644 --- a/projects/clr/opencl/tests/ocltst/module/common/CMakeLists.txt +++ b/projects/clr/opencl/tests/ocltst/module/common/CMakeLists.txt @@ -7,13 +7,6 @@ set(COMMON_SOURCES ${OCLTST_DIR}/module/common/OCLWrapper.cpp ${OCLTST_DIR}/module/common/Timer.cpp) -if(OPENGL_FOUND AND GLEW_FOUND) - set(COMMON_SOURCES - ${COMMON_SOURCES} - ${OCLTST_DIR}/module/common/OCLGLCommon.cpp - ${OCLTST_DIR}/module/common/OCLGLCommonLinux.cpp) -endif() - add_library(Common OBJECT ${COMMON_SOURCES}) set_target_properties(Common PROPERTIES @@ -32,12 +25,6 @@ if(EMU_ENV) EMU_ENV=1) endif() -if(OPENGL_FOUND AND GLEW_FOUND) - target_compile_definitions(Common - PUBLIC - USE_OPENGL=1) -endif() - target_include_directories(Common PUBLIC ${OPENCL_ICD_LOADER_HEADERS_DIR} @@ -46,9 +33,3 @@ target_include_directories(Common ${OCLTST_DIR}/module/include ${PROJECT_SOURCE_DIR}/amdocl) #TODO remove cl_profile_amd.h dependency -if(OPENGL_FOUND AND GLEW_FOUND) - target_include_directories(Common - PUBLIC - ${OPENGL_INCLUDE_DIR} - ${GLEW_INCLUDE_DIRS}) -endif() diff --git a/projects/clr/opencl/tests/ocltst/module/gl/CMakeLists.txt b/projects/clr/opencl/tests/ocltst/module/gl/CMakeLists.txt index 6008f1be2b..115879cf15 100644 --- a/projects/clr/opencl/tests/ocltst/module/gl/CMakeLists.txt +++ b/projects/clr/opencl/tests/ocltst/module/gl/CMakeLists.txt @@ -7,6 +7,7 @@ set(TESTS OCLGLMsaaTexture OCLGLMultiContext OCLGLTexture + OCLGLPerfSepia ) add_library(oclgl SHARED @@ -19,6 +20,16 @@ foreach(TEST ${TESTS}) ${TEST}.cpp) endforeach() +target_sources(oclgl + PRIVATE + ${OCLTST_DIR}/module/common/OCLGLCommon.cpp + ${OCLTST_DIR}/module/common/OCLGLCommonLinux.cpp) + +target_include_directories(oclgl + PUBLIC + ${OPENGL_INCLUDE_DIR} + ${GLEW_INCLUDE_DIRS}) + set_target_properties(oclgl PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON diff --git a/projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.cpp b/projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.cpp similarity index 97% rename from projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.cpp rename to projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.cpp index 366108b6d3..a5b743a13d 100644 --- a/projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.cpp +++ b/projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.cpp @@ -18,7 +18,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "OCLPerfSepia.h" +#include "OCLGLPerfSepia.h" #include #include @@ -158,11 +158,11 @@ const static char *strKernel = "/*o0*/);\n" "}\n"; -OCLPerfSepia::OCLPerfSepia() { _numSubTests = 2; } +OCLGLPerfSepia::OCLGLPerfSepia() { _numSubTests = 2; } -OCLPerfSepia::~OCLPerfSepia() {} +OCLGLPerfSepia::~OCLGLPerfSepia() {} -void OCLPerfSepia::open(unsigned int test, char *units, double &conversion, +void OCLGLPerfSepia::open(unsigned int test, char *units, double &conversion, unsigned int deviceId) { bVerify_ = false; silentFailure_ = false; @@ -215,7 +215,7 @@ void OCLPerfSepia::open(unsigned int test, char *units, double &conversion, } } -void OCLPerfSepia::populateData(void) { +void OCLGLPerfSepia::populateData(void) { width_ = WIDTH; height_ = HEIGHT; bpr_ = 4 * width_; @@ -225,7 +225,7 @@ void OCLPerfSepia::populateData(void) { } } -void OCLPerfSepia::runGL(void) { +void OCLGLPerfSepia::runGL(void) { glDisable(GL_ALPHA_TEST); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); @@ -392,7 +392,7 @@ void OCLPerfSepia::runGL(void) { glDeleteProgramsARB(1, &fragmentProgram); } -void OCLPerfSepia::runCL(void) { +void OCLGLPerfSepia::runCL(void) { cl_mem dst, src; cl_sampler nearestZero; @@ -508,7 +508,7 @@ void OCLPerfSepia::runCL(void) { _wrapper->clReleaseMemObject(dst), dst = NULL; } -void OCLPerfSepia::GetKernelExecDimsForImage(unsigned int work_group_size, +void OCLGLPerfSepia::GetKernelExecDimsForImage(unsigned int work_group_size, unsigned int w, unsigned int h, size_t *global, size_t *local) { unsigned int a, b; @@ -533,7 +533,7 @@ void OCLPerfSepia::GetKernelExecDimsForImage(unsigned int work_group_size, global[1] *= local[1]; } -void OCLPerfSepia::run(void) { +void OCLGLPerfSepia::run(void) { if (_errorFlag || silentFailure_) { return; } @@ -553,7 +553,7 @@ void OCLPerfSepia::run(void) { _perfInfo = (float)timer_.GetElapsedTime(); } -void OCLPerfSepia::verifyResult(void) { +void OCLGLPerfSepia::verifyResult(void) { int r = 0, g = 0, b = 0, a = 0, d = 0; for (unsigned int k = 0; k < height_ * bpr_; k += 4) { a = a + result_[k + 0]; @@ -565,7 +565,7 @@ void OCLPerfSepia::verifyResult(void) { abs(a - 267386880); CHECK_RESULT(d > 20000, "wrong result"); } -unsigned int OCLPerfSepia::close(void) { +unsigned int OCLGLPerfSepia::close(void) { if (silentFailure_) { return 0; } diff --git a/projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.h b/projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.h similarity index 95% rename from projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.h rename to projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.h index ad3fdcfd82..568cd8a93c 100644 --- a/projects/clr/opencl/tests/ocltst/module/perf/OCLPerfSepia.h +++ b/projects/clr/opencl/tests/ocltst/module/gl/OCLGLPerfSepia.h @@ -24,10 +24,10 @@ #include "OCLGLCommon.h" #include "Timer.h" -class OCLPerfSepia : public OCLGLCommon { +class OCLGLPerfSepia : public OCLGLCommon { public: - OCLPerfSepia(); - virtual ~OCLPerfSepia(); + OCLGLPerfSepia(); + virtual ~OCLGLPerfSepia(); virtual void open(unsigned int test, char *units, double &conversion, unsigned int deviceId); diff --git a/projects/clr/opencl/tests/ocltst/module/gl/TestList.cpp b/projects/clr/opencl/tests/ocltst/module/gl/TestList.cpp index f010ebbf0f..5aa378633a 100644 --- a/projects/clr/opencl/tests/ocltst/module/gl/TestList.cpp +++ b/projects/clr/opencl/tests/ocltst/module/gl/TestList.cpp @@ -31,6 +31,7 @@ #include "OCLGLMsaaTexture.h" #include "OCLGLMultiContext.h" #include "OCLGLTexture.h" +#include "OCLGLPerfSepia.h" // // Helper macro for adding tests @@ -46,7 +47,7 @@ static void* dictionary_CreateTestFunc(void) { TestEntry TestList[] = { TEST(OCLGLBuffer), TEST(OCLGLBufferMultipleQueues), TEST(OCLGLTexture), TEST(OCLGLMultiContext), - TEST(OCLGLFenceSync), TEST(OCLGLDepthTex), + TEST(OCLGLFenceSync), TEST(OCLGLDepthTex), TEST(OCLGLPerfSepia), }; unsigned int TestListCount = sizeof(TestList) / sizeof(TestList[0]); diff --git a/projects/clr/opencl/tests/ocltst/module/perf/CMakeLists.txt b/projects/clr/opencl/tests/ocltst/module/perf/CMakeLists.txt index cbe49a5f63..b9780283c6 100644 --- a/projects/clr/opencl/tests/ocltst/module/perf/CMakeLists.txt +++ b/projects/clr/opencl/tests/ocltst/module/perf/CMakeLists.txt @@ -80,12 +80,6 @@ foreach(TEST ${TESTS}) ${TEST}.cpp) endforeach() -if(OPENGL_FOUND AND GLEW_FOUND) - target_sources(oclperf - PRIVATE - OCLPerfSepia.cpp) -endif() - set_target_properties(oclperf PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON diff --git a/projects/clr/opencl/tests/ocltst/module/perf/TestList.cpp b/projects/clr/opencl/tests/ocltst/module/perf/TestList.cpp index 3b85c6a856..2d6ad75749 100644 --- a/projects/clr/opencl/tests/ocltst/module/perf/TestList.cpp +++ b/projects/clr/opencl/tests/ocltst/module/perf/TestList.cpp @@ -69,9 +69,6 @@ #include "OCLPerfSampleRate.h" #include "OCLPerfScalarReplArrayElem.h" #include "OCLPerfSdiP2PCopy.h" -#if USE_OPENGL -#include "OCLPerfSepia.h" -#endif #include "OCLPerfTextureMemLatency.h" #include "OCLPerfUAVReadSpeed.h" #include "OCLPerfUAVReadSpeedHostMem.h" @@ -145,9 +142,6 @@ TestEntry TestList[] = { TEST(OCLPerfImageCopyCorners), TEST(OCLPerfScalarReplArrayElem), TEST(OCLPerfSdiP2PCopy), -#if USE_OPENGL - TEST(OCLPerfSepia), -#endif TEST(OCLPerfFlush), TEST(OCLPerfMemCreate), TEST(OCLPerfImageMapUnmap),