Skip to content

Commit ca06071

Browse files
committed
gtests: add regression test for PVC WAR bug workaround
1 parent 2320a96 commit ca06071

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

src/gpu/intel/compute/device_info.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct alignas(int) gpu_product_t {
4949
unsigned char data[12];
5050
};
5151

52-
static inline std::string to_string(gpu_arch_t arch) {
52+
static inline const char *to_string(gpu_arch_t arch) {
5353
#define CASE(_case) \
5454
if (arch == gpu_arch_t::_case) return STRINGIFY(_case)
5555
CASE(xe_lp);

src/gpu/intel/engine.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,19 @@ status_t engine_t::init(const std::vector<uint8_t> &cache_blob) {
8888
} // namespace impl
8989
} // namespace dnnl
9090

91-
bool dnnl_impl_gpu_mayiuse_ngen_kernels(dnnl::impl::engine_t *engine) {
91+
bool dnnl_impl_gpu_intel_mayiuse_ngen_kernels(dnnl::impl::engine_t *engine) {
9292
using namespace dnnl::impl;
9393
using namespace dnnl::impl::gpu;
9494

9595
auto *intel_engine = utils::downcast<intel::engine_t *>(engine);
9696
return intel_engine->mayiuse_ngen_kernels();
9797
}
98+
99+
const char *dnnl_impl_gpu_intel_get_isa_name(dnnl::impl::engine_t *engine) {
100+
using namespace dnnl::impl;
101+
using namespace dnnl::impl::gpu;
102+
103+
auto *intel_engine = utils::downcast<intel::engine_t *>(engine);
104+
auto *device_info = intel_engine->device_info();
105+
return intel::compute::to_string(device_info->gpu_arch());
106+
}

src/gpu/intel/engine.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ class engine_t : public gpu::engine_t {
212212
} // namespace dnnl
213213

214214
// Exported for testing purposes only.
215-
extern "C" bool DNNL_API dnnl_impl_gpu_mayiuse_ngen_kernels(
215+
extern "C" bool DNNL_API dnnl_impl_gpu_intel_mayiuse_ngen_kernels(
216+
dnnl::impl::engine_t *engine);
217+
extern "C" DNNL_API const char *dnnl_impl_gpu_intel_get_isa_name(
216218
dnnl::impl::engine_t *engine);
217219

218220
#endif

tests/gtests/ocl/api/test_engine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <string>
2424
#include <CL/cl.h>
2525

26-
extern "C" bool dnnl_impl_gpu_mayiuse_ngen_kernels(dnnl_engine_t engine);
26+
extern "C" bool dnnl_impl_gpu_intel_mayiuse_ngen_kernels(dnnl_engine_t engine);
2727

2828
namespace dnnl {
2929
namespace {
@@ -287,7 +287,7 @@ TEST_P(ocl_engine_test_t, BinaryKernels) {
287287
//DNNL_ENABLE_MEM_DEBUG forces allocation fail, causing mayiuse to fail
288288
#ifndef DNNL_ENABLE_MEM_DEBUG
289289
if (s == dnnl_success) {
290-
ASSERT_EQ(dnnl_impl_gpu_mayiuse_ngen_kernels(eng), true);
290+
ASSERT_EQ(dnnl_impl_gpu_intel_mayiuse_ngen_kernels(eng), true);
291291
}
292292
#endif
293293

tests/gtests/regression/CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,22 @@
1414
# limitations under the License.
1515
#===============================================================================
1616

17-
set(TEST_EXE test_regression)
17+
set(TEST_SOURCES
18+
test_regression_binary_stride.cpp
19+
)
1820

19-
file(GLOB TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test_*.cpp)
20-
list(APPEND TEST_SOURCES ${MAIN_SRC_GTEST})
21+
if(UNIX)
22+
set(TEST_SOURCES "${TEST_SOURCES};test_regression_pvc_war_wa.cpp")
23+
endif()
2124

22-
register_exe(${TEST_EXE} "${TEST_SOURCES}" "test" "dnnl_gtest")
25+
foreach(TEST_FILE ${TEST_SOURCES})
26+
get_filename_component(exe ${TEST_FILE} NAME_WE)
27+
register_exe("${exe}" "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE};${MAIN_SRC_GTEST}" "test" "dnnl_gtest")
28+
endforeach()
29+
30+
if(TARGET test_regression_pvc_war_wa)
31+
# Regression test for PVC WAR bug workaround. The bug is triggered by setting
32+
# round-robin thread arbitration policy so override it here.
33+
set_tests_properties(test_regression_pvc_war_wa
34+
PROPERTIES ENVIRONMENT "NEOReadDebugKeys=1;OverrideThreadArbitrationPolicy=1")
35+
endif()

0 commit comments

Comments
 (0)